aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/dump_symbols.cc
diff options
context:
space:
mode:
authorDragan Mladjenovic <Dragan.Mladjenovic@imgtec.com>2017-02-28 14:37:57 +0100
committerJoshua Peraza <jperaza@chromium.org>2017-03-07 16:09:40 +0000
commit32a9e03835369b40c4341d7ead5842ffaab563fe (patch)
tree1e5833dda38b5fdb9970b2ea0d1b876751c50690 /src/common/linux/dump_symbols.cc
parentFix dump_syms clang compilation on Windows (diff)
downloadbreakpad-32a9e03835369b40c4341d7ead5842ffaab563fe.tar.xz
[MIPS]: Relax dwarf section loading to accept both PROGBITS and MIPS_DWARF section types
Change-Id: I0862d930d92687dee47daa8d4dc3a21524c1c893 Reviewed-on: https://chromium-review.googlesource.com/447697 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Diffstat (limited to 'src/common/linux/dump_symbols.cc')
-rw-r--r--src/common/linux/dump_symbols.cc26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
index 40b9e478..5ef766fa 100644
--- a/src/common/linux/dump_symbols.cc
+++ b/src/common/linux/dump_symbols.cc
@@ -618,8 +618,6 @@ bool LoadSymbols(const string& obj_file,
module->SetLoadAddress(loading_addr);
info->set_loading_addr(loading_addr, obj_file);
- Word debug_section_type =
- elf_header->e_machine == EM_MIPS ? SHT_MIPS_DWARF : SHT_PROGBITS;
const Shdr* sections =
GetOffset<ElfClass, Shdr>(elf_header, elf_header->e_shoff);
const Shdr* section_names = sections + elf_header->e_shstrndx;
@@ -675,9 +673,19 @@ bool LoadSymbols(const string& obj_file,
// Look for DWARF debugging information, and load it if present.
const Shdr* dwarf_section =
- FindElfSectionByName<ElfClass>(".debug_info", debug_section_type,
+ FindElfSectionByName<ElfClass>(".debug_info", SHT_PROGBITS,
sections, names, names_end,
elf_header->e_shnum);
+
+ // .debug_info section type is SHT_PROGBITS for mips on pnacl toolchains,
+ // but MIPS_DWARF for regular gnu toolchains, so both need to be checked
+ if (elf_header->e_machine == EM_MIPS && !dwarf_section) {
+ dwarf_section =
+ FindElfSectionByName<ElfClass>(".debug_info", SHT_MIPS_DWARF,
+ sections, names, names_end,
+ elf_header->e_shnum);
+ }
+
if (dwarf_section) {
found_debug_info_section = true;
found_usable_info = true;
@@ -752,9 +760,19 @@ bool LoadSymbols(const string& obj_file,
// Dwarf Call Frame Information (CFI) is actually independent from
// the other DWARF debugging information, and can be used alone.
const Shdr* dwarf_cfi_section =
- FindElfSectionByName<ElfClass>(".debug_frame", debug_section_type,
+ FindElfSectionByName<ElfClass>(".debug_frame", SHT_PROGBITS,
sections, names, names_end,
elf_header->e_shnum);
+
+ // .debug_frame section type is SHT_PROGBITS for mips on pnacl toolchains,
+ // but MIPS_DWARF for regular gnu toolchains, so both need to be checked
+ if (elf_header->e_machine == EM_MIPS && !dwarf_cfi_section) {
+ dwarf_cfi_section =
+ FindElfSectionByName<ElfClass>(".debug_frame", SHT_MIPS_DWARF,
+ sections, names, names_end,
+ elf_header->e_shnum);
+ }
+
if (dwarf_cfi_section) {
// Ignore the return value of this function; even without call frame
// information, the other debugging information could be perfectly