[llvm] 5e7662e - [llvm-debuginfo-analyzer] Incorrect DW_AT_call_line/DW_AT_call_file. (#115701)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 05:00:27 PST 2024


Author: Carlos Alberto Enciso
Date: 2024-11-11T13:00:24Z
New Revision: 5e7662efec36b0117cfdf85c0182e026e0019c4e

URL: https://github.com/llvm/llvm-project/commit/5e7662efec36b0117cfdf85c0182e026e0019c4e
DIFF: https://github.com/llvm/llvm-project/commit/5e7662efec36b0117cfdf85c0182e026e0019c4e.diff

LOG: [llvm-debuginfo-analyzer] Incorrect DW_AT_call_line/DW_AT_call_file. (#115701)

The code dealing with DW_AT_call_line/DW_AT_call_file is in the wrong
place. The correct functions were call, but with incorrect values:
  DW_AT_call_line <-- Filename Index
  DW_AT_call_file <-- Line number

Added: 
    

Modified: 
    llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst
    llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
    llvm/test/tools/llvm-debuginfo-analyzer/DWARF/05-dwarf-incorrect-lexical-scope-variable.test

Removed: 
    


################################################################################
diff  --git a/llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst b/llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst
index 5b3200a4b78235..60fa024db5e991 100644
--- a/llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst
+++ b/llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst
@@ -1742,7 +1742,7 @@ DWARF - Clang (Linux)
   [003]     3           {Variable} 'Var_1' -> 'int'
   [002]    11         {Function} extern not_inlined 'test' -> 'int'
   [003]    12           {Variable} 'A' -> 'int'
-  [003]    14           {InlinedFunction} inlined 'InlineFunction' -> 'int'
+  [003]    13           {InlinedFunction} inlined 'InlineFunction' -> 'int'
   [004]                   {Block}
   [005]                     {Variable} 'Var_2' -> 'int'
   [004]                   {Parameter} 'Param' -> 'int'

diff  --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
index 1c523c01314977..ce1d5619e1fa80 100644
--- a/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
@@ -304,12 +304,12 @@ void LVDWARFReader::processOneAttribute(const DWARFDie &Die,
     CurrentElement->setBitSize(*FormValue.getAsUnsignedConstant());
     break;
   case dwarf::DW_AT_call_file:
-    CurrentElement->setCallFilenameIndex(GetAsUnsignedConstant());
+    CurrentElement->setCallFilenameIndex(IncrementFileIndex
+                                             ? GetAsUnsignedConstant() + 1
+                                             : GetAsUnsignedConstant());
     break;
   case dwarf::DW_AT_call_line:
-    CurrentElement->setCallLineNumber(IncrementFileIndex
-                                          ? GetAsUnsignedConstant() + 1
-                                          : GetAsUnsignedConstant());
+    CurrentElement->setCallLineNumber(GetAsUnsignedConstant());
     break;
   case dwarf::DW_AT_comp_dir:
     CompileUnit->setCompilationDirectory(dwarf::toStringRef(FormValue));

diff  --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/05-dwarf-incorrect-lexical-scope-variable.test b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/05-dwarf-incorrect-lexical-scope-variable.test
index 5453a46fb542dd..e1ac7588f1d8c4 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/05-dwarf-incorrect-lexical-scope-variable.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/05-dwarf-incorrect-lexical-scope-variable.test
@@ -50,7 +50,7 @@
 ; ONE-NEXT: [003]     3           {Variable} 'Var_1' -> 'int'
 ; ONE-NEXT: [002]    11         {Function} extern not_inlined 'test' -> 'int'
 ; ONE-NEXT: [003]    12           {Variable} 'A' -> 'int'
-; ONE-NEXT: [003]    14           {InlinedFunction} not_inlined 'InlineFunction' -> 'int'
+; ONE-NEXT: [003]    13           {InlinedFunction} not_inlined 'InlineFunction' -> 'int'
 ; ONE-NEXT: [004]                   {Block}
 ; ONE-NEXT: [005]                     {Variable} 'Var_2' -> 'int'
 ; ONE-NEXT: [004]                   {Parameter} 'Param' -> 'int'


        


More information about the llvm-commits mailing list