Always emit a 32-bit crash address for 32-bit architectures
Certain minidumps for 32-bit crashes have the upper 32-bit of the crash
address (which is a 64-bit value) set to non-zero values. This caused a
crash address with more than 32-bits to be printed out for minidumps of
32-bit architectures. This patch masks out those bits when reading the
raw minidump data to ensure this doesn't happen anymore.
Bug: google-breakpad:783
Change-Id: Ieef6dff759fd0ee2efc47c4c4a3cf863a48f0659
Reviewed-on: https://chromium-review.googlesource.com/c/1427819
Reviewed-by: Ted Mielczarek <ted.mielczarek@gmail.com>
diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc
index 2b40cf9..e3c3562 100644
--- a/src/processor/minidump_processor.cc
+++ b/src/processor/minidump_processor.cc
@@ -355,6 +355,26 @@
return minidump_system_info->system_info();
}
+static uint64_t GetAddressForArchitecture(const MDCPUArchitecture architecture,
+ size_t raw_address)
+{
+ switch (architecture) {
+ case MD_CPU_ARCHITECTURE_X86:
+ case MD_CPU_ARCHITECTURE_MIPS:
+ case MD_CPU_ARCHITECTURE_PPC:
+ case MD_CPU_ARCHITECTURE_SHX:
+ case MD_CPU_ARCHITECTURE_ARM:
+ case MD_CPU_ARCHITECTURE_X86_WIN64:
+ // 32-bit architectures, mask the upper bits.
+ return raw_address & 0xffffffffULL;
+
+ default:
+ // All other architectures either have 64-bit pointers or it's impossible
+ // to tell from the minidump (e.g. MSIL or SPARC) so use 64-bits anyway.
+ return raw_address;
+ }
+}
+
// Extract CPU info string from ARM-specific MDRawSystemInfo structure.
// raw_info: pointer to source MDRawSystemInfo.
// cpu_info: address of target string, cpu info text will be appended to it.
@@ -1637,6 +1657,12 @@
}
}
+ if (address) {
+ *address = GetAddressForArchitecture(
+ static_cast<MDCPUArchitecture>(raw_system_info->processor_architecture),
+ *address);
+ }
+
return reason;
}