mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-01-07 23:18:14 +01:00
[dump_syms/Mac] New -x option to prefer extern names when there's a mismatch
When built with -gmlt, .dSYMs are (by design) missing the `DW_AT_linkage_name` which Breakpad uses to fill out the (name-mangled) function names. Thankfully, the .dSYM contains both the old-school LC_SYMTAB command containing the STABS-format symbols (which include the fully-qualified C++ symbol names we want, but no actual compilation unit data), as well as the LC_SEGMENT_64 containing the __DWARF segment with the minimal -gmlt debug information (which excludes the name-mangled C++ symbols). Unfortunately, since the .dSYM's STABS does not define compilation units, the usual path in `StabsReader` ignores all the fully-qualified C++ symbol names for the functions: https://chromium.googlesource.com/breakpad/breakpad/+/bd9d94c70843620adeebcd73c243001237c6d426/src/common/stabs_reader.cc#100 Fortunately, when built for macOS platforms (`HAVE_MACH_O_NLIST_H`), `StabsReader` supports storing all the STABS-format symbols as `Extern`s, regardless of whether or not they're in a compilation unit: https://chromium.googlesource.com/breakpad/breakpad/+/bd9d94c70843620adeebcd73c243001237c6d426/src/common/stabs_reader.cc#119 Currently, when there's both a `Function` and an `Extern` with the same address, `Module` discards the `Extern`: https://chromium.googlesource.com/breakpad/breakpad/+/bd9d94c70843620adeebcd73c243001237c6d426/src/common/module.cc#161 This CL adds a new `-x` option to the Mac `dump_syms` which prefers the Extern function name if there's a mismatch. Bug: https://bugs.chromium.org/p/google-breakpad/issues/detail?id=883 Change-Id: I0d32adc64fbf567600b0a5ca63c71c422b7f0f8c Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4453650 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
parent
16cee17997
commit
f548d75c9f
8 changed files with 123 additions and 18 deletions
|
|
@ -267,6 +267,10 @@ class CUFixtureBase {
|
|||
void TestFunction(int i, const string& name,
|
||||
Module::Address address, Module::Address size);
|
||||
|
||||
// Test that the I'th function (ordered by address) in the module
|
||||
// this.module_ has the given prefer_extern_name.
|
||||
void TestFunctionPreferExternName(int i, bool prefer_extern_name);
|
||||
|
||||
// Test that the number of source lines owned by the I'th function
|
||||
// in the module this.module_ is equal to EXPECTED.
|
||||
void TestLineCount(int i, size_t expected);
|
||||
|
|
@ -615,6 +619,15 @@ void CUFixtureBase::TestFunction(int i, const string& name,
|
|||
EXPECT_EQ(0U, function->parameter_size);
|
||||
}
|
||||
|
||||
void CUFixtureBase::TestFunctionPreferExternName(int i,
|
||||
bool prefer_extern_name) {
|
||||
FillFunctions();
|
||||
ASSERT_LT((size_t)i, functions_.size());
|
||||
|
||||
Module::Function* function = functions_[i];
|
||||
EXPECT_EQ(prefer_extern_name, function->prefer_extern_name);
|
||||
}
|
||||
|
||||
void CUFixtureBase::TestLineCount(int i, size_t expected) {
|
||||
FillFunctions();
|
||||
ASSERT_LT((size_t) i, functions_.size());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue