[llvm] r331291 - llvm-symbolizer: Handle function definitions nested within other functions

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue May 1 11:08:45 PDT 2018


Author: dblaikie
Date: Tue May  1 11:08:45 2018
New Revision: 331291

URL: http://llvm.org/viewvc/llvm-project?rev=331291&view=rev
Log:
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.

Added:
    llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64   (with props)
Modified:
    llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
    llvm/trunk/test/DebugInfo/llvm-symbolizer.test

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp?rev=331291&r1=331290&r2=331291&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp Tue May  1 11:08:45 2018
@@ -415,11 +415,15 @@ DWARFUnit::getInlinedChainForAddress(uin
   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,

Added: llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64?rev=331291&view=auto
==============================================================================
Binary files llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64 (added) and llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64 Tue May  1 11:08:45 2018 differ

Propchange: llvm/trunk/test/DebugInfo/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64
------------------------------------------------------------------------------
    svn:executable = *

Modified: llvm/trunk/test/DebugInfo/llvm-symbolizer.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/llvm-symbolizer.test?rev=331291&r1=331290&r2=331291&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/llvm-symbolizer.test (original)
+++ llvm/trunk/test/DebugInfo/llvm-symbolizer.test Tue May  1 11:08:45 2018
@@ -20,6 +20,7 @@ RUN: echo "%p/Inputs/macho-universal 0x1
 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
 




More information about the llvm-commits mailing list