diff options
| author | David Blaikie <dblaikie@gmail.com> | 2016-04-22 21:32:59 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2016-04-22 21:32:59 +0000 |
| commit | 9a4f3cb275b148f11850ca24c8ff245990ee327d (patch) | |
| tree | 8517a66962c978c898fd3622365e52df588789c2 /llvm | |
| parent | 18ce9d82c6ec4be482fe8f1f29e0a99a854fd9e1 (diff) | |
| download | bcm5719-llvm-9a4f3cb275b148f11850ca24c8ff245990ee327d.tar.gz bcm5719-llvm-9a4f3cb275b148f11850ca24c8ff245990ee327d.zip | |
llvm-symbolizer: prefer .dwo contents over fission-gmlt-like-data when .dwo file is present
Rather than relying on the gmlt-like data emitted into the .o/executable
which only contains the simple name of any inlined functions, use the
.dwo file if present.
Test symbolication with/without a .dwo, and the old test that was
testing behavior when no gmlt-like data was present. (I haven't included
a test of non-gmlt-like data + no .dwo (that would be akin to
symbolication with no debug info) but we could add one for completeness)
The test was simplified a bit to be a little clearer (unoptimized, force
inline, using a function call as the inlined entity) and regenerated
with ToT clang. For the no-gmlt-like-data case, I modified Clang back to
its old behavior temporarily & the .dwo file is identical so it is
shared between the two executables.
llvm-svn: 267227
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 19 | ||||
| -rwxr-xr-x | llvm/test/DebugInfo/Inputs/split-dwarf-test | bin | 9379 -> 9208 bytes | |||
| -rwxr-xr-x | llvm/test/DebugInfo/Inputs/split-dwarf-test-nogmlt | bin | 0 -> 9128 bytes | |||
| -rw-r--r-- | llvm/test/DebugInfo/Inputs/split-dwarf-test.cc | 13 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/Inputs/split-dwarf-test.dwo | bin | 1609 -> 1377 bytes | |||
| -rw-r--r-- | llvm/test/DebugInfo/llvm-symbolizer.test | 34 |
6 files changed, 40 insertions, 26 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index fdc9da3fbae..0430265ae74 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -378,19 +378,14 @@ DWARFUnit::getInlinedChainForAddress(uint64_t Address) { // First, find a subprogram that contains the given address (the root // of inlined chain). const DWARFUnit *ChainCU = nullptr; - const DWARFDebugInfoEntryMinimal *SubprogramDIE = - getSubprogramForAddress(Address); - if (SubprogramDIE) { + const DWARFDebugInfoEntryMinimal *SubprogramDIE; + // Try to look for subprogram DIEs in the DWO file. + parseDWO(); + if (DWO) { + if ((SubprogramDIE = DWO->getUnit()->getSubprogramForAddress(Address))) + ChainCU = DWO->getUnit(); + } else if ((SubprogramDIE = getSubprogramForAddress(Address))) ChainCU = this; - } else { - // Try to look for subprogram DIEs in the DWO file. - parseDWO(); - if (DWO.get()) { - SubprogramDIE = DWO->getUnit()->getSubprogramForAddress(Address); - if (SubprogramDIE) - ChainCU = DWO->getUnit(); - } - } // Get inlined chain rooted at this subprogram DIE. if (!SubprogramDIE) diff --git a/llvm/test/DebugInfo/Inputs/split-dwarf-test b/llvm/test/DebugInfo/Inputs/split-dwarf-test Binary files differindex a4411129a9b..4d6aa0cd98a 100755 --- a/llvm/test/DebugInfo/Inputs/split-dwarf-test +++ b/llvm/test/DebugInfo/Inputs/split-dwarf-test diff --git a/llvm/test/DebugInfo/Inputs/split-dwarf-test-nogmlt b/llvm/test/DebugInfo/Inputs/split-dwarf-test-nogmlt Binary files differnew file mode 100755 index 00000000000..6a340aa47e6 --- /dev/null +++ b/llvm/test/DebugInfo/Inputs/split-dwarf-test-nogmlt diff --git a/llvm/test/DebugInfo/Inputs/split-dwarf-test.cc b/llvm/test/DebugInfo/Inputs/split-dwarf-test.cc index 5ed56f94b36..b41423dd815 100644 --- a/llvm/test/DebugInfo/Inputs/split-dwarf-test.cc +++ b/llvm/test/DebugInfo/Inputs/split-dwarf-test.cc @@ -1,13 +1,16 @@ -int foo(int a) { - return a + 1; +void f1() { } -int main(int argc, char *argv[]) { - return foo(argc); +inline __attribute__((always_inline)) void f2() { + f1(); +} + +int main() { + f2(); } // Build instructions: -// 1) clang++ -### -O2 -gsplit-dwarf.cc split-dwarf-test.cc -o split-dwarf-test +// 1) clang++ -### -gsplit-dwarf split-dwarf-test.cc -o split-dwarf-test // 2) Replace the value "-fdebug-compilation-dir" flag to "Output" // (this is the temp directory used by lit). // 3) Manually run clang-cc1, objcopy and ld invocations. diff --git a/llvm/test/DebugInfo/Inputs/split-dwarf-test.dwo b/llvm/test/DebugInfo/Inputs/split-dwarf-test.dwo Binary files differindex 74183a4b622..588374d7d21 100644 --- a/llvm/test/DebugInfo/Inputs/split-dwarf-test.dwo +++ b/llvm/test/DebugInfo/Inputs/split-dwarf-test.dwo diff --git a/llvm/test/DebugInfo/llvm-symbolizer.test b/llvm/test/DebugInfo/llvm-symbolizer.test index 6b3c0494cdd..7ea062e6c9e 100644 --- a/llvm/test/DebugInfo/llvm-symbolizer.test +++ b/llvm/test/DebugInfo/llvm-symbolizer.test @@ -20,12 +20,27 @@ RUN: echo "%p/Inputs/llvm-symbolizer-dwo-test 0x400514" >> %t.input RUN: echo "%p/Inputs/fission-ranges.elf-x86_64 0x720" >> %t.input RUN: echo "%p/Inputs/arange-overlap.elf-x86_64 0x714" >> %t.input RUN: cp %p/Inputs/split-dwarf-test.dwo %T -RUN: echo "%p/Inputs/split-dwarf-test 0x4004d0" >> %t.input -RUN: echo "%p/Inputs/split-dwarf-test 0x4004c0" >> %t.input +RUN: echo "%p/Inputs/split-dwarf-test 0x4005d4" >> %t.input +RUN: echo "%p/Inputs/split-dwarf-test 0x4005c4" >> %t.input RUN: echo "%p/Inputs/cross-cu-inlining.x86_64-macho.o 0x17" >> %t.input RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \ -RUN: --default-arch=i386 < %t.input | FileCheck %s +RUN: --default-arch=i386 < %t.input | FileCheck --check-prefix=CHECK --check-prefix=SPLIT --check-prefix=DWO %s + +Ensure we get the same results in the absence of gmlt-like data in the executable but the presence of a .dwo file + +RUN: echo "%p/Inputs/split-dwarf-test-nogmlt 0x4005d4" >> %t.input +RUN: echo "%p/Inputs/split-dwarf-test-nogmlt 0x4005c4" >> %t.input +RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \ +RUN: --default-arch=i386 < %t.input | FileCheck --check-prefix=SPLIT --check-prefix=DWO %s + +Ensure we get gmlt like results in the absence of a .dwo file but the presence of gmlt-like data in the executable + +RUN: rm %T/split-dwarf-test.dwo +RUN: echo "%p/Inputs/split-dwarf-test 0x4005d4" >> %t.input +RUN: echo "%p/Inputs/split-dwarf-test 0x4005c4" >> %t.input +RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \ +RUN: --default-arch=i386 < %t.input | FileCheck --check-prefix=SPLIT --check-prefix=NODWO %s CHECK: main CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16 @@ -102,13 +117,14 @@ CHECK-NEXT: {{.*}}fission-ranges.cc:6 CHECK: _ZN1S3bazEv CHECK-NEXT: {{.*}}arange-overlap.cc:6 -CHECK: _Z3fooi -CHECK-NEXT: {{.*}}split-dwarf-test.cc -CHECK-NEXT: main -CHECK-NEXT: {{.*}}split-dwarf-test.cc +DWO: _Z2f2v +NODWO: {{^f2$}} +SPLIT-NEXT: {{.*}}split-dwarf-test.cc +SPLIT-NEXT: main +SPLIT-NEXT: {{.*}}split-dwarf-test.cc -CHECK: _Z3fooi -CHECK-NEXT: {{.*}}split-dwarf-test.cc +SPLIT: _Z2f1v +SPLIT-NEXT: {{.*}}split-dwarf-test.cc ; func has been inlined into main by LTO. Check that the symbolizer is able ; to resolve the cross-cu reference and retrieve func's name |

