From 3e56ef9d4e328142c07605a0bde1dfd2ed122611 Mon Sep 17 00:00:00 2001 From: Joshua Peraza Date: Thu, 24 Oct 2019 11:41:44 -0700 Subject: 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 --- src/common/linux/dump_symbols.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/common/linux/dump_symbols.cc') 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 #include #include +#include #include #include #include @@ -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 -- cgit v1.2.1