зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1059942 - Make dump_syms to parse public symbols. r=ted
Currently, dump_syms does not look at public symbols if the object file has debug info. This may cause it to skip some symbols that do not have .debug_info section. Notably we see this at bionic routines implemented in assembly. Details can be found at [1]. Apply patch [2] to enable dump_syms read public symbols even when DWARF debug info is found. [1] http://tinyurl.com/k3pxw5l [2] https://breakpad.appspot.com/9684002/
This commit is contained in:
Родитель
b67b853197
Коммит
ef75b07c68
|
@ -724,6 +724,8 @@ bool LoadSymbols(const string& obj_file,
|
|||
names_end, elf_header->e_shnum);
|
||||
if (gnu_debuglink_section) {
|
||||
if (!info->debug_dirs().empty()) {
|
||||
found_debug_info_section = true;
|
||||
|
||||
const char* debuglink_contents =
|
||||
GetOffset<ElfClass, char>(elf_header,
|
||||
gnu_debuglink_section->sh_offset);
|
||||
|
@ -740,55 +742,48 @@ bool LoadSymbols(const string& obj_file,
|
|||
fprintf(stderr, "%s does not contain a .gnu_debuglink section.\n",
|
||||
obj_file.c_str());
|
||||
}
|
||||
} else {
|
||||
if (symbol_data != ONLY_CFI) {
|
||||
// The caller doesn't want to consult .gnu_debuglink.
|
||||
// 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 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;
|
||||
}
|
||||
}
|
||||
|
||||
// Return true if some usable information was found, since
|
||||
// the caller doesn't want to use .gnu_debuglink.
|
||||
BPLOG(INFO) << "LoadSymbols: "
|
||||
<< (found_usable_info ? "SUCCESS " : "FAILURE ")
|
||||
<< obj_file;
|
||||
return found_usable_info;
|
||||
}
|
||||
|
||||
// No debug info was found, let the user try again with .gnu_debuglink
|
||||
// if present.
|
||||
BPLOG(INFO) << "LoadSymbols: FAILURE " << obj_file;
|
||||
return false;
|
||||
}
|
||||
|
||||
BPLOG(INFO) << "LoadSymbols: SUCCESS " << obj_file;
|
||||
return true;
|
||||
if (symbol_data != ONLY_CFI) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (read_gnu_debug_link) {
|
||||
return found_debug_info_section;
|
||||
}
|
||||
|
||||
// Return true if some usable information was found
|
||||
BPLOG(INFO) << "LoadSymbols: "
|
||||
<< (found_usable_info ? "SUCCESS " : "FAILURE ")
|
||||
<< obj_file;
|
||||
return found_usable_info;
|
||||
}
|
||||
|
||||
// Return the breakpad symbol file identifier for the architecture of
|
||||
|
|
|
@ -105,10 +105,21 @@ void Module::AddStackFrameEntry(StackFrameEntry* stack_frame_entry) {
|
|||
}
|
||||
|
||||
void Module::AddExtern(Extern *ext) {
|
||||
std::pair<ExternSet::iterator,bool> ret = externs_.insert(ext);
|
||||
if (!ret.second) {
|
||||
// Free the duplicate that was not inserted because this Module
|
||||
// now owns it.
|
||||
Function func;
|
||||
func.name = ext->name;
|
||||
func.address = ext->address;
|
||||
|
||||
// Since parsing debug section and public info are not necessarily
|
||||
// mutually exclusive, check if the symbol has already been read
|
||||
// as a function to avoid duplicates.
|
||||
if (functions_.find(&func) == functions_.end()) {
|
||||
std::pair<ExternSet::iterator,bool> ret = externs_.insert(ext);
|
||||
if (!ret.second) {
|
||||
// Free the duplicate that was not inserted because this Module
|
||||
// now owns it.
|
||||
delete ext;
|
||||
}
|
||||
} else {
|
||||
delete ext;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче