aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hamilton <benhamilton@google.com>2023-04-24 13:53:09 -0600
committerJoshua Peraza <jperaza@chromium.org>2023-04-24 19:59:30 +0000
commitbfde407de559c10d6cef861b3873ff287c24e761 (patch)
tree82f382400211f5dc3603143bc980bad83e9bcdf2
parentf548d75c9fa8bc062a580dbe5edb2fae2106d5c9 (diff)
downloadgoogle-breakpad-bfde407de559c10d6cef861b3873ff287c24e761.tar.gz
[dump_syms] Relax name matching for marking symbols as multiple
Previously, the logic to mark a symbol as "multiple" would always fire for C++ symbols for Apple `.dSYM`s built with `-gmlt`. This was because for a C++ symbol like `void foo::bar::Baz()`, the DWARF data would contain the truncated function name `Baz`, but the STABS would contain the fully-qualified name `void foo::bar::Baz()`. This CL relaxes the name matching to not mark as multiple: 1) Symbols which were missing names entirely in the DWARF (e.g, "<name omitted">)` 2) Symbols whose fully-qualified name includes the truncated name as a substring Bug: https://bugs.chromium.org/p/google-breakpad/issues/detail?id=883 Change-Id: I26ded7ca84d964aa4a73da19e4bdd7e686e2c998 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4470047 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
-rw-r--r--src/common/module.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/common/module.cc b/src/common/module.cc
index e61c3b7a..73c4a8b1 100644
--- a/src/common/module.cc
+++ b/src/common/module.cc
@@ -157,8 +157,22 @@ bool Module::AddFunction(Function* function) {
Extern* found_ext = it_ext->get();
bool name_mismatch = found_ext->name != function->name;
if (enable_multiple_field_) {
+ bool is_multiple_based_on_name;
+ // In the case of a .dSYM built with -gmlt, the external name will be the
+ // fully-qualified symbol name, but the function name will be the partial
+ // name (or omitted).
+ //
+ // Don't mark multiple in this case.
+ if (name_mismatch &&
+ (function->name == "<name omitted>" ||
+ found_ext->name.find(function->name.str()) != string::npos)) {
+ is_multiple_based_on_name = false;
+ } else {
+ is_multiple_based_on_name = name_mismatch;
+ }
// If the PUBLIC is for the same symbol as the FUNC, don't mark multiple.
- function->is_multiple |= name_mismatch || found_ext->is_multiple;
+ function->is_multiple |=
+ is_multiple_based_on_name || found_ext->is_multiple;
}
if (name_mismatch && prefer_extern_name_) {
function->name = AddStringToPool(it_ext->get()->name);