diff options
author | David Blaikie <dblaikie@gmail.com> | 2018-05-01 18:08:45 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2018-05-01 18:08:45 +0000 |
commit | aa537da89f0b51e2a6c1b317da0b11fcedd5025e (patch) | |
tree | d15361c41953b83737962242a08977ec1041ae78 | |
parent | c708868cb15bbeaecc10ca9e92c7060fc3d3390a (diff) | |
download | bcm5719-llvm-aa537da89f0b51e2a6c1b317da0b11fcedd5025e.tar.gz bcm5719-llvm-aa537da89f0b51e2a6c1b317da0b11fcedd5025e.zip |
llvm-symbolizer: Handle function definitions nested within other functions
LLVM always puts function definition DIEs at the top level, but under
some circumstances GCC does not (at least in this case with member
functions of a function-local type).
To ensure that doesn't appear as though the local type's member function
is unduly inlined within the outer function - ensure the inline
discovery DIE parent walk stops at the first DW_TAG_subprogram.
llvm-svn: 331291
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 8 | ||||
-rwxr-xr-x | llvm/test/DebugInfo/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64 | bin | 0 -> 9416 bytes | |||
-rw-r--r-- | llvm/test/DebugInfo/llvm-symbolizer.test | 5 |
3 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index 884d3bbca59..d54275d302f 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -415,11 +415,15 @@ DWARFUnit::getInlinedChainForAddress(uint64_t Address, DWARFDie SubroutineDIE = (DWO ? DWO.get() : this)->getSubroutineForAddress(Address); - while (SubroutineDIE) { - if (SubroutineDIE.isSubroutineDIE()) + if (!SubroutineDIE) + return; + + while (!SubroutineDIE.isSubprogramDIE()) { + if (SubroutineDIE.getTag() == DW_TAG_inlined_subroutine) InlinedChain.push_back(SubroutineDIE); SubroutineDIE = SubroutineDIE.getParent(); } + InlinedChain.push_back(SubroutineDIE); } const DWARFUnitIndex &llvm::getDWARFUnitIndex(DWARFContext &Context, diff --git a/llvm/test/DebugInfo/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64 b/llvm/test/DebugInfo/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64 Binary files differnew file mode 100755 index 00000000000..39be2996d45 --- /dev/null +++ b/llvm/test/DebugInfo/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64 diff --git a/llvm/test/DebugInfo/llvm-symbolizer.test b/llvm/test/DebugInfo/llvm-symbolizer.test index 1fcc61cbdf9..a6a15491c20 100644 --- a/llvm/test/DebugInfo/llvm-symbolizer.test +++ b/llvm/test/DebugInfo/llvm-symbolizer.test @@ -20,6 +20,7 @@ RUN: echo "%p/Inputs/macho-universal 0x1f84" >> %t.input RUN: echo "%p/Inputs/macho-universal:i386 0x1f67" >> %t.input RUN: echo "%p/Inputs/macho-universal:x86_64 0x100000f05" >> %t.input RUN: echo "%p/Inputs/llvm-symbolizer-dwo-test 0x400514" >> %t.input +RUN: echo "%p/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64 0x61a" >> %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 @@ -127,6 +128,10 @@ CHECK: _Z3inci CHECK: main CHECK-NEXT: llvm-symbolizer-dwo-test.cc:11 +CHECK-NOT: local_mem_func +CHECK: _ZZ2f1vEN3foo14local_mem_funcEv +CHECK-NEXT: {{.*}}local-mem-func.cpp:3:0 + CHECK: main CHECK-NEXT: {{.*}}fission-ranges.cc:6 |