diff options
author | Lei Zhang <thestig@google.com> | 2016-01-29 13:59:17 -0800 |
---|---|---|
committer | Lei Zhang <thestig@google.com> | 2016-01-29 13:59:17 -0800 |
commit | 815d51c343b6a003f15d9327f1f1fd16eb5aba86 (patch) | |
tree | 485931679ad7cf7bea027a6a6f6df6458062fd44 /src | |
parent | Improvements to GYP build (diff) | |
download | breakpad-815d51c343b6a003f15d9327f1f1fd16eb5aba86.tar.xz |
Added a switch to dump minidump modules in minidump_stackwalk.
In order to figure out what symbols we need associated to a minidump,
it is useful to be able to dump all the modules the minidump contains.
A=dyen@chromium.org
Original Review: https://codereview.chromium.org/1651593002/
BUG=563716
R=dyen@chromium.org
Review URL: https://codereview.chromium.org/1650713002 .
Diffstat (limited to 'src')
-rw-r--r-- | src/processor/minidump_stackwalk.cc | 25 | ||||
-rw-r--r-- | src/processor/stackwalk_common.cc | 9 | ||||
-rw-r--r-- | src/processor/stackwalk_common.h | 1 |
3 files changed, 30 insertions, 5 deletions
diff --git a/src/processor/minidump_stackwalk.cc b/src/processor/minidump_stackwalk.cc index 8f83969f..05e3d3c0 100644 --- a/src/processor/minidump_stackwalk.cc +++ b/src/processor/minidump_stackwalk.cc @@ -71,7 +71,8 @@ using google_breakpad::scoped_ptr; bool PrintMinidumpProcess(const string &minidump_file, const std::vector<string> &symbol_paths, bool machine_readable, - bool output_stack_contents) { + bool output_stack_contents, + bool output_modules_only) { scoped_ptr<SimpleSymbolSupplier> symbol_supplier; if (!symbol_paths.empty()) { // TODO(mmentovai): check existence of symbol_path if specified? @@ -94,7 +95,9 @@ bool PrintMinidumpProcess(const string &minidump_file, return false; } - if (machine_readable) { + if (output_modules_only) { + PrintProcessModules(process_state); + } else if (machine_readable) { PrintProcessStateMachineReadable(process_state); } else { PrintProcessState(process_state, output_stack_contents, &resolver); @@ -104,9 +107,10 @@ bool PrintMinidumpProcess(const string &minidump_file, } void usage(const char *program_name) { - fprintf(stderr, "usage: %s [-m|-s] <minidump-file> [symbol-path ...]\n" + fprintf(stderr, "usage: %s [-m|-s|-b] <minidump-file> [symbol-path ...]\n" " -m : Output in machine-readable format\n" - " -s : Output stack contents\n", + " -s : Output stack contents\n" + " -b : Output contained full module paths\n", program_name); } @@ -123,6 +127,7 @@ int main(int argc, char **argv) { const char *minidump_file; bool machine_readable = false; bool output_stack_contents = false; + bool output_modules_only = false; int symbol_path_arg; if (strcmp(argv[1], "-m") == 0) { @@ -143,6 +148,15 @@ int main(int argc, char **argv) { output_stack_contents = true; minidump_file = argv[2]; symbol_path_arg = 3; + } else if (strcmp(argv[1], "-b") == 0) { + if (argc < 3) { + usage(argv[0]); + return 1; + } + + output_modules_only = true; + minidump_file = argv[2]; + symbol_path_arg = 3; } else { minidump_file = argv[1]; symbol_path_arg = 2; @@ -158,5 +172,6 @@ int main(int argc, char **argv) { return PrintMinidumpProcess(minidump_file, symbol_paths, machine_readable, - output_stack_contents) ? 0 : 1; + output_stack_contents, + output_modules_only) ? 0 : 1; } diff --git a/src/processor/stackwalk_common.cc b/src/processor/stackwalk_common.cc index dd529fdb..5cbcd27a 100644 --- a/src/processor/stackwalk_common.cc +++ b/src/processor/stackwalk_common.cc @@ -926,4 +926,13 @@ void PrintProcessStateMachineReadable(const ProcessState& process_state) { } } +void PrintProcessModules(const ProcessState& process_state) { + const CodeModules* modules = process_state.modules(); + const unsigned int module_count = modules->module_count(); + for (unsigned int i = 0; i < module_count; ++i) { + const CodeModule* module = modules->GetModuleAtSequence(i); + printf("%s\n", module->code_file().c_str()); + } +} + } // namespace google_breakpad diff --git a/src/processor/stackwalk_common.h b/src/processor/stackwalk_common.h index a74f7b6d..8b32e1f3 100644 --- a/src/processor/stackwalk_common.h +++ b/src/processor/stackwalk_common.h @@ -43,6 +43,7 @@ void PrintProcessStateMachineReadable(const ProcessState& process_state); void PrintProcessState(const ProcessState& process_state, bool output_stack_contents, SourceLineResolverInterface* resolver); +void PrintProcessModules(const ProcessState& process_state); } // namespace google_breakpad |