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/common/linux/dump_symbols.cc | |
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/common/linux/dump_symbols.cc')
-rw-r--r-- | src/common/linux/dump_symbols.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc index 1110cb9d..40bb3ff2 100644 --- a/src/common/linux/dump_symbols.cc +++ b/src/common/linux/dump_symbols.cc @@ -38,6 +38,7 @@ #include <elf.h> #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <link.h> #include <stdint.h> #include <stdio.h> @@ -936,7 +937,14 @@ bool InitModuleForElfClass(const typename ElfClass::Ehdr* elf_header, return false; } - string name = google_breakpad::BaseName(obj_filename); + string name; + char name_buf[NAME_MAX]; + memset(name_buf, 0, sizeof(name_buf)); + name = google_breakpad::ElfFileSoNameFromMappedFile(elf_header, name_buf, + sizeof(name_buf)) + ? name_buf + : google_breakpad::BaseName(obj_filename); + string os = "Linux"; // Add an extra "0" at the end. PDB files on Windows have an 'age' // number appended to the end of the file identifier; this isn't |