 Chromium Code Reviews
 Chromium Code Reviews Issue 1651593002:
  Added a switch to dump minidump modules in minidump_stackwalk.  (Closed) 
  Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
    
  
    Issue 1651593002:
  Added a switch to dump minidump modules in minidump_stackwalk.  (Closed) 
  Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master| Index: src/processor/minidump_stackwalk.cc | 
| diff --git a/src/processor/minidump_stackwalk.cc b/src/processor/minidump_stackwalk.cc | 
| index 8f83969fef1be48e0cdcf44273515694712fe95c..b01d92f488faecefa7d1679f0996b16f77ee4002 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,10 @@ bool PrintMinidumpProcess(const string &minidump_file, | 
| return false; | 
| } | 
| - if (machine_readable) { | 
| + if (output_modules_only) { | 
| + PrintProcessModules(process_state); | 
| + } | 
| + else if (machine_readable) { | 
| 
Lei Zhang
2016/01/29 20:27:37
nit: merge with prev line
 
David Yen
2016/01/29 20:36:26
Done.
 | 
| PrintProcessStateMachineReadable(process_state); | 
| } else { | 
| PrintProcessState(process_state, output_stack_contents, &resolver); | 
| @@ -106,7 +110,8 @@ bool PrintMinidumpProcess(const string &minidump_file, | 
| void usage(const char *program_name) { | 
| fprintf(stderr, "usage: %s [-m|-s] <minidump-file> [symbol-path ...]\n" | 
| 
Lei Zhang
2016/01/29 20:27:37
Update this to mention -b
 
David Yen
2016/01/29 20:36:26
Done.
 | 
| " -m : Output in machine-readable format\n" | 
| - " -s : Output stack contents\n", | 
| + " -s : Output stack contents\n" | 
| + " -b : Output contained binary modules\n", | 
| program_name); | 
| } | 
| @@ -123,6 +128,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,7 +149,16 @@ 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) { | 
| 
Lei Zhang
2016/01/29 20:27:37
else if?
 
David Yen
2016/01/29 20:36:26
Done. I think this is what was breaking the other
 | 
| + 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 +173,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; | 
| } |