xref: /llvm-project/llvm/test/DebugInfo/X86/dwp-v5-loclists.s (revision a93b77b97f105db911316d896056dc8718a850e3)
1## The test checks that v5 compile units in package files read their
2## location tables from .debug_loclists.dwo sections.
3## See dwp-v2-loc.s for pre-v5 units.
4
5# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \
6# RUN:   llvm-dwarfdump -debug-info -debug-loclists - | \
7# RUN:   FileCheck %s
8
9# CHECK:      .debug_info.dwo contents:
10# CHECK:      DW_TAG_compile_unit
11# CHECK:      DW_TAG_variable
12# CHECK-NEXT:   DW_AT_name ("a")
13# CHECK-NEXT:   DW_AT_location (0x{{[0-9a-f]+}}:
14# CHECK-NEXT:     DW_LLE_startx_length (0x0000000000000001, 0x0000000000000010): DW_OP_reg5 RDI)
15# CHECK:      DW_TAG_variable
16# CHECK-NEXT:   DW_AT_name ("b")
17# CHECK-NEXT:   DW_AT_location (indexed (0x1) loclist = 0x{{[0-9a-f]+}}:
18# CHECK-NEXT:     DW_LLE_startx_length (0x0000000000000005, 0x0000000000000020): DW_OP_regx RDI)
19
20# CHECK:      .debug_loclists.dwo contents:
21# CHECK:      locations list header:
22# CHECK:      locations list header:
23# CHECK:      offsets:
24# CHECK:      0x{{[0-9a-f]+}}:
25# CHECK-NEXT:   DW_LLE_startx_length (0x0000000000000001, 0x0000000000000010): DW_OP_reg5 RDI
26# CHECK:      0x{{[0-9a-f]+}}:
27# CHECK-NEXT:   DW_LLE_startx_length (0x0000000000000005, 0x0000000000000020): DW_OP_regx RDI
28
29.section .debug_abbrev.dwo, "e", @progbits
30.LAbbrevBegin:
31    .uleb128 1                          # Abbreviation Code
32    .uleb128 17                         # DW_TAG_compile_unit
33    .byte 1                             # DW_CHILDREN_yes
34    .byte 0                             # EOM(1)
35    .byte 0                             # EOM(2)
36    .uleb128 2                          # Abbreviation Code
37    .uleb128 52                         # DW_TAG_variable
38    .byte 0                             # DW_CHILDREN_no
39    .uleb128 3                          # DW_AT_name
40    .uleb128 8                          # DW_FORM_string
41    .uleb128 2                          # DW_AT_location
42    .uleb128 23                         # DW_FORM_sec_offset
43    .byte 0                             # EOM(1)
44    .byte 0                             # EOM(2)
45    .uleb128 3                          # Abbreviation Code
46    .uleb128 52                         # DW_TAG_variable
47    .byte 0                             # DW_CHILDREN_no
48    .uleb128 3                          # DW_AT_name
49    .uleb128 8                          # DW_FORM_string
50    .uleb128 2                          # DW_AT_location
51    .uleb128 34                         # DW_FORM_loclistx
52    .byte 0                             # EOM(1)
53    .byte 0                             # EOM(2)
54    .byte 0                             # EOM(3)
55.LAbbrevEnd:
56
57    .section .debug_info.dwo, "e", @progbits
58.LCUBegin:
59    .long .LCUEnd-.LCUVersion           # Length of Unit
60.LCUVersion:
61    .short 5                            # Version
62    .byte 5                             # DW_UT_split_compile
63    .byte 8                             # Address size
64    .long 0                             # Abbrev offset
65    .quad 0x1100001122222222            # DWO id
66    .uleb128 1                          # Abbrev [1] DW_TAG_compile_unit
67    .uleb128 2                          # Abbrev [2] DW_TAG_variable
68    .asciz "a"                          # DW_AT_name
69    .long .LLL0-.LLLBegin               # DW_AT_location (DW_FORM_sec_offset)
70    .uleb128 3                          # Abbrev [3] DW_TAG_variable
71    .asciz "b"                          # DW_AT_name
72    .uleb128 1                          # DW_AT_location (DW_FORM_loclistx)
73    .byte 0                             # End Of Children Mark
74.LCUEnd:
75
76.section .debug_loclists.dwo, "e", @progbits
77## Start the section with an unused table to check that the reading offset
78## of the real table is correctly adjusted.
79    .long .LLLDummyEnd-.LLLDummyVersion # Length of Unit
80.LLLDummyVersion:
81    .short 5                            # Version
82    .byte 8                             # Address size
83    .byte 0                             # Segment selector size
84    .long 0                             # Offset entry count
85    .byte 0                             # DW_LLE_end_of_list
86.LLLDummyEnd:
87
88.LLLBegin:
89    .long .LLLEnd-.LLLVersion           # Length of Unit
90.LLLVersion:
91    .short 5                            # Version
92    .byte 8                             # Address size
93    .byte 0                             # Segment selector size
94    .long 2                             # Offset entry count
95.LLLBase:
96    .long .LLL0-.LLLBase
97    .long .LLL1-.LLLBase
98.LLL0:
99    .byte 3                             # DW_LLE_startx_length
100    .uleb128 1                          # Index
101    .uleb128 0x10                       # Length
102    .uleb128 1                          # Loc expr size
103    .byte 85                            # DW_OP_reg5
104    .byte 0                             # DW_LLE_end_of_list
105.LLL1:
106    .byte 3                             # DW_LLE_startx_length
107    .uleb128 5                          # Index
108    .uleb128 0x20                       # Length
109    .uleb128 2                          # Loc expr size
110    .byte 144                           # DW_OP_regx
111    .uleb128 5                          # RDI
112    .byte 0                             # DW_LLE_end_of_list
113.LLLEnd:
114
115    .section .debug_cu_index, "", @progbits
116## Header:
117    .short 5                            # Version
118    .space 2                            # Padding
119    .long 3                             # Section count
120    .long 1                             # Unit count
121    .long 2                             # Slot count
122## Hash Table of Signatures:
123    .quad 0x1100001122222222
124    .quad 0
125## Parallel Table of Indexes:
126    .long 1
127    .long 0
128## Table of Section Offsets:
129## Row 0:
130    .long 1                             # DW_SECT_INFO
131    .long 3                             # DW_SECT_ABBREV
132    .long 5                             # DW_SECT_LOCLISTS
133## Row 1:
134    .long 0                             # Offset in .debug_info.dwo
135    .long 0                             # Offset in .debug_abbrev.dwo
136    .long .LLLBegin-.debug_loclists.dwo # Offset in .debug_loclists.dwo
137## Table of Section Sizes:
138    .long .LCUEnd-.LCUBegin             # Size in .debug_info.dwo
139    .long .LAbbrevEnd-.LAbbrevBegin     # Size in .debug_abbrev.dwo
140    .long .LLLEnd-.LLLBegin             # Size in .debug_loclists.dwo
141