Add -s flag to microdump_stackwalk for dumping stack contents.

Note that the current MicrodumpProcessor::Process implementation has a
bug due to the fact that it creates a local Microdump instance, and then
holds onto a pointer to the object returned by microdump.GetMemory()
which is destroyed when microdump goes out of scope. This CL fixes the
crash by making Microdump outlive MicrodumpProcessor, which is the same
pattern that Minidump/MinidumpProcessor uses.

Bug: google-breakpad:748
Change-Id: I554b46d309649cf404523722bd9ee39e17a10139
Reviewed-on: https://chromium-review.googlesource.com/720809
Reviewed-by: Primiano Tucci <primiano@chromium.org>
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This commit is contained in:
Tobias Sargeant 2017-10-16 10:22:57 +01:00 committed by Tobias Sargeant
parent 623c4a0f42
commit 3d6076efc2
6 changed files with 32 additions and 30 deletions

View file

@ -37,6 +37,7 @@
#include "breakpad_googletest_includes.h"
#include "google_breakpad/processor/basic_source_line_resolver.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/microdump.h"
#include "google_breakpad/processor/microdump_processor.h"
#include "google_breakpad/processor/process_state.h"
#include "google_breakpad/processor/stack_frame.h"
@ -47,6 +48,7 @@
namespace {
using google_breakpad::BasicSourceLineResolver;
using google_breakpad::Microdump;
using google_breakpad::MicrodumpProcessor;
using google_breakpad::ProcessState;
using google_breakpad::SimpleSymbolSupplier;
@ -83,7 +85,8 @@ class MicrodumpProcessorTest : public ::testing::Test {
StackFrameSymbolizer frame_symbolizer(&supplier, &resolver);
MicrodumpProcessor processor(&frame_symbolizer);
return processor.Process(microdump_contents, state);
Microdump microdump(microdump_contents);
return processor.Process(&microdump, state);
}
void AnalyzeDump(const string& microdump_file_name, bool omit_symbols,
@ -109,13 +112,6 @@ class MicrodumpProcessorTest : public ::testing::Test {
string files_path_;
};
TEST_F(MicrodumpProcessorTest, TestProcess_Empty) {
ProcessState state;
google_breakpad::ProcessResult result =
ProcessMicrodump("", "", &state);
ASSERT_EQ(google_breakpad::PROCESS_ERROR_MINIDUMP_NOT_FOUND, result);
}
TEST_F(MicrodumpProcessorTest, TestProcess_Invalid) {
ProcessState state;
google_breakpad::ProcessResult result =