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 .
This commit is contained in:
Ted Mielczarek
2016-02-10 09:00:02 -05:00
parent afa2539de4
commit 4912669df1
4 changed files with 313 additions and 45 deletions

View File

@@ -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

View File

@@ -75,6 +75,12 @@ class minidump_size<MDCVInfoPDB70> {
static size_t size() { return MDCVInfoPDB70_minsize; }
};
template<>
class minidump_size<MDCVInfoELF> {
public:
static size_t size() { return MDCVInfoELF_minsize; }
};
template<>
class minidump_size<MDImageDebugMisc> {
public: