aboutsummaryrefslogtreecommitdiff
path: root/src/google_breakpad/common
diff options
context:
space:
mode:
authorTed Mielczarek <ted@mielczarek.org>2016-02-10 09:00:02 -0500
committerTed Mielczarek <ted@mielczarek.org>2016-02-10 09:00:02 -0500
commit4912669df1fb34fb8549925a8f7e70e5ffc9e890 (patch)
treeb93d28b1f168c8d6de08739fd160c4bddd997ca4 /src/google_breakpad/common
parentFix usage of deprecated method sendSynchronousRequest:returningResponse:error:. (diff)
downloadbreakpad-4912669df1fb34fb8549925a8f7e70e5ffc9e890.tar.xz
Change MDCVInfoELF into something usable.
This patch changes MDCVInfoELF (which is currently unused, apparently a vestigal bit of code landed as part of Solaris support) into a supported CodeView format that simply contains a build id as raw bytes. Modern ELF toolchains support build ids nicely: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Developer_Guide/compiling-build-id.html It would be useful to have the original build ids of loaded modules in Linux minidumps, since tools like Fedora's darkserver allow querying by build id and the current Breakpad code truncates the build id to the size of a GUID, which loses information: https://darkserver.fedoraproject.org/ A follow-up patch will change the Linux minidump generation code to produce MDCVInfoELF in minidumps instead of MDCVInfoPDB70. This patch should be landed first to ensure that crash processors are able to handle this format before dumps are generated containing it. The full build id is exposed as the return value of Minidump::code_identifier(), which currently just returns "id" for modules in Linux dumps. For backwards-compatibility, Minidump::debug_identifier() continues to treat the build id as a GUID, so debug identifiers for existing modules will not change. BUG= R=mark@chromium.org Review URL: https://codereview.chromium.org/1675413002 .
Diffstat (limited to 'src/google_breakpad/common')
-rw-r--r--src/google_breakpad/common/minidump_format.h23
-rw-r--r--src/google_breakpad/common/minidump_size.h6
2 files changed, 23 insertions, 6 deletions
diff --git a/src/google_breakpad/common/minidump_format.h b/src/google_breakpad/common/minidump_format.h
index 18f8268b..da20f459 100644
--- a/src/google_breakpad/common/minidump_format.h
+++ b/src/google_breakpad/common/minidump_format.h
@@ -449,15 +449,26 @@ static const size_t MDCVInfoPDB70_minsize = offsetof(MDCVInfoPDB70,
#define MD_CVINFOPDB70_SIGNATURE 0x53445352 /* cvSignature = 'SDSR' */
+/*
+ * Modern ELF toolchains insert a "build id" into the ELF headers that
+ * usually contains a hash of some ELF headers + sections to uniquely
+ * identify a binary.
+ *
+ * https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Developer_Guide/compiling-build-id.html
+ * https://sourceware.org/binutils/docs-2.26/ld/Options.html#index-g_t_002d_002dbuild_002did-292
+ */
typedef struct {
- uint32_t data1[2];
- uint32_t data2;
- uint32_t data3;
- uint32_t data4;
- uint32_t data5[3];
- uint8_t extra[2];
+ uint32_t cv_signature;
+ uint8_t build_id[1]; /* Bytes of build id from GNU_BUILD_ID ELF note.
+ * This is variable-length, but usually 20 bytes
+ * as the binutils ld default is a SHA-1 hash. */
} MDCVInfoELF;
+static const size_t MDCVInfoELF_minsize = offsetof(MDCVInfoELF,
+ build_id[0]);
+
+#define MD_CVINFOELF_SIGNATURE 0x4270454c /* cvSignature = 'BpEL' */
+
/* In addition to the two CodeView record formats above, used for linking
* to external pdb files, it is possible for debugging data to be carried
* directly in the CodeView record itself. These signature values will
diff --git a/src/google_breakpad/common/minidump_size.h b/src/google_breakpad/common/minidump_size.h
index 918544b6..fae57923 100644
--- a/src/google_breakpad/common/minidump_size.h
+++ b/src/google_breakpad/common/minidump_size.h
@@ -76,6 +76,12 @@ class minidump_size<MDCVInfoPDB70> {
};
template<>
+class minidump_size<MDCVInfoELF> {
+ public:
+ static size_t size() { return MDCVInfoELF_minsize; }
+};
+
+template<>
class minidump_size<MDImageDebugMisc> {
public:
static size_t size() { return MDImageDebugMisc_minsize; }