1 ## Test that DWARFv5 address attributes and address expression operands
2 ## are handled correctly, specifically:
3 ## 1. DW_FORM_addrx is correctly recognized and converted into the DW_FORM_addr
4 ## in --garbage-collection case or correctly preserved in --no-garbage-collection case.
5 ## 2. DW_OP_addrx is correctly recognized and converted into the DW_OP_addr
6 ## in --garbage-collection case or correctly preserved in --no-garbage-collection case.
7 ## 3. DW_OP_constx is correctly recognized and converted into the DW_OP_const[*]u
8 ## in --garbage-collection case or correctly preserved in --no-garbage-collection case.
10 # RUN: yaml2obj %s -o %t.o
12 # RUN: llvm-dwarfutil %t.o %t1
13 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
14 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK
16 # RUN: llvm-dwarfutil --linker llvm %t.o %t1
17 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
18 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK
20 # RUN: llvm-dwarfutil --no-garbage-collection %t.o %t1
21 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
22 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
24 # RUN: llvm-dwarfutil --linker llvm --no-garbage-collection %t.o %t1
25 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
26 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
28 # RUN: llvm-dwarfutil --no-garbage-collection --build-accelerator=DWARF %t.o %t1
29 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
30 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
32 # RUN: llvm-dwarfutil --linker llvm --no-garbage-collection --build-accelerator=DWARF %t.o %t1
33 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
34 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
38 #DWARF-CHECK: DW_TAG_compile_unit
39 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "CU1"
40 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
41 #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000060)
42 #DWARF-CHECK: DW_AT_str_offsets_base [DW_FORM_sec_offset]
43 #DWARF-CHECK: DW_TAG_subprogram
44 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo1"
45 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
46 #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
47 #DWARF-CHECK: DW_TAG_subprogram
48 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo2"
49 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000001140)
50 #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
51 #DWARF-CHECK: DW_TAG_subprogram
52 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo3"
53 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000001150)
54 #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
55 #DWARF-CHECK: DW_TAG_subprogram
56 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo4"
57 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003) address = 0x0000000000001160)
58 #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
59 #DWARF-CHECK: DW_TAG_subprogram
60 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo5"
61 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000004) address = 0x0000000000001170)
62 #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
63 #DWARF-CHECK: DW_TAG_subprogram
64 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo6"
65 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000005) address = 0x0000000000001180)
66 #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
67 #DWARF-CHECK: DW_TAG_variable
68 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "var1"
69 #DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x2000)
70 #DWARF-CHECK: DW_TAG_variable
71 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "var2"
72 #DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x2000)
73 #DWARF-CHECK: DW_TAG_variable
74 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "var3"
75 #DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_const8u 0x2000, DW_OP_form_tls_address)
76 #DWARF-CHECK: DW_TAG_variable
77 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "var4"
78 #DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_const8u 0x2000, DW_OP_form_tls_address)
79 #DWARF-CHECK=NOT: .debug_addr contents:
81 #UPD-DWARF-CHECK: DW_TAG_compile_unit
82 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"CU1"
83 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
84 #UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000060)
85 #UPD-DWARF-CHECK: DW_TAG_subprogram
86 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"foo1"
87 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
88 #UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
89 #UPD-DWARF-CHECK: DW_TAG_subprogram
90 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"foo2"
91 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000001140)
92 #UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
93 #UPD-DWARF-CHECK: DW_TAG_subprogram
94 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"foo3"
95 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000001150)
96 #UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
97 #UPD-DWARF-CHECK: DW_TAG_subprogram
98 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"foo4"
99 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx1] (indexed (00000003) address = 0x0000000000001160)
100 #UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
101 #UPD-DWARF-CHECK: DW_TAG_subprogram
102 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"foo5"
103 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx2] (indexed (00000004) address = 0x0000000000001170)
104 #UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
105 #UPD-DWARF-CHECK: DW_TAG_subprogram
106 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"foo6"
107 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx4] (indexed (00000005) address = 0x0000000000001180)
108 #UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
109 #UPD-DWARF-CHECK: DW_TAG_variable
110 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"var1"
111 #UPD-DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x6)
112 #UPD-DWARF-CHECK: DW_TAG_variable
113 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"var2"
114 #UPD-DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x2000)
115 #UPD-DWARF-CHECK: DW_TAG_variable
116 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"var3"
117 #UPD-DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_constx 0x6, DW_OP_form_tls_address)
118 #UPD-DWARF-CHECK: DW_TAG_variable
119 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"var4"
120 #UPD-DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_const8u 0x2000, DW_OP_form_tls_address)
121 #UPD-DWARF-CHECK: .debug_addr contents:
122 #UPD-DWARF-CHECK: 0x00000000: Address table header: length = 0x0000003c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
123 #UPD-DWARF-CHECK: Addrs: [
124 #UPD-DWARF-CHECK: 0x0000000000001130
125 #UPD-DWARF-CHECK: 0x0000000000001140
126 #UPD-DWARF-CHECK: 0x0000000000001150
127 #UPD-DWARF-CHECK: 0x0000000000001160
128 #UPD-DWARF-CHECK: 0x0000000000001170
129 #UPD-DWARF-CHECK: 0x0000000000001180
130 #UPD-DWARF-CHECK: 0x0000000000002000
142 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
148 - Tag: DW_TAG_compile_unit
149 Children: DW_CHILDREN_yes
151 - Attribute: DW_AT_producer
153 - Attribute: DW_AT_language
155 - Attribute: DW_AT_name
157 - Attribute: DW_AT_low_pc
159 - Attribute: DW_AT_high_pc
161 - Attribute: DW_AT_addr_base
162 Form: DW_FORM_sec_offset
163 - Tag: DW_TAG_subprogram
164 Children: DW_CHILDREN_yes
166 - Attribute: DW_AT_name
168 - Attribute: DW_AT_low_pc
170 - Attribute: DW_AT_high_pc
172 - Attribute: DW_AT_type
174 - Tag: DW_TAG_subprogram
175 Children: DW_CHILDREN_yes
177 - Attribute: DW_AT_name
179 - Attribute: DW_AT_low_pc
181 - Attribute: DW_AT_high_pc
183 - Attribute: DW_AT_type
185 - Tag: DW_TAG_subprogram
186 Children: DW_CHILDREN_yes
188 - Attribute: DW_AT_name
190 - Attribute: DW_AT_low_pc
192 - Attribute: DW_AT_high_pc
194 - Attribute: DW_AT_type
196 - Tag: DW_TAG_subprogram
197 Children: DW_CHILDREN_yes
199 - Attribute: DW_AT_name
201 - Attribute: DW_AT_low_pc
203 - Attribute: DW_AT_high_pc
205 - Attribute: DW_AT_type
207 - Tag: DW_TAG_base_type
208 Children: DW_CHILDREN_no
210 - Attribute: DW_AT_name
212 - Tag: DW_TAG_variable
213 Children: DW_CHILDREN_no
215 - Attribute: DW_AT_name
217 - Attribute: DW_AT_type
219 - Attribute: DW_AT_location
220 Form: DW_FORM_exprloc
223 UnitType: DW_UT_compile