[llvm] c230160 - [llvm-debuginfo-analyzer] Fixed some DWARF related bugs (#153318)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 27 11:09:47 PDT 2025
Author: Adam Yang
Date: 2025-08-27T11:09:42-07:00
New Revision: c2301605a9e701040b5040349822c7874a57c936
URL: https://github.com/llvm/llvm-project/commit/c2301605a9e701040b5040349822c7874a57c936
DIFF: https://github.com/llvm/llvm-project/commit/c2301605a9e701040b5040349822c7874a57c936.diff
LOG: [llvm-debuginfo-analyzer] Fixed some DWARF related bugs (#153318)
This PR fixes two bugs in LogicalView:
- `DW_AT_ranges` are not being read correctly
- `DW_AT_high_pc` for scopes are treated as inclusive
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.
Added:
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/DW_AT_ranges.s
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/amdgpu-ranges.s
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/high_pc_exclusive.s
Modified:
llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-print-basic-details.test
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-select-logical-elements.test
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/02-dwarf-logical-lines.test
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/03-dwarf-incorrect-lexical-scope-typedef.test
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/06-dwarf-full-logical-view.test
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/pr-incorrect-logical-instructions.test
llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/01-wasm-print-basic-details.test
llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/02-wasm-logical-lines.test
llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/03-wasm-incorrect-lexical-scope-typedef.test
llvm/test/tools/llvm-debuginfo-analyzer/WebAssembly/06-wasm-full-logical-view.test
llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp
Removed:
################################################################################
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/DW_AT_ranges.s b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/DW_AT_ranges.s
new file mode 100644
index 0000000000000..58d7b28b8d65e
--- /dev/null
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/DW_AT_ranges.s
@@ -0,0 +1,608 @@
+# Regression test for:
+# - DW_AT_ranges not being read properly
+
+# clang test.cpp --target=i686-pc-linux -g -O2
+# 01
+# 02 float foo(float a) {
+# 03 return a+a;
+# 04 }
+# 05
+# 06 int main(int argc, char **argv) {
+# 07 float my_var = argc;
+# 08 for (int i = 0; i < 4; i++) {
+# 09 float my_local_var = (float)argv[i][0];
+# 10 my_var += foo(my_local_var);
+# 11 }
+# 12 return (int)my_var;
+# 13 }
+
+# RUN: llvm-mc %s -triple=i686-pc-linux -filetype=obj -o - | \
+# RUN: llvm-debuginfo-analyzer --attribute=all \
+# RUN: --print=all \
+# RUN: --output-sort=offset \
+# RUN: - | \
+# RUN: FileCheck %s
+
+# Make sure these two ranges are present and point to the correct offsets
+# CHECK: [006] {Range} Lines 3:10 [0x0000000055:0x0000000058]
+# CHECK: [006] {Range} Lines 3:10 [0x0000000088:0x000000008b]
+
+ .file "test.cpp"
+ .file 0 "F:\\llvm-project" "test.cpp"
+ .text
+ .globl _Z3foof # -- Begin function _Z3foof
+ .p2align 4
+ .type _Z3foof, at function
+_Z3foof: # @_Z3foof
+.Lfunc_begin0:
+ .loc 0 2 0
+ .cfi_startproc
+# %bb.0: # %entry
+ pushl %eax
+ .cfi_def_cfa_offset 8
+.Ltmp0:
+ #DEBUG_VALUE: foo:a <- [DW_OP_plus_uconst 8] [$esp+0]
+ movss 8(%esp), %xmm0 # xmm0 = mem[0],zero,zero,zero
+.Ltmp1:
+ .loc 0 3 11 prologue_end
+ addss %xmm0, %xmm0
+ .loc 0 3 3 is_stmt 0
+ movss %xmm0, (%esp)
+ flds (%esp)
+ .loc 0 3 3 epilogue_begin
+ popl %eax
+ .cfi_def_cfa_offset 4
+ retl
+.Ltmp2:
+.Lfunc_end0:
+ .size _Z3foof, .Lfunc_end0-_Z3foof
+ .cfi_endproc
+ # -- End function
+ .globl main # -- Begin function main
+ .p2align 4
+ .type main, at function
+main: # @main
+.Lfunc_begin1:
+ .loc 0 6 0 is_stmt 1
+ .cfi_startproc
+# %bb.0: # %entry
+ #DEBUG_VALUE: main:argc <- [DW_OP_plus_uconst 4] [$esp+0]
+ #DEBUG_VALUE: main:argv <- [DW_OP_plus_uconst 8] [$esp+0]
+ movl 8(%esp), %eax
+.Ltmp3:
+ .loc 0 7 18 prologue_end
+ cvtsi2ssl 4(%esp), %xmm2
+.Ltmp4:
+ #DEBUG_VALUE: main:my_var <- $xmm2
+ #DEBUG_VALUE: i <- 0
+ .loc 0 9 33
+ movl (%eax), %ecx
+.Ltmp5:
+ #DEBUG_VALUE: i <- 1
+ movl 4(%eax), %edx
+ movzbl (%ecx), %ecx
+ shll $8, %ecx
+ pxor %xmm0, %xmm0
+ pxor %xmm1, %xmm1
+ pinsrw $1, %ecx, %xmm1
+ movzbl (%edx), %ecx
+ shll $8, %ecx
+ pinsrw $3, %ecx, %xmm1
+ psrad $24, %xmm1
+ cvtdq2ps %xmm1, %xmm1
+.Ltmp6:
+ .loc 0 3 11
+ addps %xmm1, %xmm1
+.Ltmp7:
+ .loc 0 10 12
+ addss %xmm1, %xmm2
+.Ltmp8:
+ #DEBUG_VALUE: main:my_var <- $xmm2
+ shufps $85, %xmm1, %xmm1 # xmm1 = xmm1[1,1,1,1]
+ addss %xmm2, %xmm1
+.Ltmp9:
+ #DEBUG_VALUE: main:my_var <- $xmm1
+ #DEBUG_VALUE: i <- 2
+ .loc 0 9 33
+ movl 8(%eax), %ecx
+.Ltmp10:
+ #DEBUG_VALUE: i <- 3
+ movl 12(%eax), %eax
+ movzbl (%ecx), %ecx
+ shll $8, %ecx
+ pinsrw $1, %ecx, %xmm0
+ movzbl (%eax), %eax
+ shll $8, %eax
+ pinsrw $3, %eax, %xmm0
+ psrad $24, %xmm0
+ cvtdq2ps %xmm0, %xmm0
+.Ltmp11:
+ .loc 0 3 11
+ addps %xmm0, %xmm0
+.Ltmp12:
+ .loc 0 10 12
+ addss %xmm0, %xmm1
+.Ltmp13:
+ #DEBUG_VALUE: main:my_var <- $xmm1
+ shufps $85, %xmm0, %xmm0 # xmm0 = xmm0[1,1,1,1]
+ addss %xmm1, %xmm0
+.Ltmp14:
+ #DEBUG_VALUE: main:my_var <- $xmm0
+ #DEBUG_VALUE: i <- 4
+ .loc 0 12 15
+ cvttss2si %xmm0, %eax
+ .loc 0 12 3 is_stmt 0
+ retl
+.Ltmp15:
+.Lfunc_end1:
+ .size main, .Lfunc_end1-main
+ .cfi_endproc
+ # -- End function
+ .section .debug_loclists,"", at progbits
+ .long .Ldebug_list_header_end0-.Ldebug_list_header_start0 # Length
+.Ldebug_list_header_start0:
+ .short 5 # Version
+ .byte 4 # Address size
+ .byte 0 # Segment selector size
+ .long 2 # Offset entry count
+.Lloclists_table_base0:
+ .long .Ldebug_loc0-.Lloclists_table_base0
+ .long .Ldebug_loc1-.Lloclists_table_base0
+.Ldebug_loc0:
+ .byte 4 # DW_LLE_offset_pair
+ .uleb128 .Ltmp4-.Lfunc_begin0 # starting offset
+ .uleb128 .Ltmp9-.Lfunc_begin0 # ending offset
+ .byte 1 # Loc expr size
+ .byte 103 # DW_OP_reg23
+ .byte 4 # DW_LLE_offset_pair
+ .uleb128 .Ltmp9-.Lfunc_begin0 # starting offset
+ .uleb128 .Ltmp14-.Lfunc_begin0 # ending offset
+ .byte 1 # Loc expr size
+ .byte 102 # DW_OP_reg22
+ .byte 4 # DW_LLE_offset_pair
+ .uleb128 .Ltmp14-.Lfunc_begin0 # starting offset
+ .uleb128 .Lfunc_end1-.Lfunc_begin0 # ending offset
+ .byte 1 # Loc expr size
+ .byte 101 # DW_OP_reg21
+ .byte 0 # DW_LLE_end_of_list
+.Ldebug_loc1:
+ .byte 4 # DW_LLE_offset_pair
+ .uleb128 .Ltmp4-.Lfunc_begin0 # starting offset
+ .uleb128 .Ltmp5-.Lfunc_begin0 # ending offset
+ .byte 3 # Loc expr size
+ .byte 17 # DW_OP_consts
+ .byte 0 # 0
+ .byte 159 # DW_OP_stack_value
+ .byte 4 # DW_LLE_offset_pair
+ .uleb128 .Ltmp5-.Lfunc_begin0 # starting offset
+ .uleb128 .Ltmp9-.Lfunc_begin0 # ending offset
+ .byte 3 # Loc expr size
+ .byte 17 # DW_OP_consts
+ .byte 1 # 1
+ .byte 159 # DW_OP_stack_value
+ .byte 4 # DW_LLE_offset_pair
+ .uleb128 .Ltmp9-.Lfunc_begin0 # starting offset
+ .uleb128 .Ltmp10-.Lfunc_begin0 # ending offset
+ .byte 3 # Loc expr size
+ .byte 17 # DW_OP_consts
+ .byte 2 # 2
+ .byte 159 # DW_OP_stack_value
+ .byte 4 # DW_LLE_offset_pair
+ .uleb128 .Ltmp10-.Lfunc_begin0 # starting offset
+ .uleb128 .Ltmp14-.Lfunc_begin0 # ending offset
+ .byte 3 # Loc expr size
+ .byte 17 # DW_OP_consts
+ .byte 3 # 3
+ .byte 159 # DW_OP_stack_value
+ .byte 4 # DW_LLE_offset_pair
+ .uleb128 .Ltmp14-.Lfunc_begin0 # starting offset
+ .uleb128 .Lfunc_end1-.Lfunc_begin0 # ending offset
+ .byte 3 # Loc expr size
+ .byte 17 # DW_OP_consts
+ .byte 4 # 4
+ .byte 159 # DW_OP_stack_value
+ .byte 0 # DW_LLE_end_of_list
+.Ldebug_list_header_end0:
+ .section .debug_abbrev,"", at progbits
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 1 # DW_CHILDREN_yes
+ .byte 37 # DW_AT_producer
+ .byte 37 # DW_FORM_strx1
+ .byte 19 # DW_AT_language
+ .byte 5 # DW_FORM_data2
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 114 # DW_AT_str_offsets_base
+ .byte 23 # DW_FORM_sec_offset
+ .byte 16 # DW_AT_stmt_list
+ .byte 23 # DW_FORM_sec_offset
+ .byte 27 # DW_AT_comp_dir
+ .byte 37 # DW_FORM_strx1
+ .byte 17 # DW_AT_low_pc
+ .byte 27 # DW_FORM_addrx
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 115 # DW_AT_addr_base
+ .byte 23 # DW_FORM_sec_offset
+ .byte 116 # DW_AT_rnglists_base
+ .byte 23 # DW_FORM_sec_offset
+ .ascii "\214\001" # DW_AT_loclists_base
+ .byte 23 # DW_FORM_sec_offset
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 2 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 3 # Abbreviation Code
+ .byte 46 # DW_TAG_subprogram
+ .byte 1 # DW_CHILDREN_yes
+ .byte 17 # DW_AT_low_pc
+ .byte 27 # DW_FORM_addrx
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 64 # DW_AT_frame_base
+ .byte 24 # DW_FORM_exprloc
+ .byte 122 # DW_AT_call_all_calls
+ .byte 25 # DW_FORM_flag_present
+ .byte 49 # DW_AT_abstract_origin
+ .byte 19 # DW_FORM_ref4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 4 # Abbreviation Code
+ .byte 5 # DW_TAG_formal_parameter
+ .byte 0 # DW_CHILDREN_no
+ .byte 2 # DW_AT_location
+ .byte 24 # DW_FORM_exprloc
+ .byte 49 # DW_AT_abstract_origin
+ .byte 19 # DW_FORM_ref4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 5 # Abbreviation Code
+ .byte 46 # DW_TAG_subprogram
+ .byte 1 # DW_CHILDREN_yes
+ .byte 110 # DW_AT_linkage_name
+ .byte 37 # DW_FORM_strx1
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 63 # DW_AT_external
+ .byte 25 # DW_FORM_flag_present
+ .byte 32 # DW_AT_inline
+ .byte 33 # DW_FORM_implicit_const
+ .byte 1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 6 # Abbreviation Code
+ .byte 5 # DW_TAG_formal_parameter
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 7 # Abbreviation Code
+ .byte 46 # DW_TAG_subprogram
+ .byte 1 # DW_CHILDREN_yes
+ .byte 17 # DW_AT_low_pc
+ .byte 27 # DW_FORM_addrx
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 64 # DW_AT_frame_base
+ .byte 24 # DW_FORM_exprloc
+ .byte 122 # DW_AT_call_all_calls
+ .byte 25 # DW_FORM_flag_present
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 63 # DW_AT_external
+ .byte 25 # DW_FORM_flag_present
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 8 # Abbreviation Code
+ .byte 5 # DW_TAG_formal_parameter
+ .byte 0 # DW_CHILDREN_no
+ .byte 2 # DW_AT_location
+ .byte 24 # DW_FORM_exprloc
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 9 # Abbreviation Code
+ .byte 52 # DW_TAG_variable
+ .byte 0 # DW_CHILDREN_no
+ .byte 2 # DW_AT_location
+ .byte 34 # DW_FORM_loclistx
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 10 # Abbreviation Code
+ .byte 11 # DW_TAG_lexical_block
+ .byte 1 # DW_CHILDREN_yes
+ .byte 17 # DW_AT_low_pc
+ .byte 27 # DW_FORM_addrx
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 11 # Abbreviation Code
+ .byte 52 # DW_TAG_variable
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 12 # Abbreviation Code
+ .byte 29 # DW_TAG_inlined_subroutine
+ .byte 0 # DW_CHILDREN_no
+ .byte 49 # DW_AT_abstract_origin
+ .byte 19 # DW_FORM_ref4
+ .byte 85 # DW_AT_ranges
+ .byte 35 # DW_FORM_rnglistx
+ .byte 88 # DW_AT_call_file
+ .byte 11 # DW_FORM_data1
+ .byte 89 # DW_AT_call_line
+ .byte 11 # DW_FORM_data1
+ .byte 87 # DW_AT_call_column
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 13 # Abbreviation Code
+ .byte 15 # DW_TAG_pointer_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+ .section .debug_info,"", at progbits
+.Lcu_begin0:
+ .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+ .short 5 # DWARF version number
+ .byte 1 # DWARF Unit Type
+ .byte 4 # Address Size (in bytes)
+ .long .debug_abbrev # Offset Into Abbrev. Section
+ .byte 1 # Abbrev [1] 0xc:0xb4 DW_TAG_compile_unit
+ .byte 0 # DW_AT_producer
+ .short 33 # DW_AT_language
+ .byte 1 # DW_AT_name
+ .long .Lstr_offsets_base0 # DW_AT_str_offsets_base
+ .long .Lline_table_start0 # DW_AT_stmt_list
+ .byte 2 # DW_AT_comp_dir
+ .byte 0 # DW_AT_low_pc
+ .long .Lfunc_end1-.Lfunc_begin0 # DW_AT_high_pc
+ .long .Laddr_table_base0 # DW_AT_addr_base
+ .long .Lrnglists_table_base0 # DW_AT_rnglists_base
+ .long .Lloclists_table_base0 # DW_AT_loclists_base
+ .byte 2 # Abbrev [2] 0x2b:0x4 DW_TAG_base_type
+ .byte 3 # DW_AT_name
+ .byte 4 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 2 # Abbrev [2] 0x2f:0x4 DW_TAG_base_type
+ .byte 4 # DW_AT_name
+ .byte 5 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 3 # Abbrev [3] 0x33:0x15 DW_TAG_subprogram
+ .byte 0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .byte 1 # DW_AT_frame_base
+ .byte 84
+ # DW_AT_call_all_calls
+ .long 72 # DW_AT_abstract_origin
+ .byte 4 # Abbrev [4] 0x3f:0x8 DW_TAG_formal_parameter
+ .byte 2 # DW_AT_location
+ .byte 145
+ .byte 8
+ .long 81 # DW_AT_abstract_origin
+ .byte 0 # End Of Children Mark
+ .byte 5 # Abbrev [5] 0x48:0x12 DW_TAG_subprogram
+ .byte 5 # DW_AT_linkage_name
+ .byte 6 # DW_AT_name
+ .byte 0 # DW_AT_decl_file
+ .byte 2 # DW_AT_decl_line
+ .long 43 # DW_AT_type
+ # DW_AT_external
+ # DW_AT_inline
+ .byte 6 # Abbrev [6] 0x51:0x8 DW_TAG_formal_parameter
+ .byte 7 # DW_AT_name
+ .byte 0 # DW_AT_decl_file
+ .byte 2 # DW_AT_decl_line
+ .long 43 # DW_AT_type
+ .byte 0 # End Of Children Mark
+ .byte 7 # Abbrev [7] 0x5a:0x57 DW_TAG_subprogram
+ .byte 1 # DW_AT_low_pc
+ .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
+ .byte 1 # DW_AT_frame_base
+ .byte 84
+ # DW_AT_call_all_calls
+ .byte 8 # DW_AT_name
+ .byte 0 # DW_AT_decl_file
+ .byte 6 # DW_AT_decl_line
+ .long 47 # DW_AT_type
+ # DW_AT_external
+ .byte 8 # Abbrev [8] 0x69:0xb DW_TAG_formal_parameter
+ .byte 2 # DW_AT_location
+ .byte 145
+ .byte 4
+ .byte 9 # DW_AT_name
+ .byte 0 # DW_AT_decl_file
+ .byte 6 # DW_AT_decl_line
+ .long 47 # DW_AT_type
+ .byte 8 # Abbrev [8] 0x74:0xb DW_TAG_formal_parameter
+ .byte 2 # DW_AT_location
+ .byte 145
+ .byte 8
+ .byte 10 # DW_AT_name
+ .byte 0 # DW_AT_decl_file
+ .byte 6 # DW_AT_decl_line
+ .long 177 # DW_AT_type
+ .byte 9 # Abbrev [9] 0x7f:0x9 DW_TAG_variable
+ .byte 0 # DW_AT_location
+ .byte 12 # DW_AT_name
+ .byte 0 # DW_AT_decl_file
+ .byte 7 # DW_AT_decl_line
+ .long 43 # DW_AT_type
+ .byte 10 # Abbrev [10] 0x88:0x28 DW_TAG_lexical_block
+ .byte 2 # DW_AT_low_pc
+ .long .Ltmp14-.Ltmp4 # DW_AT_high_pc
+ .byte 9 # Abbrev [9] 0x8e:0x9 DW_TAG_variable
+ .byte 1 # DW_AT_location
+ .byte 13 # DW_AT_name
+ .byte 0 # DW_AT_decl_file
+ .byte 8 # DW_AT_decl_line
+ .long 47 # DW_AT_type
+ .byte 10 # Abbrev [10] 0x97:0x18 DW_TAG_lexical_block
+ .byte 2 # DW_AT_low_pc
+ .long .Ltmp14-.Ltmp4 # DW_AT_high_pc
+ .byte 11 # Abbrev [11] 0x9d:0x8 DW_TAG_variable
+ .byte 14 # DW_AT_name
+ .byte 0 # DW_AT_decl_file
+ .byte 9 # DW_AT_decl_line
+ .long 43 # DW_AT_type
+ .byte 12 # Abbrev [12] 0xa5:0x9 DW_TAG_inlined_subroutine
+ .long 72 # DW_AT_abstract_origin
+ .byte 0 # DW_AT_ranges
+ .byte 0 # DW_AT_call_file
+ .byte 10 # DW_AT_call_line
+ .byte 15 # DW_AT_call_column
+ .byte 0 # End Of Children Mark
+ .byte 0 # End Of Children Mark
+ .byte 0 # End Of Children Mark
+ .byte 13 # Abbrev [13] 0xb1:0x5 DW_TAG_pointer_type
+ .long 182 # DW_AT_type
+ .byte 13 # Abbrev [13] 0xb6:0x5 DW_TAG_pointer_type
+ .long 187 # DW_AT_type
+ .byte 2 # Abbrev [2] 0xbb:0x4 DW_TAG_base_type
+ .byte 11 # DW_AT_name
+ .byte 6 # DW_AT_encoding
+ .byte 1 # DW_AT_byte_size
+ .byte 0 # End Of Children Mark
+.Ldebug_info_end0:
+ .section .debug_rnglists,"", at progbits
+ .long .Ldebug_list_header_end1-.Ldebug_list_header_start1 # Length
+.Ldebug_list_header_start1:
+ .short 5 # Version
+ .byte 4 # Address size
+ .byte 0 # Segment selector size
+ .long 1 # Offset entry count
+.Lrnglists_table_base0:
+ .long .Ldebug_ranges0-.Lrnglists_table_base0
+.Ldebug_ranges0:
+ .byte 4 # DW_RLE_offset_pair
+ .uleb128 .Ltmp6-.Lfunc_begin0 # starting offset
+ .uleb128 .Ltmp7-.Lfunc_begin0 # ending offset
+ .byte 4 # DW_RLE_offset_pair
+ .uleb128 .Ltmp11-.Lfunc_begin0 # starting offset
+ .uleb128 .Ltmp12-.Lfunc_begin0 # ending offset
+ .byte 0 # DW_RLE_end_of_list
+.Ldebug_list_header_end1:
+ .section .debug_str_offsets,"", at progbits
+ .long 64 # Length of String Offsets Set
+ .short 5
+ .short 0
+.Lstr_offsets_base0:
+ .section .debug_str,"MS", at progbits,1
+.Linfo_string0:
+ .asciz "clang version 22.0.0" # string offset=0
+.Linfo_string1:
+ .asciz "test.cpp" # string offset=113
+.Linfo_string2:
+ .asciz "F:\\llvm-project" # string offset=143
+.Linfo_string3:
+ .asciz "float" # string offset=159
+.Linfo_string4:
+ .asciz "int" # string offset=165
+.Linfo_string5:
+ .asciz "_Z3foof" # string offset=169
+.Linfo_string6:
+ .asciz "foo" # string offset=177
+.Linfo_string7:
+ .asciz "a" # string offset=181
+.Linfo_string8:
+ .asciz "main" # string offset=183
+.Linfo_string9:
+ .asciz "argc" # string offset=188
+.Linfo_string10:
+ .asciz "argv" # string offset=193
+.Linfo_string11:
+ .asciz "char" # string offset=198
+.Linfo_string12:
+ .asciz "my_var" # string offset=203
+.Linfo_string13:
+ .asciz "i" # string offset=210
+.Linfo_string14:
+ .asciz "my_local_var" # string offset=212
+ .section .debug_str_offsets,"", at progbits
+ .long .Linfo_string0
+ .long .Linfo_string1
+ .long .Linfo_string2
+ .long .Linfo_string3
+ .long .Linfo_string4
+ .long .Linfo_string5
+ .long .Linfo_string6
+ .long .Linfo_string7
+ .long .Linfo_string8
+ .long .Linfo_string9
+ .long .Linfo_string10
+ .long .Linfo_string11
+ .long .Linfo_string12
+ .long .Linfo_string13
+ .long .Linfo_string14
+ .section .debug_addr,"", at progbits
+ .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
+.Ldebug_addr_start0:
+ .short 5 # DWARF version number
+ .byte 4 # Address size
+ .byte 0 # Segment selector size
+.Laddr_table_base0:
+ .long .Lfunc_begin0
+ .long .Lfunc_begin1
+ .long .Ltmp4
+.Ldebug_addr_end0:
+ .ident "clang version 22.0.0"
+ .section ".note.GNU-stack","", at progbits
+ .section .debug_line,"", at progbits
+.Lline_table_start0:
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/amdgpu-ranges.s b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/amdgpu-ranges.s
new file mode 100644
index 0000000000000..695c3cef72fdc
--- /dev/null
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/amdgpu-ranges.s
@@ -0,0 +1,654 @@
+# REQUIRES: 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-mc %s --mcpu=gfx1100 -triple=amdgcn-amd-amdpal -filetype=obj -o - | \
+# RUN: llvm-debuginfo-analyzer --attribute=all \
+# RUN: --print=all \
+# RUN: --output-sort=offset \
+# RUN: - 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]
+# CHECK: [0x0000000114][003]
+
+ .file 0 "test.hlsl"
+ .text
+ .globl _amdgpu_cs_main
+ .p2align 8
+ .type _amdgpu_cs_main, at function
+_amdgpu_cs_main:
+.Lfunc_begin0:
+ .loc 0 6 0
+ .cfi_sections .debug_frame
+ .cfi_startproc
+ v_writelane_b32 v1, s4, 0
+ s_mov_b32 s0, s2
+ s_mov_b32 s4, s1
+ v_readlane_b32 s1, v1, 0
+ s_mov_b32 s8, s0
+.Ltmp0:
+ .loc 0 6 24 prologue_end
+ s_getpc_b64 s[2:3]
+ s_mov_b32 s1, 0x3ff
+ v_and_b32_e64 v0, v0, s1
+ s_mov_b32 s1, 6
+ v_lshl_add_u32 v0, s0, s1, v0
+ scratch_store_b32 off, v0, off offset:4
+.Ltmp1:
+ .loc 0 0 24 is_stmt 0
+ s_mov_b32 s1, -1
+ s_mov_b32 s0, 0
+ s_mov_b32 s6, s0
+ s_mov_b32 s7, s1
+ .loc 0 7 25 is_stmt 1
+ s_and_b64 s[2:3], s[2:3], s[6:7]
+ s_mov_b32 s1, 0
+ s_mov_b32 s5, s1
+ s_or_b64 s[2:3], s[2:3], s[4:5]
+ v_writelane_b32 v1, s2, 1
+ v_writelane_b32 v1, s3, 2
+.Ltmp2:
+ s_load_b128 s[4:7], s[2:3], 0x0
+ s_waitcnt lgkmcnt(0)
+ buffer_load_format_x v0, v0, s[4:7], s0 idxen
+.Ltmp3:
+ .loc 0 9 10
+ s_waitcnt vmcnt(0)
+ scratch_store_b32 off, v0, off
+.Ltmp4:
+ v_writelane_b32 v1, s0, 3
+.Ltmp5:
+.LBB0_1:
+ .loc 0 0 10 is_stmt 0
+ v_readlane_b32 s0, v1, 3
+ scratch_load_b32 v0, off, off
+.Ltmp6:
+ s_mov_b32 s1, 1
+.Ltmp7:
+ .loc 0 10 34 is_stmt 1
+ s_lshl_b32 s2, s0, s1
+ .loc 0 10 33 is_stmt 0
+ v_cvt_f32_u32_e64 v2, s2
+.Ltmp8:
+ .loc 0 11 19 is_stmt 1
+ s_waitcnt vmcnt(0)
+ v_add_f32_e64 v0, v0, v2
+.Ltmp9:
+ .loc 0 9 35
+ s_add_i32 s0, s0, s1
+.Ltmp10:
+ .loc 0 0 35 is_stmt 0
+ s_mov_b32 s1, 10
+ .loc 0 9 28
+ s_cmp_lg_u32 s0, s1
+ v_mov_b32_e32 v2, v0
+.Ltmp11:
+ .loc 0 0 28
+ scratch_store_b32 off, v2, off
+ v_writelane_b32 v1, s0, 3
+.Ltmp12:
+ .loc 0 9 10
+ scratch_store_b32 off, v0, off offset:8
+.Ltmp13:
+ s_cbranch_scc1 .LBB0_1
+.Ltmp14:
+ .loc 0 11 19 is_stmt 1
+ v_readlane_b32 s0, v1, 1
+.Ltmp15:
+ v_readlane_b32 s1, v1, 2
+ scratch_load_b32 v0, off, off offset:4
+ scratch_load_b32 v6, off, off offset:8
+.Ltmp16:
+ .loc 0 13 21
+ s_waitcnt vmcnt(0)
+ v_mov_b32_e32 v2, v6
+ v_mov_b32_e32 v3, v6
+ v_mov_b32_e32 v4, v6
+ v_mov_b32_e32 v5, v6
+ s_load_b128 s[0:3], s[0:1], 0x20
+ s_mov_b32 s4, 0
+ s_waitcnt lgkmcnt(0)
+ buffer_store_format_xyzw v[2:5], v0, s[0:3], s4 idxen
+ .loc 0 14 8
+ s_endpgm
+.Ltmp17:
+.Lfunc_end0:
+ .size _amdgpu_cs_main, .Lfunc_end0-_amdgpu_cs_main
+ .cfi_endproc
+
+ .set _amdgpu_cs_main.num_vgpr, 7
+ .set _amdgpu_cs_main.num_agpr, 0
+ .set _amdgpu_cs_main.numbered_sgpr, 11
+ .set _amdgpu_cs_main.num_named_barrier, 0
+ .set _amdgpu_cs_main.private_seg_size, 16
+ .set _amdgpu_cs_main.uses_vcc, 0
+ .set _amdgpu_cs_main.uses_flat_scratch, 0
+ .set _amdgpu_cs_main.has_dyn_sized_stack, 0
+ .set _amdgpu_cs_main.has_recursion, 0
+ .set _amdgpu_cs_main.has_indirect_call, 0
+ .set _amdgpu_cs_main.num_vgpr_rank_sum, 0
+ .p2alignl 7, 3214868480
+ .fill 96, 4, 3214868480
+ .section .AMDGPU.gpr_maximums,"", at progbits
+ .set amdgpu.max_num_vgpr, 0
+ .set amdgpu.max_num_agpr, 0
+ .set amdgpu.max_num_sgpr, 0
+ .text
+ .section .debug_loclists,"", at progbits
+ .long .Ldebug_list_header_end0-.Ldebug_list_header_start0
+.Ldebug_list_header_start0:
+ .short 5
+ .byte 8
+ .byte 0
+ .long 4
+.Lloclists_table_base0:
+ .long .Ldebug_loc0-.Lloclists_table_base0
+ .long .Ldebug_loc1-.Lloclists_table_base0
+ .long .Ldebug_loc2-.Lloclists_table_base0
+ .long .Ldebug_loc3-.Lloclists_table_base0
+.Ldebug_loc0:
+ .byte 4
+ .uleb128 .Ltmp1-.Lfunc_begin0
+ .uleb128 .Ltmp3-.Lfunc_begin0
+ .byte 5
+ .byte 144
+ .byte 128
+ .byte 20
+ .byte 147
+ .byte 4
+ .byte 0
+.Ldebug_loc1:
+ .byte 4
+ .uleb128 .Ltmp3-.Lfunc_begin0
+ .uleb128 .Ltmp4-.Lfunc_begin0
+ .byte 3
+ .byte 144
+ .byte 128
+ .byte 20
+ .byte 4
+ .uleb128 .Ltmp6-.Lfunc_begin0
+ .uleb128 .Ltmp13-.Lfunc_begin0
+ .byte 3
+ .byte 144
+ .byte 128
+ .byte 20
+ .byte 4
+ .uleb128 .Ltmp16-.Lfunc_begin0
+ .uleb128 .Lfunc_end0-.Lfunc_begin0
+ .byte 3
+ .byte 144
+ .byte 134
+ .byte 20
+ .byte 0
+.Ldebug_loc2:
+ .byte 4
+ .uleb128 .Ltmp2-.Lfunc_begin0
+ .uleb128 .Ltmp5-.Lfunc_begin0
+ .byte 3
+ .byte 17
+ .byte 0
+ .byte 159
+ .byte 4
+ .uleb128 .Ltmp6-.Lfunc_begin0
+ .uleb128 .Ltmp15-.Lfunc_begin0
+ .byte 2
+ .byte 144
+ .byte 32
+ .byte 0
+.Ldebug_loc3:
+ .byte 4
+ .uleb128 .Ltmp8-.Lfunc_begin0
+ .uleb128 .Ltmp11-.Lfunc_begin0
+ .byte 3
+ .byte 144
+ .byte 130
+ .byte 20
+ .byte 0
+.Ldebug_list_header_end0:
+ .section .debug_abbrev,"", at progbits
+ .byte 1
+ .byte 17
+ .byte 1
+ .byte 37
+ .byte 37
+ .byte 19
+ .byte 5
+ .byte 3
+ .byte 37
+ .byte 114
+ .byte 23
+ .byte 16
+ .byte 23
+ .byte 17
+ .byte 27
+ .byte 18
+ .byte 6
+ .byte 115
+ .byte 23
+ .byte 116
+ .byte 23
+ .ascii "\214\001"
+ .byte 23
+ .byte 0
+ .byte 0
+ .byte 2
+ .byte 52
+ .byte 0
+ .byte 3
+ .byte 37
+ .byte 73
+ .byte 19
+ .byte 63
+ .byte 25
+ .byte 58
+ .byte 11
+ .byte 59
+ .byte 11
+ .byte 110
+ .byte 37
+ .byte 0
+ .byte 0
+ .byte 3
+ .byte 2
+ .byte 1
+ .byte 3
+ .byte 37
+ .byte 11
+ .byte 11
+ .byte 58
+ .byte 11
+ .byte 59
+ .byte 11
+ .ascii "\210\001"
+ .byte 15
+ .byte 0
+ .byte 0
+ .byte 4
+ .byte 47
+ .byte 0
+ .byte 73
+ .byte 19
+ .byte 3
+ .byte 37
+ .byte 0
+ .byte 0
+ .byte 5
+ .byte 36
+ .byte 0
+ .byte 3
+ .byte 37
+ .byte 62
+ .byte 11
+ .byte 11
+ .byte 11
+ .byte 0
+ .byte 0
+ .byte 6
+ .byte 46
+ .byte 1
+ .byte 17
+ .byte 27
+ .byte 18
+ .byte 6
+ .byte 3
+ .byte 37
+ .byte 58
+ .byte 11
+ .byte 59
+ .byte 11
+ .byte 63
+ .byte 25
+ .byte 0
+ .byte 0
+ .byte 7
+ .byte 5
+ .byte 0
+ .byte 2
+ .byte 34
+ .byte 3
+ .byte 37
+ .byte 58
+ .byte 11
+ .byte 59
+ .byte 11
+ .byte 73
+ .byte 19
+ .byte 0
+ .byte 0
+ .byte 8
+ .byte 52
+ .byte 0
+ .byte 2
+ .byte 34
+ .byte 3
+ .byte 37
+ .byte 58
+ .byte 11
+ .byte 59
+ .byte 11
+ .byte 73
+ .byte 19
+ .byte 0
+ .byte 0
+ .byte 9
+ .byte 11
+ .byte 1
+ .byte 17
+ .byte 27
+ .byte 18
+ .byte 6
+ .byte 0
+ .byte 0
+ .byte 10
+ .byte 11
+ .byte 1
+ .byte 85
+ .byte 35
+ .byte 0
+ .byte 0
+ .byte 11
+ .byte 22
+ .byte 0
+ .byte 73
+ .byte 19
+ .byte 3
+ .byte 37
+ .byte 0
+ .byte 0
+ .byte 12
+ .byte 2
+ .byte 1
+ .byte 3
+ .byte 37
+ .byte 11
+ .byte 11
+ .ascii "\210\001"
+ .byte 15
+ .byte 0
+ .byte 0
+ .byte 13
+ .byte 48
+ .byte 0
+ .byte 73
+ .byte 19
+ .byte 3
+ .byte 37
+ .byte 28
+ .byte 13
+ .byte 0
+ .byte 0
+ .byte 14
+ .byte 13
+ .byte 0
+ .byte 3
+ .byte 37
+ .byte 73
+ .byte 19
+ .ascii "\210\001"
+ .byte 15
+ .byte 56
+ .byte 11
+ .byte 50
+ .byte 11
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_info,"", at progbits
+.Lcu_begin0:
+ .long .Ldebug_info_end0-.Ldebug_info_start0
+.Ldebug_info_start0:
+ .short 5
+ .byte 1
+ .byte 8
+ .long .debug_abbrev
+ .byte 1
+ .byte 0
+ .short 4
+ .byte 1
+ .long .Lstr_offsets_base0
+ .long .Lline_table_start0
+ .byte 0
+ .long .Lfunc_end0-.Lfunc_begin0
+ .long .Laddr_table_base0
+ .long .Lrnglists_table_base0
+ .long .Lloclists_table_base0
+ .byte 2
+ .byte 2
+ .long 51
+
+ .byte 0
+ .byte 1
+ .byte 6
+ .byte 3
+ .byte 5
+ .byte 4
+ .byte 0
+ .byte 1
+ .byte 4
+ .byte 4
+ .long 64
+ .byte 4
+ .byte 0
+ .byte 5
+ .byte 3
+ .byte 4
+ .byte 4
+ .byte 2
+ .byte 7
+ .long 51
+
+ .byte 0
+ .byte 2
+ .byte 8
+ .byte 6
+ .byte 0
+ .long .Lfunc_end0-.Lfunc_begin0
+ .byte 9
+ .byte 0
+ .byte 6
+
+ .byte 7
+ .byte 0
+ .byte 10
+ .byte 0
+ .byte 6
+ .long 133
+ .byte 8
+ .byte 1
+ .byte 19
+ .byte 0
+ .byte 7
+ .long 64
+ .byte 9
+ .byte 1
+ .long .Ltmp16-.Ltmp3
+ .byte 8
+ .byte 2
+ .byte 20
+ .byte 0
+ .byte 9
+ .long 188
+ .byte 10
+ .byte 0
+ .byte 8
+ .byte 3
+ .byte 21
+ .byte 0
+ .byte 10
+ .long 64
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 11
+ .long 139
+ .byte 18
+ .byte 12
+ .byte 17
+ .byte 12
+ .byte 4
+ .byte 4
+ .long 184
+ .byte 4
+ .byte 13
+ .long 188
+ .byte 13
+ .byte 3
+ .byte 14
+ .byte 14
+ .long 184
+ .byte 4
+ .byte 0
+ .byte 1
+ .byte 14
+ .byte 15
+ .long 184
+ .byte 4
+ .byte 4
+ .byte 1
+ .byte 14
+ .byte 16
+ .long 184
+ .byte 4
+ .byte 8
+ .byte 1
+ .byte 0
+ .byte 5
+ .byte 11
+ .byte 7
+ .byte 4
+ .byte 5
+ .byte 12
+ .byte 5
+ .byte 4
+ .byte 0
+.Ldebug_info_end0:
+ .section .debug_rnglists,"", at progbits
+ .long .Ldebug_list_header_end1-.Ldebug_list_header_start1
+.Ldebug_list_header_start1:
+ .short 5
+ .byte 8
+ .byte 0
+ .long 1
+.Lrnglists_table_base0:
+ .long .Ldebug_ranges0-.Lrnglists_table_base0
+.Ldebug_ranges0:
+ .byte 4
+ .uleb128 .Ltmp7-.Lfunc_begin0
+ .uleb128 .Ltmp9-.Lfunc_begin0
+ .byte 4
+ .uleb128 .Ltmp14-.Lfunc_begin0
+ .uleb128 .Ltmp16-.Lfunc_begin0
+ .byte 0
+.Ldebug_list_header_end1:
+ .section .debug_str_offsets,"", at progbits
+ .long 92
+ .short 5
+ .short 0
+.Lstr_offsets_base0:
+ .section .debug_str,"MS", at progbits,1
+.Linfo_string0:
+ .asciz "dxc"
+.Linfo_string1:
+ .asciz "test.hlsl"
+.Linfo_string2:
+ .asciz "u0"
+.Linfo_string3:
+ .asciz "RWBuffer<float>"
+.Linfo_string4:
+ .asciz "float"
+.Linfo_string5:
+ .asciz "element"
+.Linfo_string6:
+ .asciz "?u0@@3V?$RWBuffer at M@@A"
+.Linfo_string7:
+ .asciz "u1"
+.Linfo_string8:
+ .asciz "?u1@@3V?$RWBuffer at M@@A"
+.Linfo_string9:
+ .asciz "main"
+.Linfo_string10:
+ .asciz "dtid"
+.Linfo_string11:
+ .asciz "uint3"
+.Linfo_string12:
+ .asciz "vector<unsigned int, 3>"
+.Linfo_string13:
+ .asciz "unsigned int"
+.Linfo_string14:
+ .asciz "int"
+.Linfo_string15:
+ .asciz "element_count"
+.Linfo_string16:
+ .asciz "x"
+.Linfo_string17:
+ .asciz "y"
+.Linfo_string18:
+ .asciz "z"
+.Linfo_string19:
+ .asciz "my_var"
+.Linfo_string20:
+ .asciz "i"
+.Linfo_string21:
+ .asciz "my_local_var"
+ .section .debug_str_offsets,"", at progbits
+ .long .Linfo_string0
+ .long .Linfo_string1
+ .long .Linfo_string2
+ .long .Linfo_string4
+ .long .Linfo_string5
+ .long .Linfo_string3
+ .long .Linfo_string6
+ .long .Linfo_string7
+ .long .Linfo_string8
+ .long .Linfo_string9
+ .long .Linfo_string10
+ .long .Linfo_string13
+ .long .Linfo_string14
+ .long .Linfo_string15
+ .long .Linfo_string16
+ .long .Linfo_string17
+ .long .Linfo_string18
+ .long .Linfo_string12
+ .long .Linfo_string11
+ .long .Linfo_string19
+ .long .Linfo_string20
+ .long .Linfo_string21
+ .section .debug_addr,"", at progbits
+ .long .Ldebug_addr_end0-.Ldebug_addr_start0
+.Ldebug_addr_start0:
+ .short 5
+ .byte 8
+ .byte 0
+.Laddr_table_base0:
+ .quad .Lfunc_begin0
+ .quad .Ltmp3
+.Ldebug_addr_end0:
+ .section .debug_names,"", at progbits
+ .section ".note.GNU-stack","", at progbits
+ .section .debug_line,"", at progbits
+.Lline_table_start0:
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/high_pc_exclusive.s b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/high_pc_exclusive.s
new file mode 100644
index 0000000000000..efba25c46ae67
--- /dev/null
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/high_pc_exclusive.s
@@ -0,0 +1,276 @@
+# Regression test for:
+# - Instructions at DW_AT_high_pc of a scope incorrectly included in the scope
+
+# clang test.cpp --target=i686-pc-linux -g -O0
+# 1
+# 2 int main(void) {
+# 3 float ret = 0;
+# 4 for (int i = 0; i < 10; i++) {
+# 5 ret += i;
+# 6 }
+# 7 return ret;
+# 8 }
+# 9
+
+# RUN: llvm-mc %s -triple=i686-pc-linux -filetype=obj -o - | \
+# RUN: llvm-debuginfo-analyzer --attribute=all \
+# RUN: --print=all \
+# RUN: --output-sort=offset \
+# RUN: - | \
+# RUN: FileCheck %s
+
+# Make sure the line mapping at 0x3c does not show up at the scope level 004
+# CHECK-NOT: [0x000000003c][004] 7 {Line}
+
+# Make sure it *does* appear at scope level 003
+# CHECK: [0x000000003c][003] 7 {Line}
+
+ .file "compile.cpp"
+ .text
+ .globl main # -- Begin function main
+ .p2align 4
+ .type main, at function
+main: # @main
+.Lfunc_begin0:
+ .file 0 "test.cpp"
+ .loc 0 2 0
+ .cfi_startproc
+# %bb.0: # %entry
+ pushl %ebp
+ .cfi_def_cfa_offset 8
+ .cfi_offset %ebp, -8
+ movl %esp, %ebp
+ .cfi_def_cfa_register %ebp
+ subl $12, %esp
+ movl $0, -4(%ebp)
+.Ltmp0:
+ .loc 0 3 15 prologue_end
+ xorps %xmm0, %xmm0
+ movss %xmm0, -8(%ebp)
+.Ltmp1:
+ .loc 0 4 18
+ movl $0, -12(%ebp)
+.LBB0_1: # %for.cond
+ # =>This Inner Loop Header: Depth=1
+.Ltmp2:
+ .loc 0 4 27 is_stmt 0
+ cmpl $10, -12(%ebp)
+.Ltmp3:
+ .loc 0 4 9
+ jge .LBB0_4
+# %bb.2: # %for.body
+ # in Loop: Header=BB0_1 Depth=1
+.Ltmp4:
+ .loc 0 5 18 is_stmt 1
+ cvtsi2ssl -12(%ebp), %xmm0
+ .loc 0 5 15 is_stmt 0
+ addss -8(%ebp), %xmm0
+ movss %xmm0, -8(%ebp)
+.Ltmp5:
+# %bb.3: # %for.inc
+ # in Loop: Header=BB0_1 Depth=1
+ .loc 0 4 34 is_stmt 1
+ movl -12(%ebp), %eax
+ addl $1, %eax
+ movl %eax, -12(%ebp)
+ .loc 0 4 9 is_stmt 0
+ jmp .LBB0_1
+.Ltmp6:
+.LBB0_4: # %for.end
+ .loc 0 7 16 is_stmt 1
+ cvttss2si -8(%ebp), %eax
+ .loc 0 7 9 epilogue_begin is_stmt 0
+ addl $12, %esp
+ popl %ebp
+ .cfi_def_cfa %esp, 4
+ retl
+.Ltmp7:
+.Lfunc_end0:
+ .size main, .Lfunc_end0-main
+ .cfi_endproc
+ # -- End function
+ .section .debug_abbrev,"", at progbits
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 1 # DW_CHILDREN_yes
+ .byte 37 # DW_AT_producer
+ .byte 37 # DW_FORM_strx1
+ .byte 19 # DW_AT_language
+ .byte 5 # DW_FORM_data2
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 114 # DW_AT_str_offsets_base
+ .byte 23 # DW_FORM_sec_offset
+ .byte 16 # DW_AT_stmt_list
+ .byte 23 # DW_FORM_sec_offset
+ .byte 27 # DW_AT_comp_dir
+ .byte 37 # DW_FORM_strx1
+ .byte 17 # DW_AT_low_pc
+ .byte 27 # DW_FORM_addrx
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 115 # DW_AT_addr_base
+ .byte 23 # DW_FORM_sec_offset
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 2 # Abbreviation Code
+ .byte 46 # DW_TAG_subprogram
+ .byte 1 # DW_CHILDREN_yes
+ .byte 17 # DW_AT_low_pc
+ .byte 27 # DW_FORM_addrx
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 64 # DW_AT_frame_base
+ .byte 24 # DW_FORM_exprloc
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 63 # DW_AT_external
+ .byte 25 # DW_FORM_flag_present
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 3 # Abbreviation Code
+ .byte 52 # DW_TAG_variable
+ .byte 0 # DW_CHILDREN_no
+ .byte 2 # DW_AT_location
+ .byte 24 # DW_FORM_exprloc
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 4 # Abbreviation Code
+ .byte 11 # DW_TAG_lexical_block
+ .byte 1 # DW_CHILDREN_yes
+ .byte 17 # DW_AT_low_pc
+ .byte 27 # DW_FORM_addrx
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 5 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 37 # DW_FORM_strx1
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+ .section .debug_info,"", at progbits
+.Lcu_begin0:
+ .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+ .short 5 # DWARF version number
+ .byte 1 # DWARF Unit Type
+ .byte 4 # Address Size (in bytes)
+ .long .debug_abbrev # Offset Into Abbrev. Section
+ .byte 1 # Abbrev [1] 0xc:0x4d DW_TAG_compile_unit
+ .byte 0 # DW_AT_producer
+ .short 33 # DW_AT_language
+ .byte 1 # DW_AT_name
+ .long .Lstr_offsets_base0 # DW_AT_str_offsets_base
+ .long .Lline_table_start0 # DW_AT_stmt_list
+ .byte 2 # DW_AT_comp_dir
+ .byte 0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .long .Laddr_table_base0 # DW_AT_addr_base
+ .byte 2 # Abbrev [2] 0x23:0x2d DW_TAG_subprogram
+ .byte 0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .byte 1 # DW_AT_frame_base
+ .byte 85
+ .byte 3 # DW_AT_name
+ .byte 0 # DW_AT_decl_file
+ .byte 2 # DW_AT_decl_line
+ .long 80 # DW_AT_type
+ # DW_AT_external
+ .byte 3 # Abbrev [3] 0x32:0xb DW_TAG_variable
+ .byte 2 # DW_AT_location
+ .byte 145
+ .byte 120
+ .byte 5 # DW_AT_name
+ .byte 0 # DW_AT_decl_file
+ .byte 3 # DW_AT_decl_line
+ .long 84 # DW_AT_type
+ .byte 4 # Abbrev [4] 0x3d:0x12 DW_TAG_lexical_block
+ .byte 1 # DW_AT_low_pc
+ .long .Ltmp6-.Ltmp1 # DW_AT_high_pc
+ .byte 3 # Abbrev [3] 0x43:0xb DW_TAG_variable
+ .byte 2 # DW_AT_location
+ .byte 145
+ .byte 116
+ .byte 7 # DW_AT_name
+ .byte 0 # DW_AT_decl_file
+ .byte 4 # DW_AT_decl_line
+ .long 80 # DW_AT_type
+ .byte 0 # End Of Children Mark
+ .byte 0 # End Of Children Mark
+ .byte 5 # Abbrev [5] 0x50:0x4 DW_TAG_base_type
+ .byte 4 # DW_AT_name
+ .byte 5 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 5 # Abbrev [5] 0x54:0x4 DW_TAG_base_type
+ .byte 6 # DW_AT_name
+ .byte 4 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 0 # End Of Children Mark
+.Ldebug_info_end0:
+ .section .debug_str_offsets,"", at progbits
+ .long 36 # Length of String Offsets Set
+ .short 5
+ .short 0
+.Lstr_offsets_base0:
+ .section .debug_str,"MS", at progbits,1
+.Linfo_string0:
+ .asciz "clang version 22.0.0" # string offset=0
+.Linfo_string1:
+ .asciz "test.cpp" # string offset=113
+.Linfo_string2:
+ .asciz "F:\\llvm-project" # string offset=142
+.Linfo_string3:
+ .asciz "main" # string offset=158
+.Linfo_string4:
+ .asciz "int" # string offset=163
+.Linfo_string5:
+ .asciz "ret" # string offset=167
+.Linfo_string6:
+ .asciz "float" # string offset=171
+.Linfo_string7:
+ .asciz "i" # string offset=177
+ .section .debug_str_offsets,"", at progbits
+ .long .Linfo_string0
+ .long .Linfo_string1
+ .long .Linfo_string2
+ .long .Linfo_string3
+ .long .Linfo_string4
+ .long .Linfo_string5
+ .long .Linfo_string6
+ .long .Linfo_string7
+ .section .debug_addr,"", at progbits
+ .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
+.Ldebug_addr_start0:
+ .short 5 # DWARF version number
+ .byte 4 # Address size
+ .byte 0 # Segment selector size
+.Laddr_table_base0:
+ .long .Lfunc_begin0
+ .long .Ltmp1
+.Ldebug_addr_end0:
+ .ident "clang version 22.0.0"
+ .section ".note.GNU-stack","", at progbits
+ .section .debug_line,"", at progbits
+.Lline_table_start0:
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: [0x0000000062][004] {Code} 'br 1'
-; ONE-NEXT: [0x0000000064][004] 0 {Line} '{{.*}}/general/test.cpp'
-; ONE-NEXT: [0x0000000064][004] {Code} 'end'
; ONE-NEXT: [0x000000005e][003] 2 {Parameter} 'ParamBool' -> [0x00000000b3]'bool'
; ONE-NEXT: [0x000000005e][004] {Coverage} 100.00%
; ONE-NEXT: [0x000000005f][004] {Location}
@@ -118,6 +116,8 @@
; ONE-NEXT: [0x0000000047][003] {Code} 'local.get 9'
; ONE-NEXT: [0x0000000049][003] {Code} 'i32.eqz'
; ONE-NEXT: [0x000000004a][003] {Code} 'br_if 0'
+; ONE-NEXT: [0x0000000064][003] 0 {Line} '{{.*}}/general/test.cpp'
+; ONE-NEXT: [0x0000000064][003] {Code} 'end'
; ONE-NEXT: [0x0000000065][003] 8 {Line} {NewStatement} '{{.*}}/general/test.cpp'
; ONE-NEXT: [0x0000000065][003] {Code} 'local.get 5'
; ONE-NEXT: [0x0000000067][003] {Code} 'i32.load 20'
@@ -135,8 +135,8 @@
; ONE-NEXT: [0x000000007b][003] {Code} 'local.get 13'
; ONE-NEXT: [0x000000007d][003] {Code} 'return'
; ONE-NEXT: [0x000000007e][003] {Code} 'end'
-; ONE-NEXT: [0x000000007f][003] 9 {Line} {NewStatement} {EndSequence} '{{.*}}/general/test.cpp'
-; ONE-NEXT: [0x000000007f][003] {Code} 'unreachable'
+; ONE-NEXT: [0x000000007f][002] 9 {Line} {NewStatement} {EndSequence} '{{.*}}/general/test.cpp'
+; ONE-NEXT: [0x000000007f][002] {Code} 'unreachable'
; ONE-EMPTY:
; ONE-NEXT: -----------------------------
; ONE-NEXT: Element Total Printed
diff --git a/llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp b/llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp
index 544c39a3c7b2e..78dc8502e9676 100644
--- a/llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp
+++ b/llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp
@@ -81,7 +81,7 @@ void checkElementProperties(LVReader *Reader) {
EXPECT_EQ(Language, LVSourceLanguage::DW_LANG_C_plus_plus_14);
EXPECT_EQ(Language.getName(), "DW_LANG_C_plus_plus_14");
- EXPECT_EQ(CompileUnit->lineCount(), 0u);
+ EXPECT_EQ(CompileUnit->lineCount(), 1u);
EXPECT_EQ(CompileUnit->scopeCount(), 1u);
EXPECT_EQ(CompileUnit->symbolCount(), 0u);
EXPECT_EQ(CompileUnit->typeCount(), 7u);
@@ -129,7 +129,7 @@ void checkElementProperties(LVReader *Reader) {
// Lines (debug and assembler) for 'foo'.
const LVLines *Lines = Function->getLines();
ASSERT_NE(Lines, nullptr);
- ASSERT_EQ(Lines->size(), 0x12u);
+ ASSERT_EQ(Lines->size(), 19u);
// Check size of types in CompileUnit.
const LVTypes *Types = CompileUnit->getTypes();
@@ -252,7 +252,7 @@ void checkElementComparison(LVReader *Reference, LVReader *Target) {
// Get comparison table.
LVPassTable PassTable = Compare.getPassTable();
- ASSERT_EQ(PassTable.size(), 5u);
+ ASSERT_EQ(PassTable.size(), 4u);
LVReader *Reader;
LVElement *Element;
@@ -278,18 +278,8 @@ void checkElementComparison(LVReader *Reference, LVReader *Target) {
EXPECT_EQ(Element->getName(), "INTEGER");
EXPECT_EQ(Pass, LVComparePass::Missing);
- // Reference: Missing DebugLine
- std::tie(Reader, Element, Pass) = PassTable[2];
- ASSERT_NE(Reader, nullptr);
- ASSERT_NE(Element, nullptr);
- EXPECT_EQ(Reader, Reference);
- EXPECT_EQ(Element->getLevel(), 3u);
- EXPECT_EQ(Element->getLineNumber(), 8u);
- EXPECT_EQ(Element->getName(), "");
- EXPECT_EQ(Pass, LVComparePass::Missing);
-
// Target: Added Variable 'CONSTANT'
- std::tie(Reader, Element, Pass) = PassTable[3];
+ std::tie(Reader, Element, Pass) = PassTable[2];
ASSERT_NE(Reader, nullptr);
ASSERT_NE(Element, nullptr);
EXPECT_EQ(Reader, Target);
@@ -299,7 +289,7 @@ void checkElementComparison(LVReader *Reference, LVReader *Target) {
EXPECT_EQ(Pass, LVComparePass::Added);
// Target: Added TypeDefinition 'INTEGER'
- std::tie(Reader, Element, Pass) = PassTable[4];
+ std::tie(Reader, Element, Pass) = PassTable[3];
ASSERT_NE(Reader, nullptr);
ASSERT_NE(Element, nullptr);
EXPECT_EQ(Reader, Target);
More information about the llvm-commits
mailing list