mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-24 06:35:46 +01:00
Add option to dump crash thread only
Add minidump_stackwalk option to dump the crash thread only Bug: 1129202 Change-Id: I1370b4dc972f76ba1d57fca083da7d486774e65a Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2762072 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
parent
dff7d5afd5
commit
3bea2815bf
@ -110,7 +110,10 @@ int PrintMicrodumpProcess(const Options& options) {
|
||||
if (options.machine_readable) {
|
||||
PrintProcessStateMachineReadable(process_state);
|
||||
} else {
|
||||
PrintProcessState(process_state, options.output_stack_contents, &resolver);
|
||||
// Microdump has only one thread, |output_requesting_thread_only|'s value
|
||||
// has no effect.
|
||||
PrintProcessState(process_state, options.output_stack_contents,
|
||||
/*output_requesting_thread_only=*/false, &resolver);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ namespace {
|
||||
struct Options {
|
||||
bool machine_readable;
|
||||
bool output_stack_contents;
|
||||
bool output_requesting_thread_only;
|
||||
|
||||
string minidump_file;
|
||||
std::vector<string> symbol_paths;
|
||||
@ -111,7 +112,8 @@ bool PrintMinidumpProcess(const Options& options) {
|
||||
if (options.machine_readable) {
|
||||
PrintProcessStateMachineReadable(process_state);
|
||||
} else {
|
||||
PrintProcessState(process_state, options.output_stack_contents, &resolver);
|
||||
PrintProcessState(process_state, options.output_stack_contents,
|
||||
options.output_requesting_thread_only, &resolver);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -128,7 +130,8 @@ static void Usage(int argc, const char *argv[], bool error) {
|
||||
"Options:\n"
|
||||
"\n"
|
||||
" -m Output in machine-readable format\n"
|
||||
" -s Output stack contents\n",
|
||||
" -s Output stack contents\n"
|
||||
" -c Output thread that causes crash or dump only\n",
|
||||
google_breakpad::BaseName(argv[0]).c_str());
|
||||
}
|
||||
|
||||
@ -137,14 +140,18 @@ static void SetupOptions(int argc, const char *argv[], Options* options) {
|
||||
|
||||
options->machine_readable = false;
|
||||
options->output_stack_contents = false;
|
||||
options->output_requesting_thread_only = false;
|
||||
|
||||
while ((ch = getopt(argc, (char * const*)argv, "hms")) != -1) {
|
||||
while ((ch = getopt(argc, (char * const*)argv, "chms")) != -1) {
|
||||
switch (ch) {
|
||||
case 'h':
|
||||
Usage(argc, argv, false);
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
options->output_requesting_thread_only = true;
|
||||
break;
|
||||
case 'm':
|
||||
options->machine_readable = true;
|
||||
break;
|
||||
|
@ -786,6 +786,7 @@ static void PrintModulesMachineReadable(const CodeModules* modules) {
|
||||
|
||||
void PrintProcessState(const ProcessState& process_state,
|
||||
bool output_stack_contents,
|
||||
bool output_requesting_thread_only,
|
||||
SourceLineResolverInterface* resolver) {
|
||||
// Print OS and CPU information.
|
||||
string cpu = process_state.system_info()->cpu;
|
||||
@ -856,17 +857,19 @@ void PrintProcessState(const ProcessState& process_state,
|
||||
process_state.modules(), resolver);
|
||||
}
|
||||
|
||||
// Print all of the threads in the dump.
|
||||
int thread_count = process_state.threads()->size();
|
||||
for (int thread_index = 0; thread_index < thread_count; ++thread_index) {
|
||||
if (thread_index != requesting_thread) {
|
||||
// Don't print the crash thread again, it was already printed.
|
||||
printf("\n");
|
||||
printf("Thread %d\n", thread_index);
|
||||
PrintStack(process_state.threads()->at(thread_index), cpu,
|
||||
output_stack_contents,
|
||||
process_state.thread_memory_regions()->at(thread_index),
|
||||
process_state.modules(), resolver);
|
||||
if (!output_requesting_thread_only) {
|
||||
// Print all of the threads in the dump.
|
||||
int thread_count = process_state.threads()->size();
|
||||
for (int thread_index = 0; thread_index < thread_count; ++thread_index) {
|
||||
if (thread_index != requesting_thread) {
|
||||
// Don't print the crash thread again, it was already printed.
|
||||
printf("\n");
|
||||
printf("Thread %d\n", thread_index);
|
||||
PrintStack(process_state.threads()->at(thread_index), cpu,
|
||||
output_stack_contents,
|
||||
process_state.thread_memory_regions()->at(thread_index),
|
||||
process_state.modules(), resolver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ class SourceLineResolverInterface;
|
||||
void PrintProcessStateMachineReadable(const ProcessState& process_state);
|
||||
void PrintProcessState(const ProcessState& process_state,
|
||||
bool output_stack_contents,
|
||||
bool output_requesting_thread_only,
|
||||
SourceLineResolverInterface* resolver);
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
Loading…
Reference in New Issue
Block a user