1# REQUIRES: x86
2
3# RUN: cd %T
4# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s >debug_loclists-dwo.o
5# RUN: %lldb debug_loclists-dwo.o -o "image lookup -v -s lookup_loclists" -o exit | FileCheck %s
6
7# CHECK-LABEL: image lookup -v -s lookup_loclists
8# CHECK: Variable: {{.*}}, name = "x0", type = "int", location = DW_OP_reg0 RAX,
9# CHECK: Variable: {{.*}}, name = "x1", type = "int", location = DW_OP_reg1 RDX,
10
11loclists:
12        nop
13.Ltmp0:
14        nop
15.Ltmp1:
16lookup_loclists:
17        nop
18.Ltmp2:
19        nop
20.Ltmp3:
21        nop
22.Lloclists_end:
23
24        .section        .debug_abbrev,"",@progbits
25        .byte   1                       # Abbreviation Code
26        .byte   17                      # DW_TAG_compile_unit
27        .byte   0                       # DW_CHILDREN_no
28        .byte   0x76                    # DW_AT_dwo_name
29        .byte   8                       # DW_FORM_string
30        .byte   115                     # DW_AT_addr_base
31        .byte   23                      # DW_FORM_sec_offset
32        .byte   17                      # DW_AT_low_pc
33        .byte   1                       # DW_FORM_addr
34        .byte   85                      # DW_AT_ranges
35        .byte   35                      # DW_FORM_rnglistx
36        .byte   116                     # DW_AT_rnglists_base
37        .byte   23                      # DW_FORM_sec_offset
38        .byte   0                       # EOM(1)
39        .byte   0                       # EOM(2)
40        .byte   0                       # EOM(3)
41
42        .section        .debug_info,"",@progbits
43.Lcu_begin0:
44        .long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
45.Ldebug_info_start0:
46        .short  5                       # DWARF version number
47        .byte   4                       # DWARF Unit Type
48        .byte   8                       # Address Size (in bytes)
49        .long   .debug_abbrev           # Offset Into Abbrev. Section
50        .quad   0xdeadbeefbaadf00d      # DWO id
51        .byte   1                       # Abbrev [1] 0xc:0x5f DW_TAG_compile_unit
52        .asciz  "debug_loclists-dwo.o"  # DW_AT_dwo_name
53        .long   .Laddr_table_base0      # DW_AT_addr_base
54        .quad   loclists                # DW_AT_low_pc
55        .byte   0                       # DW_AT_ranges
56        .long   .Lskel_rnglists_table_base # DW_AT_rnglists_base
57.Ldebug_info_end0:
58
59        .section        .debug_rnglists,"",@progbits
60        .long   .Lskel_rnglist_table_end-.Lskel_rnglist_table_start # Length
61.Lskel_rnglist_table_start:
62        .short  5                       # Version
63        .byte   8                       # Address size
64        .byte   0                       # Segment selector size
65        .long   1                       # Offset entry count
66.Lskel_rnglists_table_base:
67        .long   .Lskel_ranges0-.Lskel_rnglists_table_base
68.Lskel_ranges0:
69        .byte   7                       # DW_RLE_start_length
70        .quad   loclists
71        .uleb128   .Lloclists_end-loclists
72        .byte   0                       # DW_RLE_end_of_list
73.Lskel_rnglist_table_end:
74        .section        .debug_addr,"",@progbits
75        .long   .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
76.Ldebug_addr_start0:
77        .short  5                       # DWARF version number
78        .byte   8                       # Address size
79        .byte   0                       # Segment selector size
80.Laddr_table_base0:
81        .quad   loclists
82        .quad   .Ltmp1
83.Ldebug_addr_end0:
84
85# The presence of an extra non-dwo loclists section should not confuse us.
86# .debug_info.dwo always refers to .debug_loclists.dwo
87        .section        .debug_loclists,"",@progbits
88        .quad 0xdeadbeefbaadf00d
89
90        .section        .debug_loclists.dwo,"e",@progbits
91        .long   .Ldebug_loclist_table_end0-.Ldebug_loclist_table_start0 # Length
92.Ldebug_loclist_table_start0:
93        .short  5                       # Version
94        .byte   8                       # Address size
95        .byte   0                       # Segment selector size
96        .long   2                       # Offset entry count
97.Lloclists_table_base:
98        .long   .Ldebug_loc0-.Lloclists_table_base
99        .long   .Ldebug_loc1-.Lloclists_table_base
100.Ldebug_loc0:
101        .byte   4                       # DW_LLE_offset_pair
102        .uleb128 loclists-loclists
103        .uleb128  .Ltmp2-loclists
104        .uleb128 1                      # Expression size
105        .byte   80                      # super-register DW_OP_reg0
106        .byte   0                       # DW_LLE_end_of_list
107.Ldebug_loc1:
108        .byte   3                       # DW_LLE_startx_length
109        .uleb128 1
110        .uleb128  .Ltmp3-.Ltmp1
111        .uleb128 1                      # Expression size
112        .byte   81                      # super-register DW_OP_reg1
113        .byte   0                       # DW_LLE_end_of_list
114.Ldebug_loclist_table_end0:
115
116        .section        .debug_abbrev.dwo,"e",@progbits
117        .byte   1                       # Abbreviation Code
118        .byte   17                      # DW_TAG_compile_unit
119        .byte   1                       # DW_CHILDREN_yes
120        .byte   37                      # DW_AT_producer
121        .byte   8                       # DW_FORM_string
122        .byte   19                      # DW_AT_language
123        .byte   5                       # DW_FORM_data2
124        .byte   0                       # EOM(1)
125        .byte   0                       # EOM(2)
126        .byte   2                       # Abbreviation Code
127        .byte   46                      # DW_TAG_subprogram
128        .byte   1                       # DW_CHILDREN_yes
129        .byte   17                      # DW_AT_low_pc
130        .byte   27                      # DW_FORM_addrx
131        .byte   18                      # DW_AT_high_pc
132        .byte   6                       # DW_FORM_data4
133        .byte   3                       # DW_AT_name
134        .byte   8                       # DW_FORM_string
135        .byte   73                      # DW_AT_type
136        .byte   19                      # DW_FORM_ref4
137        .byte   0                       # EOM(1)
138        .byte   0                       # EOM(2)
139        .byte   3                       # Abbreviation Code
140        .byte   5                       # DW_TAG_formal_parameter
141        .byte   0                       # DW_CHILDREN_no
142        .byte   2                       # DW_AT_location
143        .byte   0x22                    # DW_FORM_loclistx
144        .byte   3                       # DW_AT_name
145        .byte   8                       # DW_FORM_string
146        .byte   73                      # DW_AT_type
147        .byte   19                      # DW_FORM_ref4
148        .byte   0                       # EOM(1)
149        .byte   0                       # EOM(2)
150        .byte   4                       # Abbreviation Code
151        .byte   36                      # DW_TAG_base_type
152        .byte   0                       # DW_CHILDREN_no
153        .byte   3                       # DW_AT_name
154        .byte   8                       # DW_FORM_string
155        .byte   62                      # DW_AT_encoding
156        .byte   11                      # DW_FORM_data1
157        .byte   11                      # DW_AT_byte_size
158        .byte   11                      # DW_FORM_data1
159        .byte   0                       # EOM(1)
160        .byte   0                       # EOM(2)
161        .byte   0                       # EOM(3)
162
163        .section        .debug_info.dwo,"e",@progbits
164.Lcu_begin1:
165        .long   .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
166.Ldebug_info_start1:
167        .short  5                       # DWARF version number
168        .byte   5                       # DWARF Unit Type
169        .byte   8                       # Address Size (in bytes)
170        .long   .debug_abbrev           # Offset Into Abbrev. Section
171        .quad   0xdeadbeefbaadf00d      # DWO id
172        .byte   1                       # Abbrev [1] 0xb:0x50 DW_TAG_compile_unit
173        .asciz  "Hand-written DWARF"    # DW_AT_producer
174        .short  12                      # DW_AT_language
175        .byte   2                       # Abbrev [2] 0x2a:0x29 DW_TAG_subprogram
176        .byte   0                       # DW_AT_low_pc
177        .long   .Lloclists_end-loclists # DW_AT_high_pc
178        .asciz  "loclists"              # DW_AT_name
179        .long   .Lint                   # DW_AT_type
180        .byte   3                       # Abbrev [3] DW_TAG_formal_parameter
181        .uleb128 0                      # DW_AT_location
182        .asciz  "x0"                    # DW_AT_name
183        .long   .Lint                   # DW_AT_type
184        .byte   3                       # Abbrev [3] DW_TAG_formal_parameter
185        .uleb128 1                      # DW_AT_location
186        .asciz  "x1"                    # DW_AT_name
187        .long   .Lint                   # DW_AT_type
188        .byte   0                       # End Of Children Mark
189.Lint:
190        .byte   4                       # Abbrev [4] 0x53:0x7 DW_TAG_base_type
191        .asciz  "int"                   # DW_AT_name
192        .byte   5                       # DW_AT_encoding
193        .byte   4                       # DW_AT_byte_size
194        .byte   0                       # End Of Children Mark
195.Ldebug_info_end1:
196