xref: /llvm-project/llvm/test/DebugInfo/X86/dwarfdump-debug-loc-error-cases.s (revision 208a11ab3a7be7c3e5d3fae9dd4affdb01a0ed1f)
1# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE1=0 -o %t1.o
2# RUN: not llvm-dwarfdump -debug-loc %t1.o 2>&1 | FileCheck %s
3
4# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE2=0 -o %t2.o
5# RUN: not llvm-dwarfdump -debug-loc %t2.o 2>&1 | FileCheck %s
6
7# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE3=0 -o %t3.o
8# RUN: not llvm-dwarfdump -debug-loc %t3.o 2>&1 | FileCheck %s
9
10# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE4=0 -o %t4.o
11# RUN: not llvm-dwarfdump -debug-loc %t4.o 2>&1 | FileCheck %s
12
13# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE5=0 -o %t5.o
14# RUN: not llvm-dwarfdump -debug-loc %t5.o 2>&1 | FileCheck %s
15
16# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE6=0 -o %t6.o
17# RUN: not llvm-dwarfdump -debug-loc %t6.o 2>&1 | FileCheck %s
18
19# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE7=0 -o %t7.o
20# RUN: llvm-dwarfdump -debug-loc %t7.o 2>&1 | FileCheck %s --check-prefix=UNKNOWN-REG
21
22# CHECK: error: unexpected end of data
23
24# UNKNOWN-REG: (0x0000000000000000,  0x0000000000000001): DW_OP_regx 0xdeadbeef
25
26.section  .debug_loc,"",@progbits
27.ifdef CASE1
28  .byte  1                       # bogus
29.endif
30.ifdef CASE2
31  .quad  0                       # starting offset
32.endif
33.ifdef CASE3
34  .quad  0                       # starting offset
35  .quad  1                       # ending offset
36.endif
37.ifdef CASE4
38  .quad  0                       # starting offset
39  .quad  1                       # ending offset
40  .word  0                       # Loc expr size
41.endif
42.ifdef CASE5
43  .quad  0                       # starting offset
44  .quad  1                       # ending offset
45  .word  0                       # Loc expr size
46  .quad  0                       # starting offset
47.endif
48.ifdef CASE6
49  .quad  0                       # starting offset
50  .quad  1                       # ending offset
51  .word  0xffff                  # Loc expr size
52.endif
53.ifdef CASE7
54  .quad  0                       # starting offset
55  .quad  1                       # ending offset
56  .word  2f-1f                   # Loc expr size
571:
58  .byte  0x90                    # DW_OP_regx
59  .uleb128 0xdeadbeef
602:
61  .quad  0                       # starting offset
62  .quad  0                       # ending offset
63.endif
64
65# A minimal compile unit is needed to deduce the address size of the location
66# lists
67.section  .debug_info,"",@progbits
68  .long  .Lcu_end0-.Lcu_begin0   # Length of Unit
69.Lcu_begin0:
70  .short  4                      # DWARF version number
71  .long  0                       # Offset Into Abbrev. Section
72  .byte  8                       # Address Size (in bytes)
73  .byte  0                       # End Of Children Mark
74.Lcu_end0:
75