Make EXC_BAD_ACCESS / EXC_I386_GPFLT print nicely in the processor

Currently EXC_BAD_ACCESS doesn't support EXC_I386_GPFLT as
exception_flags for pretty-printing in the processor, but this happens
for a lot of things:
http://opensource.apple.com/source/xnu/xnu-2050.24.15/osfmk/i386/trap.c
(search for EXC_I386_GPFLT).

And we get a lot of these in the wild:
https://crash-stats.mozilla.com/search/?reason=%3DEXC_BAD_ACCESS+%2F+0x0000000d&cpu_name=amd64&_facets=signature&_facets=address&_columns=date&_columns=signature&_columns=product&_columns=version&_columns=build_id&_columns=platform&_columns=address#crash-reports

This patch makes them show up with a nice name instead of the current
"EXC_BAD_ACCESS / 0x0000000d".

Additionally, this patch fixes some other cases where x86-64 wasn't being handled in the same way as x86, and fixes some x86-specific exception flags to be stringified with I386 in the output.

R=mark@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1833123002 .
This commit is contained in:
Ted Mielczarek 2016-03-29 15:32:47 -04:00
parent 512cac3a1b
commit d091e5103f

View file

@ -745,6 +745,19 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) {
BPLOG(INFO) << "Unknown exception reason " << reason; BPLOG(INFO) << "Unknown exception reason " << reason;
break; break;
} }
} else if (raw_system_info->processor_architecture ==
MD_CPU_ARCHITECTURE_X86 ||
raw_system_info->processor_architecture ==
MD_CPU_ARCHITECTURE_AMD64) {
switch (exception_flags) {
case MD_EXCEPTION_CODE_MAC_X86_GENERAL_PROTECTION_FAULT:
reason.append("EXC_I386_GPFLT");
break;
default:
reason.append(flags_string);
BPLOG(INFO) << "Unknown exception reason " << reason;
break;
}
} else { } else {
reason.append(flags_string); reason.append(flags_string);
BPLOG(INFO) << "Unknown exception reason " << reason; BPLOG(INFO) << "Unknown exception reason " << reason;
@ -795,25 +808,26 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) {
} }
break; break;
} }
case MD_CPU_ARCHITECTURE_AMD64:
case MD_CPU_ARCHITECTURE_X86: { case MD_CPU_ARCHITECTURE_X86: {
switch (exception_flags) { switch (exception_flags) {
case MD_EXCEPTION_CODE_MAC_X86_INVALID_OPERATION: case MD_EXCEPTION_CODE_MAC_X86_INVALID_OPERATION:
reason.append("EXC_I386_INVOP"); reason.append("EXC_I386_INVOP");
break; break;
case MD_EXCEPTION_CODE_MAC_X86_INVALID_TASK_STATE_SEGMENT: case MD_EXCEPTION_CODE_MAC_X86_INVALID_TASK_STATE_SEGMENT:
reason.append("EXC_INVTSSFLT"); reason.append("EXC_I386_INVTSSFLT");
break; break;
case MD_EXCEPTION_CODE_MAC_X86_SEGMENT_NOT_PRESENT: case MD_EXCEPTION_CODE_MAC_X86_SEGMENT_NOT_PRESENT:
reason.append("EXC_SEGNPFLT"); reason.append("EXC_I386_SEGNPFLT");
break; break;
case MD_EXCEPTION_CODE_MAC_X86_STACK_FAULT: case MD_EXCEPTION_CODE_MAC_X86_STACK_FAULT:
reason.append("EXC_STKFLT"); reason.append("EXC_I386_STKFLT");
break; break;
case MD_EXCEPTION_CODE_MAC_X86_GENERAL_PROTECTION_FAULT: case MD_EXCEPTION_CODE_MAC_X86_GENERAL_PROTECTION_FAULT:
reason.append("EXC_GPFLT"); reason.append("EXC_I386_GPFLT");
break; break;
case MD_EXCEPTION_CODE_MAC_X86_ALIGNMENT_FAULT: case MD_EXCEPTION_CODE_MAC_X86_ALIGNMENT_FAULT:
reason.append("EXC_ALIGNFLT"); reason.append("EXC_I386_ALIGNFLT");
break; break;
default: default:
reason.append(flags_string); reason.append(flags_string);
@ -866,6 +880,7 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) {
} }
break; break;
} }
case MD_CPU_ARCHITECTURE_AMD64:
case MD_CPU_ARCHITECTURE_X86: { case MD_CPU_ARCHITECTURE_X86: {
switch (exception_flags) { switch (exception_flags) {
case MD_EXCEPTION_CODE_MAC_X86_DIV: case MD_EXCEPTION_CODE_MAC_X86_DIV:
@ -966,6 +981,7 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) {
} }
break; break;
} }
case MD_CPU_ARCHITECTURE_AMD64:
case MD_CPU_ARCHITECTURE_X86: { case MD_CPU_ARCHITECTURE_X86: {
switch (exception_flags) { switch (exception_flags) {
case MD_EXCEPTION_CODE_MAC_X86_SGL: case MD_EXCEPTION_CODE_MAC_X86_SGL: