mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-27 23:24:26 +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) {
|
if (options.machine_readable) {
|
||||||
PrintProcessStateMachineReadable(process_state);
|
PrintProcessStateMachineReadable(process_state);
|
||||||
} else {
|
} 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ namespace {
|
|||||||
struct Options {
|
struct Options {
|
||||||
bool machine_readable;
|
bool machine_readable;
|
||||||
bool output_stack_contents;
|
bool output_stack_contents;
|
||||||
|
bool output_requesting_thread_only;
|
||||||
|
|
||||||
string minidump_file;
|
string minidump_file;
|
||||||
std::vector<string> symbol_paths;
|
std::vector<string> symbol_paths;
|
||||||
@ -111,7 +112,8 @@ bool PrintMinidumpProcess(const Options& options) {
|
|||||||
if (options.machine_readable) {
|
if (options.machine_readable) {
|
||||||
PrintProcessStateMachineReadable(process_state);
|
PrintProcessStateMachineReadable(process_state);
|
||||||
} else {
|
} else {
|
||||||
PrintProcessState(process_state, options.output_stack_contents, &resolver);
|
PrintProcessState(process_state, options.output_stack_contents,
|
||||||
|
options.output_requesting_thread_only, &resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -128,7 +130,8 @@ static void Usage(int argc, const char *argv[], bool error) {
|
|||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\n"
|
"\n"
|
||||||
" -m Output in machine-readable format\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());
|
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->machine_readable = false;
|
||||||
options->output_stack_contents = 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) {
|
switch (ch) {
|
||||||
case 'h':
|
case 'h':
|
||||||
Usage(argc, argv, false);
|
Usage(argc, argv, false);
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'c':
|
||||||
|
options->output_requesting_thread_only = true;
|
||||||
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
options->machine_readable = true;
|
options->machine_readable = true;
|
||||||
break;
|
break;
|
||||||
|
@ -786,6 +786,7 @@ static void PrintModulesMachineReadable(const CodeModules* modules) {
|
|||||||
|
|
||||||
void PrintProcessState(const ProcessState& process_state,
|
void PrintProcessState(const ProcessState& process_state,
|
||||||
bool output_stack_contents,
|
bool output_stack_contents,
|
||||||
|
bool output_requesting_thread_only,
|
||||||
SourceLineResolverInterface* resolver) {
|
SourceLineResolverInterface* resolver) {
|
||||||
// Print OS and CPU information.
|
// Print OS and CPU information.
|
||||||
string cpu = process_state.system_info()->cpu;
|
string cpu = process_state.system_info()->cpu;
|
||||||
@ -856,17 +857,19 @@ void PrintProcessState(const ProcessState& process_state,
|
|||||||
process_state.modules(), resolver);
|
process_state.modules(), resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print all of the threads in the dump.
|
if (!output_requesting_thread_only) {
|
||||||
int thread_count = process_state.threads()->size();
|
// Print all of the threads in the dump.
|
||||||
for (int thread_index = 0; thread_index < thread_count; ++thread_index) {
|
int thread_count = process_state.threads()->size();
|
||||||
if (thread_index != requesting_thread) {
|
for (int thread_index = 0; thread_index < thread_count; ++thread_index) {
|
||||||
// Don't print the crash thread again, it was already printed.
|
if (thread_index != requesting_thread) {
|
||||||
printf("\n");
|
// Don't print the crash thread again, it was already printed.
|
||||||
printf("Thread %d\n", thread_index);
|
printf("\n");
|
||||||
PrintStack(process_state.threads()->at(thread_index), cpu,
|
printf("Thread %d\n", thread_index);
|
||||||
output_stack_contents,
|
PrintStack(process_state.threads()->at(thread_index), cpu,
|
||||||
process_state.thread_memory_regions()->at(thread_index),
|
output_stack_contents,
|
||||||
process_state.modules(), resolver);
|
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 PrintProcessStateMachineReadable(const ProcessState& process_state);
|
||||||
void PrintProcessState(const ProcessState& process_state,
|
void PrintProcessState(const ProcessState& process_state,
|
||||||
bool output_stack_contents,
|
bool output_stack_contents,
|
||||||
|
bool output_requesting_thread_only,
|
||||||
SourceLineResolverInterface* resolver);
|
SourceLineResolverInterface* resolver);
|
||||||
|
|
||||||
} // namespace google_breakpad
|
} // namespace google_breakpad
|
||||||
|
Loading…
Reference in New Issue
Block a user