diff options
author | Joshua Peraza <jperaza@chromium.org> | 2019-10-24 11:41:44 -0700 |
---|---|---|
committer | Joshua Peraza <jperaza@chromium.org> | 2019-10-24 18:59:59 +0000 |
commit | 3e56ef9d4e328142c07605a0bde1dfd2ed122611 (patch) | |
tree | 8f822543c79d3f6947f72e5b8b5d52f40a320e05 /src/client/linux | |
parent | convert_UTF: rewrite in C++ (diff) | |
download | breakpad-3e56ef9d4e328142c07605a0bde1dfd2ed122611.tar.xz |
linux, dump_syms: set module name from DT_SONAME
The Breakpad and Crashpad clients will use an object's DT_SONAME as
the name for a module if it exists. Previously, linux dump_syms would
assume the basename of an input elf file matches that value, causing
symbol lookups to fail if they were mismatched. This patch updates
dump_syms to use DT_SONAME as the module name, if present.
Bug: 1016924
Change-Id: I5eff0cf06c703841df3fb552cb5a8e1e50a20c64
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1876763
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'src/client/linux')
-rw-r--r-- | src/client/linux/minidump_writer/linux_dumper.cc | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/client/linux/minidump_writer/linux_dumper.cc b/src/client/linux/minidump_writer/linux_dumper.cc index dbedecd5..5653133e 100644 --- a/src/client/linux/minidump_writer/linux_dumper.cc +++ b/src/client/linux/minidump_writer/linux_dumper.cc @@ -439,49 +439,6 @@ bool LinuxDumper::GetMappingAbsolutePath(const MappingInfo& mapping, } namespace { -bool ElfFileSoNameFromMappedFile( - const void* elf_base, char* soname, size_t soname_size) { - if (!IsValidElf(elf_base)) { - // Not ELF - return false; - } - - const void* segment_start; - size_t segment_size; - if (!FindElfSection(elf_base, ".dynamic", SHT_DYNAMIC, &segment_start, - &segment_size)) { - // No dynamic section - return false; - } - - const void* dynstr_start; - size_t dynstr_size; - if (!FindElfSection(elf_base, ".dynstr", SHT_STRTAB, &dynstr_start, - &dynstr_size)) { - // No dynstr section - return false; - } - - const ElfW(Dyn)* dynamic = static_cast<const ElfW(Dyn)*>(segment_start); - size_t dcount = segment_size / sizeof(ElfW(Dyn)); - for (const ElfW(Dyn)* dyn = dynamic; dyn < dynamic + dcount; ++dyn) { - if (dyn->d_tag == DT_SONAME) { - const char* dynstr = static_cast<const char*>(dynstr_start); - if (dyn->d_un.d_val >= dynstr_size) { - // Beyond the end of the dynstr section - return false; - } - const char* str = dynstr + dyn->d_un.d_val; - const size_t maxsize = dynstr_size - dyn->d_un.d_val; - my_strlcpy(soname, str, maxsize < soname_size ? maxsize : soname_size); - return true; - } - } - - // Did not find SONAME - return false; -} - // Find the shared object name (SONAME) by examining the ELF information // for |mapping|. If the SONAME is found copy it into the passed buffer // |soname| and return true. The size of the buffer is |soname_size|. |