xref: /llvm-project/lldb/test/Shell/SymbolFile/DWARF/x86/debug_loc_and_loclists.s (revision 15983c28aa819031e08a2b3fe49d02c41839b22c)
1# Test that we can handle DWARF 4 and 5 location lists in the same object file
2# (but different compile units).
3
4# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
5# RUN: %lldb %t -o "image lookup -v -s loc" -o "image lookup -v -s loclists" \
6# RUN:   -o exit | FileCheck %s
7
8
9# CHECK-LABEL: image lookup -v -s loc
10# CHECK: Variable: {{.*}}, name = "x0", type = "int", valid ranges = <block>, location = [0x0000000000000000, 0x0000000000000001) -> DW_OP_reg5 RDI,
11
12# CHECK-LABEL: image lookup -v -s loclists
13# CHECK: Variable: {{.*}}, name = "x1", type = "int", valid ranges = <block>, location = [0x0000000000000001, 0x0000000000000002) -> DW_OP_reg0 RAX,
14
15
16loc:
17        nop
18.Lloc_end:
19
20loclists:
21        nop
22.Lloclists_end:
23
24        .section        .debug_loc,"",@progbits
25.Lloc_list:
26        .quad loc-loc
27        .quad .Lloc_end-loc
28        .short 1
29        .byte   85                      # super-register DW_OP_reg5
30        .quad 0
31        .quad 0
32
33        .section        .debug_loclists,"",@progbits
34        .long   .Ldebug_loclist_table_end0-.Ldebug_loclist_table_start0 # Length
35.Ldebug_loclist_table_start0:
36        .short  5                       # Version
37        .byte   8                       # Address size
38        .byte   0                       # Segment selector size
39        .long   0                       # Offset entry count
40
41.Lloclists_list:
42        .byte   4                       # DW_LLE_offset_pair
43        .uleb128 loclists-loclists
44        .uleb128 .Lloclists_end-loclists
45        .uleb128 1
46        .byte   80                      # super-register DW_OP_reg0
47        .byte   0                       # DW_LLE_end_of_list
48.Ldebug_loclist_table_end0:
49
50        .section        .debug_abbrev,"",@progbits
51        .byte   1                       # Abbreviation Code
52        .byte   17                      # DW_TAG_compile_unit
53        .byte   1                       # DW_CHILDREN_yes
54        .byte   37                      # DW_AT_producer
55        .byte   8                       # DW_FORM_string
56        .byte   19                      # DW_AT_language
57        .byte   5                       # DW_FORM_data2
58        .byte   17                      # DW_AT_low_pc
59        .byte   1                       # DW_FORM_addr
60        .byte   18                      # DW_AT_high_pc
61        .byte   6                       # DW_FORM_data4
62        .byte   0                       # EOM(1)
63        .byte   0                       # EOM(2)
64        .byte   2                       # Abbreviation Code
65        .byte   46                      # DW_TAG_subprogram
66        .byte   1                       # DW_CHILDREN_yes
67        .byte   17                      # DW_AT_low_pc
68        .byte   1                       # DW_FORM_addr
69        .byte   18                      # DW_AT_high_pc
70        .byte   6                       # DW_FORM_data4
71        .byte   3                       # DW_AT_name
72        .byte   8                       # DW_FORM_string
73        .byte   73                      # DW_AT_type
74        .byte   16                      # DW_FORM_ref_addr
75        .byte   0                       # EOM(1)
76        .byte   0                       # EOM(2)
77        .byte   3                       # Abbreviation Code
78        .byte   5                       # DW_TAG_formal_parameter
79        .byte   0                       # DW_CHILDREN_no
80        .byte   2                       # DW_AT_location
81        .byte   23                      # DW_FORM_sec_offset
82        .byte   3                       # DW_AT_name
83        .byte   8                       # DW_FORM_string
84        .byte   73                      # DW_AT_type
85        .byte   16                      # DW_FORM_ref_addr
86        .byte   0                       # EOM(1)
87        .byte   0                       # EOM(2)
88        .byte   4                       # Abbreviation Code
89        .byte   36                      # DW_TAG_base_type
90        .byte   0                       # DW_CHILDREN_no
91        .byte   3                       # DW_AT_name
92        .byte   8                       # DW_FORM_string
93        .byte   62                      # DW_AT_encoding
94        .byte   11                      # DW_FORM_data1
95        .byte   11                      # DW_AT_byte_size
96        .byte   11                      # DW_FORM_data1
97        .byte   0                       # EOM(1)
98        .byte   0                       # EOM(2)
99        .byte   0                       # EOM(3)
100
101        .section        .debug_info,"",@progbits
102        .long   .Lloc_cu_end-.Lloc_cu_start # Length of Unit
103.Lloc_cu_start:
104        .short  4                       # DWARF version number
105        .long   .debug_abbrev           # Offset Into Abbrev. Section
106        .byte   8                       # Address Size (in bytes)
107        .byte   1                       # Abbrev [1] 0xb:0x50 DW_TAG_compile_unit
108        .asciz  "Hand-written DWARF"    # DW_AT_producer
109        .short  12                      # DW_AT_language
110        .quad   loc                     # DW_AT_low_pc
111        .long   .Lloc_end-loc           # DW_AT_high_pc
112        .byte   2                       # Abbrev [2] 0x2a:0x29 DW_TAG_subprogram
113        .quad   loc                     # DW_AT_low_pc
114        .long   .Lloc_end-loc           # DW_AT_high_pc
115        .asciz  "loc"                   # DW_AT_name
116        .long   .Lint                   # DW_AT_type
117        .byte   3                       # Abbrev [3] DW_TAG_formal_parameter
118        .long   .Lloc_list              # DW_AT_location
119        .asciz  "x0"                    # DW_AT_name
120        .long   .Lint                   # DW_AT_type
121        .byte   0                       # End Of Children Mark
122.Lint:
123        .byte   4                       # Abbrev [4] 0x53:0x7 DW_TAG_base_type
124        .asciz  "int"                   # DW_AT_name
125        .byte   5                       # DW_AT_encoding
126        .byte   4                       # DW_AT_byte_size
127        .byte   0                       # End Of Children Mark
128.Lloc_cu_end:
129
130        .long   .Lloclists_cu_end-.Lloclists_cu_start # Length of Unit
131.Lloclists_cu_start:
132        .short  5                       # DWARF version number
133        .byte   1                       # DWARF Unit Type
134        .byte   8                       # Address Size (in bytes)
135        .long   .debug_abbrev           # Offset Into Abbrev. Section
136        .byte   1                       # Abbrev [1] 0xb:0x50 DW_TAG_compile_unit
137        .asciz  "Hand-written DWARF"    # DW_AT_producer
138        .short  12                      # DW_AT_language
139        .quad   loclists                # DW_AT_low_pc
140        .long   .Lloclists_end-loclists # DW_AT_high_pc
141        .byte   2                       # Abbrev [2] 0x2a:0x29 DW_TAG_subprogram
142        .quad   loclists                # DW_AT_low_pc
143        .long   .Lloclists_end-loclists # DW_AT_high_pc
144        .asciz  "loclists"              # DW_AT_name
145        .long   .Lint                   # DW_AT_type
146        .byte   3                       # Abbrev [3] DW_TAG_formal_parameter
147        .long   .Lloclists_list         # DW_AT_location
148        .asciz  "x1"                    # DW_AT_name
149        .long   .Lint                   # DW_AT_type
150        .byte   0                       # End Of Children Mark
151        .byte   0                       # End Of Children Mark
152.Lloclists_cu_end:
153