-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[llvm-debuginfo-analyzer] Incorrect DW_AT_call_line/DW_AT_call_file. #115701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[llvm-debuginfo-analyzer] Incorrect DW_AT_call_line/DW_AT_call_file. #115701
Conversation
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
@llvm/pr-subscribers-llvm-binary-utilities @llvm/pr-subscribers-debuginfo Author: Carlos Alberto Enciso (CarlosAlbertoEnciso) ChangesThe 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: Full diff: https://github.com/llvm/llvm-project/pull/115701.diff 3 Files Affected:
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'
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@OCHyams Many thanks for your review. |
…lvm#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
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