aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Yen <dyen@chromium.org>2016-03-23 13:17:41 -0400
committerMark Mentovai <mark@chromium.org>2016-03-23 13:17:41 -0400
commit512cac3a1b69721ab727f3079f4d29e4580467b1 (patch)
tree3f484b166ed312b4c6455c9f1520c6542b3b3ae1 /src
parentFix the Linux Starter Guide docs (diff)
downloadbreakpad-512cac3a1b69721ab727f3079f4d29e4580467b1.tar.xz
Have dump_syms output the full symbol table.
Some of the symbols in the stack trace are not found in the .dynsym section but were located in the full symbol table .symtab section instead. This was causing some of our stack traces to be incomplete or point to incorrect function names. Since we only output function names, there are actually not that many more symbols located in .symtab that aren't in .dynsym. It is better to simply output all symbols found so our stack traces are complete. R=mark@chromium.org, thestig@chromium.org BUG=561447 Review URL: https://codereview.chromium.org/1824063002 . Patch from David Yen <dyen@chromium.org>.
Diffstat (limited to 'src')
-rw-r--r--src/common/linux/dump_symbols.cc65
1 files changed, 47 insertions, 18 deletions
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
index d6c593fa..5d2aac7e 100644
--- a/src/common/linux/dump_symbols.cc
+++ b/src/common/linux/dump_symbols.cc
@@ -684,32 +684,61 @@ bool LoadSymbols(const string& obj_file,
}
// See if there are export symbols available.
- const Shdr* dynsym_section =
- FindElfSectionByName<ElfClass>(".dynsym", SHT_DYNSYM,
- sections, names, names_end,
- elf_header->e_shnum);
- const Shdr* dynstr_section =
- FindElfSectionByName<ElfClass>(".dynstr", SHT_STRTAB,
- sections, names, names_end,
- elf_header->e_shnum);
- if (dynsym_section && dynstr_section) {
- info->LoadedSection(".dynsym");
+ const Shdr* symtab_section =
+ FindElfSectionByName<ElfClass>(".symtab", SHT_SYMTAB,
+ sections, names, names_end,
+ elf_header->e_shnum);
+ const Shdr* strtab_section =
+ FindElfSectionByName<ElfClass>(".strtab", SHT_STRTAB,
+ sections, names, names_end,
+ elf_header->e_shnum);
+ if (symtab_section && strtab_section) {
+ info->LoadedSection(".symtab");
- const uint8_t* dynsyms =
+ const uint8_t* symtab =
GetOffset<ElfClass, uint8_t>(elf_header,
- dynsym_section->sh_offset);
- const uint8_t* dynstrs =
+ symtab_section->sh_offset);
+ const uint8_t* strtab =
GetOffset<ElfClass, uint8_t>(elf_header,
- dynstr_section->sh_offset);
+ strtab_section->sh_offset);
bool result =
- ELFSymbolsToModule(dynsyms,
- dynsym_section->sh_size,
- dynstrs,
- dynstr_section->sh_size,
+ ELFSymbolsToModule(symtab,
+ symtab_section->sh_size,
+ strtab,
+ strtab_section->sh_size,
big_endian,
ElfClass::kAddrSize,
module);
found_usable_info = found_usable_info || result;
+ } else {
+ // Look in dynsym only if full symbol table was not available.
+ const Shdr* dynsym_section =
+ FindElfSectionByName<ElfClass>(".dynsym", SHT_DYNSYM,
+ sections, names, names_end,
+ elf_header->e_shnum);
+ const Shdr* dynstr_section =
+ FindElfSectionByName<ElfClass>(".dynstr", SHT_STRTAB,
+ sections, names, names_end,
+ elf_header->e_shnum);
+ if (dynsym_section && dynstr_section) {
+ info->LoadedSection(".dynsym");
+
+ const uint8_t* dynsyms =
+ GetOffset<ElfClass, uint8_t>(elf_header,
+ dynsym_section->sh_offset);
+ const uint8_t* dynstrs =
+ GetOffset<ElfClass, uint8_t>(elf_header,
+ dynstr_section->sh_offset);
+ bool result =
+ ELFSymbolsToModule(dynsyms,
+ dynsym_section->sh_size,
+ dynstrs,
+ dynstr_section->sh_size,
+ big_endian,
+ ElfClass::kAddrSize,
+ module);
+ found_usable_info = found_usable_info || result;
+ }
}
}