Am 03.02.2014 13:02, schrieb Andreas Schwab:
Wolfgang Rosenauer
writes: So the following question: - what does find-debuginfo.sh do which changes the breakpad ID
How is the breakpad ID computed?
hmm, for details I would need to point you to the google-breakpad
project and source code but a quick and overall explanation I got is:
"the debug id is either the build ID from the ELF headers, or a hash of
the first page of .text"
Just found the relevant code:
// Attempt to locate a .note.gnu.build-id section in an ELF binary
// and copy as many bytes of it as will fit into |identifier|.
static bool FindElfBuildIDNote(const void *elf_mapped_base,
uint8_t identifier[kMDGUIDSize]) {
void* note_section;
int note_size, elfclass;
if ((!FindElfSegment(elf_mapped_base, PT_NOTE,
(const void**)¬e_section, ¬e_size,
&elfclass) ||
note_size == 0) &&
(!FindElfSection(elf_mapped_base, ".note.gnu.build-id", SHT_NOTE,
(const void**)¬e_section, ¬e_size,
&elfclass) ||
note_size == 0)) {
return false;
}
if (elfclass == ELFCLASS32) {
return ElfClassBuildIDNoteIdentifier<ElfClass32>(note_section,
note_size,
identifier);
} else if (elfclass == ELFCLASS64) {
return ElfClassBuildIDNoteIdentifier<ElfClass64>(note_section,
note_size,
identifier);
}
return false;
}
// Attempt to locate the .text section of an ELF binary and generate
// a simple hash by XORing the first page worth of bytes into |identifier|.
static bool HashElfTextSection(const void *elf_mapped_base,
uint8_t identifier[kMDGUIDSize]) {
void* text_section;
int text_size;
if (!FindElfSection(elf_mapped_base, ".text", SHT_PROGBITS,
(const void**)&text_section, &text_size, NULL) ||
text_size == 0) {
return false;
}
my_memset(identifier, 0, kMDGUIDSize);
const uint8_t* ptr = reinterpret_cast