[llvm] [llvm-debuginfo-analyzer] Incorrect DW_AT_call_line/DW_AT_call_file. (PR #115701)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 11 01:49:52 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-debuginfo
Author: Carlos Alberto Enciso (CarlosAlbertoEnciso)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/115701.diff
3 Files Affected:
- (modified) llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst (+1-1)
- (modified) llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp (+4-4)
- (modified) llvm/test/tools/llvm-debuginfo-analyzer/DWARF/05-dwarf-incorrect-lexical-scope-variable.test (+1-1)
``````````diff
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'
``````````
</details>
https://github.com/llvm/llvm-project/pull/115701
More information about the llvm-commits
mailing list