-
Notifications
You must be signed in to change notification settings - Fork 15k
[llvm-debuginfo-analyzer] Fixed some DWARF related bugs #153318
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
Conversation
|
@llvm/pr-subscribers-debuginfo @llvm/pr-subscribers-backend-amdgpu Author: Adam Yang (adam-yang) ChangesThis PR fixes two bugs in LogicalView:
The test changes for llvm-debug-analyzer are mostly to address the DW_AT_high_pc change. There is a new test that further verifies the fixes. Patch is 24.12 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/153318.diff 14 Files Affected:
diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
index 62134dfdadf46..3ba5061718144 100644
--- a/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
@@ -274,7 +274,7 @@ void LVDWARFReader::processOneAttribute(const DWARFDie &Die,
for (DWARFAddressRange &Range : Ranges) {
// This seems to be a tombstone for empty ranges.
if ((Range.LowPC == Range.HighPC) ||
- (Range.LowPC = getTombstoneAddress()))
+ (Range.LowPC == getTombstoneAddress()))
continue;
// Store the real upper limit for the address range.
if (UpdateHighAddress && Range.HighPC > 0)
@@ -461,13 +461,17 @@ LVScope *LVDWARFReader::processOneDie(const DWARFDie &InputDIE, LVScope *Parent,
if (!CurrentRanges.empty()) {
for (LVAddressRange &Range : CurrentRanges)
addSectionRange(SectionIndex, CurrentScope, Range.first,
- Range.second);
+ Range.second > Range.first
+ ? Range.second - 1 // Make hi-pc exclusive
+ : Range.second);
CurrentRanges.clear();
}
// If the scope is the CU, do not update the ranges set.
if (FoundLowPC && FoundHighPC && !IsCompileUnit) {
addSectionRange(SectionIndex, CurrentScope, CurrentLowPC,
- CurrentHighPC);
+ CurrentHighPC > CurrentLowPC
+ ? CurrentHighPC - 1 // Make hi-pc exclusive
+ : CurrentHighPC);
}
}
}
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-print-basic-details.test b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-print-basic-details.test
index 54dbd7466e4f6..6d767eb9e883a 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-print-basic-details.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-print-basic-details.test
@@ -45,8 +45,6 @@
; ONE-NEXT: [004] 6 {Line}
; ONE-NEXT: [004] {Code} 'movl $0x7, -0x4(%rbp)'
; ONE-NEXT: [004] {Code} 'jmp 0x6'
-; ONE-NEXT: [004] 8 {Line}
-; ONE-NEXT: [004] {Code} 'movl -0x14(%rbp), %eax'
; ONE-NEXT: [003] 4 {TypeAlias} 'INTEGER' -> 'int'
; ONE-NEXT: [003] 2 {Line}
; ONE-NEXT: [003] {Code} 'pushq %rbp'
@@ -60,10 +58,12 @@
; ONE-NEXT: [003] {Code} 'testb $0x1, -0x15(%rbp)'
; ONE-NEXT: [003] {Code} 'je 0x13'
; ONE-NEXT: [003] 8 {Line}
+; ONE-NEXT: [003] {Code} 'movl -0x14(%rbp), %eax'
+; ONE-NEXT: [003] 8 {Line}
; ONE-NEXT: [003] {Code} 'movl %eax, -0x4(%rbp)'
; ONE-NEXT: [003] 9 {Line}
; ONE-NEXT: [003] {Code} 'movl -0x4(%rbp), %eax'
; ONE-NEXT: [003] {Code} 'popq %rbp'
; ONE-NEXT: [003] {Code} 'retq'
-; ONE-NEXT: [003] 9 {Line}
; ONE-NEXT: [002] 1 {TypeAlias} 'INTPTR' -> '* const int'
+; ONE-NEXT: [002] 9 {Line}
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-select-logical-elements.test b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-select-logical-elements.test
index f84e9201d3044..5690cf585c379 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-select-logical-elements.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-select-logical-elements.test
@@ -34,7 +34,7 @@
; ONE-NEXT: [004] {Code} 'movl $0x7, -0x4(%rbp)'
; ONE-NEXT: [003] {Code} 'movl %eax, -0x4(%rbp)'
; ONE-NEXT: [003] {Code} 'movl %esi, -0x14(%rbp)'
-; ONE-NEXT: [004] {Code} 'movl -0x14(%rbp), %eax'
+; ONE-NEXT: [003] {Code} 'movl -0x14(%rbp), %eax'
; ONE-NEXT: [003] {Code} 'movl -0x4(%rbp), %eax'
; ONE-NEXT: [003] 4 {TypeAlias} 'INTEGER' -> 'int'
; ONE-NEXT: [004] 5 {Variable} 'CONSTANT' -> 'const INTEGER'
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/02-dwarf-logical-lines.test b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/02-dwarf-logical-lines.test
index 533914f002827..bff7c945b6eac 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/02-dwarf-logical-lines.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/02-dwarf-logical-lines.test
@@ -42,7 +42,7 @@
; ONE-NEXT: [003] {Code} 'addq $0x10, %rsp'
; ONE-NEXT: [003] {Code} 'popq %rbp'
; ONE-NEXT: [003] {Code} 'retq'
-; ONE-NEXT: [003] 6 {Line}
+; ONE-NEXT: [002] 6 {Line}
; ONE-EMPTY:
; ONE-NEXT: Logical View:
; ONE-NEXT: [000] {File} 'hello-world-dwarf-gcc.o' -> elf64-x86-64
@@ -64,4 +64,4 @@
; ONE-NEXT: [003] 7 {Line}
; ONE-NEXT: [003] {Code} 'popq %rbp'
; ONE-NEXT: [003] {Code} 'retq'
-; ONE-NEXT: [003] 7 {Line}
+; ONE-NEXT: [002] 7 {Line}
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/03-dwarf-incorrect-lexical-scope-typedef.test b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/03-dwarf-incorrect-lexical-scope-typedef.test
index dc57d01f3b8bb..69b65148361d7 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/03-dwarf-incorrect-lexical-scope-typedef.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/03-dwarf-incorrect-lexical-scope-typedef.test
@@ -59,7 +59,6 @@
; ONE-NEXT: [004] 10 {Line}
; ONE-NEXT: [004] 10 {Line}
; ONE-NEXT: [004] 10 {Line}
-; ONE-NEXT: [004] 13 {Line}
; ONE-NEXT: [003] 3 {Parameter} 'Param' -> 'char'
; ONE-NEXT: [003] 7 {TypeAlias} 'FLOAT' -> 'float'
; ONE-NEXT: [003] 4 {TypeAlias} 'INT' -> 'int'
@@ -71,6 +70,7 @@
; ONE-NEXT: [003] 13 {Line}
; ONE-NEXT: [003] 13 {Line}
; ONE-NEXT: [003] 13 {Line}
+; ONE-NEXT: [002] 13 {Line}
; ONE-EMPTY:
; ONE-NEXT: Logical View:
; ONE-NEXT: [000] {File} 'pr-44884-dwarf-gcc.o' -> elf64-x86-64
@@ -91,7 +91,6 @@
; ONE-NEXT: [005] 9 {Line}
; ONE-NEXT: [005] 9 {Line}
; ONE-NEXT: [005] 10 {Line}
-; ONE-NEXT: [005] 13 {Line}
; ONE-NEXT: [004] 7 {TypeAlias} 'FLOAT' -> 'float'
; ONE-NEXT: [003] 3 {Parameter} 'Param' -> 'char'
; ONE-NEXT: [003] 4 {TypeAlias} 'INT' -> 'int'
@@ -99,8 +98,9 @@
; ONE-NEXT: [003] 3 {Line}
; ONE-NEXT: [003] 5 {Line}
; ONE-NEXT: [003] 13 {Line}
+; ONE-NEXT: [003] 13 {Line}
; ONE-NEXT: [003] 14 {Line}
-; ONE-NEXT: [003] 14 {Line}
+; ONE-NEXT: [002] 14 {Line}
; Using the selection facilities, we can produce a simple tabular
; output showing just the logical types that are 'Typedef'.
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/06-dwarf-full-logical-view.test b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/06-dwarf-full-logical-view.test
index 6616710a10045..a2f05ddb3e6ec 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/06-dwarf-full-logical-view.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/06-dwarf-full-logical-view.test
@@ -53,8 +53,6 @@
; ONE-NEXT: [0x0000000023][004] 6 {Line} {NewStatement} '/data/projects/tests/input/general/test.cpp'
; ONE-NEXT: [0x0000000023][004] {Code} 'movl $0x7, -0x4(%rbp)'
; ONE-NEXT: [0x000000002a][004] {Code} 'jmp 0x6'
-; ONE-NEXT: [0x000000002f][004] 8 {Line} {NewStatement} '/data/projects/tests/input/general/test.cpp'
-; ONE-NEXT: [0x000000002f][004] {Code} 'movl -0x14(%rbp), %eax'
; ONE-NEXT: [0x0000000063][003] 2 {Parameter} 'ParamBool' -> [0x00000000bc]'bool'
; ONE-NEXT: [0x0000000063][004] {Coverage} 100.00%
; ONE-NEXT: [0x0000000064][004] {Location}
@@ -79,13 +77,15 @@
; ONE-NEXT: [0x0000000012][003] 3 {Line} {NewStatement} {PrologueEnd} '/data/projects/tests/input/general/test.cpp'
; ONE-NEXT: [0x0000000012][003] {Code} 'testb $0x1, -0x15(%rbp)'
; ONE-NEXT: [0x0000000016][003] {Code} 'je 0x13'
+; ONE-NEXT: [0x000000002f][003] 8 {Line} {NewStatement} '/data/projects/tests/input/general/test.cpp'
+; ONE-NEXT: [0x000000002f][003] {Code} 'movl -0x14(%rbp), %eax'
; ONE-NEXT: [0x0000000032][003] 8 {Line} '/data/projects/tests/input/general/test.cpp'
; ONE-NEXT: [0x0000000032][003] {Code} 'movl %eax, -0x4(%rbp)'
; ONE-NEXT: [0x0000000035][003] 9 {Line} {NewStatement} '/data/projects/tests/input/general/test.cpp'
; ONE-NEXT: [0x0000000035][003] {Code} 'movl -0x4(%rbp), %eax'
; ONE-NEXT: [0x0000000038][003] {Code} 'popq %rbp'
; ONE-NEXT: [0x0000000039][003] {Code} 'retq'
-; ONE-NEXT: [0x000000003a][003] 9 {Line} {NewStatement} {EndSequence} '/data/projects/tests/input/general/test.cpp'
+; ONE-NEXT: [0x000000003a][002] 9 {Line} {NewStatement} {EndSequence} '/data/projects/tests/input/general/test.cpp'
; ONE-EMPTY:
; ONE-NEXT: -----------------------------
; ONE-NEXT: Element Total Printed
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/Inputs/amdgpu-ranges.o b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/Inputs/amdgpu-ranges.o
new file mode 100644
index 0000000000000..168724b217b03
Binary files /dev/null and b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/Inputs/amdgpu-ranges.o differ
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/amdgpu-ranges.test b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/amdgpu-ranges.test
new file mode 100644
index 0000000000000..6d55236636710
--- /dev/null
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/amdgpu-ranges.test
@@ -0,0 +1,36 @@
+; REUIRES: amdgpu-registered-target
+
+; Regression test for:
+; - DW_AT_ranges not being read properly
+; - Instructions at DW_AT_high_pc of a scope incorrectly included in the scope
+
+; test.hlsl
+; 01 RWBuffer<float> u0 : register(u0);
+; 02 RWBuffer<float> u1 : register(u1);
+; 03
+; 04 [RootSignature("DescriptorTable(UAV(u0,numDescriptors=2))")]
+; 05 [numthreads(64,1,1)]
+; 06 void main(uint3 dtid : SV_DispatchThreadID) {
+; 07 float my_var = u0[dtid.x];
+; 08 [loop]
+; 09 for (int i = 0; i < 10; i++) {
+; 10 float my_local_var = i*2;
+; 11 my_var += my_local_var;
+; 12 }
+; 13 u1[dtid.x] = my_var;
+; 14 }
+
+; RUN: llvm-debuginfo-analyzer --attribute=all \
+; RUN: --print=all \
+; RUN: --output-sort=offset \
+; RUN: %p/Inputs/amdgpu-ranges.o 2>&1 | \
+; RUN: FileCheck %s
+
+; Make sure these two ranges are present and point to the correct offsets
+; CHECK: [005] {Range} Lines 10:9 [0x00000000b0:0x00000000c8]
+; CHECK: [005] {Range} Lines 11:13 [0x00000000f4:0x0000000114]
+
+; Make sure the offset 0x114 does not show up at the scope level 005 and 004
+; CHECK-NOT: [0x0000000114][005]
+; CHECK-NOT: [0x0000000114][004]
+
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/pr-incorrect-logical-instructions.test b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/pr-incorrect-logical-instructions.test
index a99eae2aa2933..b38db28085b3e 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/pr-incorrect-logical-instructions.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/pr-incorrect-logical-instructions.test
@@ -84,7 +84,6 @@
; ONE-NEXT: [003] {Code} 'addq $0x10, %rsp'
; ONE-NEXT: [003] {Code} 'popq %rbp'
; ONE-NEXT: [003] {Code} 'retq'
-; ONE-NEXT: [003] {Code} 'data16'
; ONE-NEXT: [002] 10 {Function} extern not_inlined 'test' -> 'int'
; ONE-NEXT: [003] {Block}
; ONE-NEXT: [004] 13 {Line}
@@ -106,8 +105,6 @@
; ONE-NEXT: [004] {Code} 'movl -0x8(%rbp), %eax'
; ONE-NEXT: [004] {Code} 'addl $0x1, %eax'
; ONE-NEXT: [004] {Code} 'movl %eax, -0x8(%rbp)'
-; ONE-NEXT: [004] 17 {Line}
-; ONE-NEXT: [004] {Code} 'movl -0x8(%rbp), %eax'
; ONE-NEXT: [003] 10 {Line}
; ONE-NEXT: [003] {Code} 'pushq %rbp'
; ONE-NEXT: [003] {Code} 'movq %rsp, %rbp'
@@ -120,6 +117,8 @@
; ONE-NEXT: [003] 11 {Line}
; ONE-NEXT: [003] {Code} 'movl %eax, -0x8(%rbp)'
; ONE-NEXT: [003] 17 {Line}
+; ONE-NEXT: [003] {Code} 'movl -0x8(%rbp), %eax'
+; ONE-NEXT: [003] 17 {Line}
; ONE-NEXT: [003] {Code} 'addq $0x10, %rsp'
; ONE-NEXT: [003] {Code} 'popq %rbp'
; ONE-NEXT: [003] {Code} 'retq'
@@ -132,7 +131,8 @@
; ONE-NEXT: [003] {Code} 'xorl %eax, %eax'
; ONE-NEXT: [003] {Code} 'popq %rbp'
; ONE-NEXT: [003] {Code} 'retq'
-; ONE-NEXT: [003] 21 {Line}
+; ONE-NEXT: [002] {Code} 'data16'
+; ONE-NEXT: [002] 21 {Line}
; RUN: llvm-debuginfo-analyzer --attribute=level \
; RUN: --print=instructions \
@@ -172,7 +172,6 @@
; TWO-NEXT: [003] {Code} 'addq $0x10, %rsp'
; TWO-NEXT: [003] {Code} 'popq %rbp'
; TWO-NEXT: [003] {Code} 'retq'
-; TWO-NEXT: [003] {Code} 'data16'
; TWO-NEXT: [002] 10 {Function} extern not_inlined 'test' -> 'int'
; TWO-NEXT: [003] {Block}
; TWO-NEXT: [004] {Code} 'movl $0x0, -0xc(%rbp)'
@@ -187,7 +186,6 @@
; TWO-NEXT: [004] {Code} 'movl -0x8(%rbp), %eax'
; TWO-NEXT: [004] {Code} 'addl $0x1, %eax'
; TWO-NEXT: [004] {Code} 'movl %eax, -0x8(%rbp)'
-; TWO-NEXT: [004] {Code} 'movl -0x8(%rbp), %eax'
; TWO-NEXT: [003] {Code} 'pushq %rbp'
; TWO-NEXT: [003] {Code} 'movq %rsp, %rbp'
; TWO-NEXT: [003] {Code} 'subq $0x10, %rsp'
@@ -195,6 +193,7 @@
; TWO-NEXT: [003] {Code} 'movl -0x4(%rbp), %eax'
; TWO-NEXT: [003] {Code} 'subl (%rip), %eax'
; TWO-NEXT: [003] {Code} 'movl %eax, -0x8(%rbp)'
+; TWO-NEXT: [003] {Code} 'movl -0x8(%rbp), %eax'
; TWO-NEXT: [003] {Code} 'addq $0x10, %rsp'
; TWO-NEXT: [003] {Code} 'popq %rbp'
; TWO-NEXT: [003] {Code} 'retq'
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/01-wasm-print-basic-details.test b/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/01-wasm-print-basic-details.test
index 4927086563330..183e3ddc75ca1 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/01-wasm-print-basic-details.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/01-wasm-print-basic-details.test
@@ -56,8 +56,6 @@
; ONE-NEXT: [004] {Code} 'local.get 11'
; ONE-NEXT: [004] {Code} 'i32.store 28'
; ONE-NEXT: [004] {Code} 'br 1'
-; ONE-NEXT: [004] - {Line}
-; ONE-NEXT: [004] {Code} 'end'
; ONE-NEXT: [003] 4 {TypeAlias} 'INTEGER' -> 'int'
; ONE-NEXT: [003] 2 {Line}
; ONE-NEXT: [003] {Code} 'nop'
@@ -98,6 +96,8 @@
; ONE-NEXT: [003] {Code} 'local.get 9'
; ONE-NEXT: [003] {Code} 'i32.eqz'
; ONE-NEXT: [003] {Code} 'br_if 0'
+; ONE-NEXT: [003] - {Line}
+; ONE-NEXT: [003] {Code} 'end'
; ONE-NEXT: [003] 8 {Line}
; ONE-NEXT: [003] {Code} 'local.get 5'
; ONE-NEXT: [003] {Code} 'i32.load 20'
@@ -115,6 +115,6 @@
; ONE-NEXT: [003] {Code} 'local.get 13'
; ONE-NEXT: [003] {Code} 'return'
; ONE-NEXT: [003] {Code} 'end'
-; ONE-NEXT: [003] 9 {Line}
-; ONE-NEXT: [003] {Code} 'unreachable'
; ONE-NEXT: [002] 1 {TypeAlias} 'INTPTR' -> '* const int'
+; ONE-NEXT: [002] 9 {Line}
+; ONE-NEXT: [002] {Code} 'unreachable'
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/02-wasm-logical-lines.test b/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/02-wasm-logical-lines.test
index 50a531ad7d823..8d764648bdd5a 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/02-wasm-logical-lines.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/02-wasm-logical-lines.test
@@ -71,5 +71,5 @@
; ONE-NEXT: [003] {Code} 'local.get 6'
; ONE-NEXT: [003] {Code} 'return'
; ONE-NEXT: [003] {Code} 'end'
-; ONE-NEXT: [003] 6 {Line}
-; ONE-NEXT: [003] {Code} 'return'
+; ONE-NEXT: [002] 6 {Line}
+; ONE-NEXT: [002] {Code} 'return'
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/03-wasm-incorrect-lexical-scope-typedef.test b/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/03-wasm-incorrect-lexical-scope-typedef.test
index 1192a0cb7ca5a..a89d49abd6280 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/03-wasm-incorrect-lexical-scope-typedef.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/03-wasm-incorrect-lexical-scope-typedef.test
@@ -55,7 +55,6 @@
; ONE-NEXT: [003] - {Line}
; ONE-NEXT: [003] 1 {Line}
; ONE-NEXT: [003] 1 {Line}
-; ONE-NEXT: [003] 1 {Line}
; ONE-NEXT: [002] 3 {Function} extern not_inlined 'foo' -> 'unsigned int'
; ONE-NEXT: [003] {Block}
; ONE-NEXT: [004] 9 {Variable} 'Added' -> 'FLOAT'
@@ -67,7 +66,6 @@
; ONE-NEXT: [004] 10 {Line}
; ONE-NEXT: [004] 10 {Line}
; ONE-NEXT: [004] 10 {Line}
-; ONE-NEXT: [004] 13 {Line}
; ONE-NEXT: [003] 3 {Parameter} 'Param' -> 'char'
; ONE-NEXT: [003] 7 {TypeAlias} 'FLOAT' -> 'float'
; ONE-NEXT: [003] 4 {TypeAlias} 'INT' -> 'int'
@@ -79,6 +77,8 @@
; ONE-NEXT: [003] 13 {Line}
; ONE-NEXT: [003] 13 {Line}
; ONE-NEXT: [003] 13 {Line}
+; ONE-NEXT: [002] 1 {Line}
+; ONE-NEXT: [002] 13 {Line}
; ONE-EMPTY:
; ONE-NEXT: Logical View:
; ONE-NEXT: [000] {File} 'pr-44884-dwarf-gcc.o' -> elf64-x86-64
@@ -99,7 +99,6 @@
; ONE-NEXT: [005] 9 {Line}
; ONE-NEXT: [005] 9 {Line}
; ONE-NEXT: [005] 10 {Line}
-; ONE-NEXT: [005] 13 {Line}
; ONE-NEXT: [004] 7 {TypeAlias} 'FLOAT' -> 'float'
; ONE-NEXT: [003] 3 {Parameter} 'Param' -> 'char'
; ONE-NEXT: [003] 4 {TypeAlias} 'INT' -> 'int'
@@ -107,8 +106,9 @@
; ONE-NEXT: [003] 3 {Line}
; ONE-NEXT: [003] 5 {Line}
; ONE-NEXT: [003] 13 {Line}
+; ONE-NEXT: [003] 13 {Line}
; ONE-NEXT: [003] 14 {Line}
-; ONE-NEXT: [003] 14 {Line}
+; ONE-NEXT: [002] 14 {Line}
; Using the selection facilities, we can produce a simple tabular
; output showing just the logical types that are 'Typedef'.
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/06-wasm-full-logical-view.test b/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/06-wasm-full-logical-view.test
index ac4873f0a4d34..e152f40d99213 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/06-wasm-full-logical-view.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/06-wasm-full-logical-view.test
@@ -64,8 +64,6 @@
; ONE-NEXT: [0x000000005d][004] {Code} 'local.get 11'
; ONE-NEXT: [0x000000005f][004] {Code} 'i32.store 28'
; ONE-NEXT: [0x0000000...
[truncated]
|
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.
I assume that your changes are fixing issues. Which is great.
The initial approach for the logical view was to have the high PC value as inclusive, as it reduced the amount of additional checks.
If we decide to have the high PC value as exclusive (as the DWARF approach), I think all readers (DWARF, CodeView, etc) should be aware of the new approach.
Have you verified if the CodeView Reader , requires any adjustments? A simple way is to generate CodeView and DWARF for the same input file and the logical views should be similar (line numbers).
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.
Good finding.
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.
; REQUIRES: amdgpu-registered-target
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.
Yes this repro was found from testing AMDGPU. Should we have a x86 test?
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.
As the changes are generic, I think having a X86 test would be a good thing to have.
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.
Added x86 tests for both fixes.
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.
This is still a typo of REQUIRES
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.
Oops didn't realize that was pointing out the typo. Fixed now.
Tested with a simple program. LV CodeView does not include line 7 in the loop scope (which is what I would expect), but LV DWARF did before this change. I could add the DWARF for this to the PR as well as a test. |
ee47212 to
a7fd150
Compare
|
@adam-yang Thanks for adding the extra test cases. For new patches, we have try to avoid the inclusion of binary files. Instead can you include a .ll or .s file along with the instructions how to generate the binary file? |
I used binary files to avoid codegen changes in the future altering the output, especially since we're testing for specific offsets. |
The prior art just does the codegen, which is fine most of the time. We don't want really binary tests |
All the tests are now .s files. |
|
The only minor point would be to try reducing the size of the .S files. |
Thank you Carlos. I deleted some unneeded metadata in the AMDGPU one, but am unsure how the s files can be meaningfully reduced further. |
May be remove or shorter the strings such as directory or file names, clang version data (git information). |
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
|
@arsenm Any additional comments? |
|
@adam-yang I noticed some of the lit tests added here failing if X86 isn't built, I made a PR to fix it here: #155678 |
…able (#155678) Need to require the target. Fixes: #153318 Signed-off-by: Sarnie, Nick <[email protected]>
…isn't available (#155678) Need to require the target. Fixes: llvm/llvm-project#153318 Signed-off-by: Sarnie, Nick <[email protected]>
Updated test cases that failed due to an upstream fix related to the high-pc value being now exclusive. llvm#153318
This PR fixes two bugs in LogicalView:
DW_AT_rangesare not being read correctlyDW_AT_high_pcfor scopes are treated as inclusiveThe test changes for llvm-debug-analyzer are mostly to address the DW_AT_high_pc change. There is a new test that further verifies the fixes.