1 ## Test that DWARFv5 .debug_rnglists is correctly recognized
2 ## and converted into the DW_FORM_sec_offset form in --garbage-collection
3 ## case or correctly preserved in --no-garbage-collection case.
5 # RUN: yaml2obj %s -o %t.o
7 # RUN: llvm-dwarfutil %t.o %t1
8 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
9 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK
11 # RUN: llvm-dwarfutil --linker parallel %t.o %t1
12 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
13 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK
15 # RUN: llvm-dwarfutil --no-garbage-collection %t.o %t1
16 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
17 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
19 # RUN: llvm-dwarfutil --linker parallel --no-garbage-collection %t.o %t1
20 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
21 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
23 # RUN: llvm-dwarfutil --no-garbage-collection --build-accelerator=DWARF %t.o %t1
24 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
25 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
27 # RUN: llvm-dwarfutil --linker parallel --no-garbage-collection --build-accelerator=DWARF %t.o %t1
28 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
29 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
33 #DWARF-CHECK: DW_TAG_compile_unit
34 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "CU1"
35 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
36 #DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[CURANGE_OFF:[0-9a-f]*]]
37 #DWARF-CHECK: [0x0000000000001130, 0x0000000000001170))
38 #DWARF-CHECK: DW_AT_str_offsets_base [DW_FORM_sec_offset]
39 #DWARF-CHECK: DW_TAG_subprogram
40 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo1"
41 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
42 #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
43 #DWARF-CHECK: DW_TAG_lexical_block
44 #DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[F1RANGE_OFF:[0-9a-f]*]]
45 #DWARF-CHECK: [0x0000000000001130, 0x0000000000001140))
46 #DWARF-CHECK: DW_TAG_subprogram
47 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo2"
48 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000001140)
49 #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
50 #DWARF-CHECK: DW_TAG_lexical_block
51 #DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[F2RANGE_OFF:[0-9a-f]*]]
52 #DWARF-CHECK: [0x0000000000001140, 0x0000000000001150))
53 #DWARF-CHECK: DW_TAG_subprogram
54 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo3"
55 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000001150)
56 #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
57 #DWARF-CHECK: DW_TAG_lexical_block
58 #DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[F3RANGE_OFF:[0-9a-f]*]]
59 #DWARF-CHECK: [0x0000000000001150, 0x0000000000001160))
60 #DWARF-CHECK: DW_TAG_subprogram
61 #DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo4"
62 #DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003) address = 0x0000000000001160)
63 #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
64 #DWARF-CHECK: DW_TAG_lexical_block
65 #DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[F4RANGE_OFF:[0-9a-f]*]]
66 #DWARF-CHECK: [0x0000000000001160, 0x0000000000001170))
67 #DWARF-CHECK: .debug_aranges contents:
68 #DWARF-CHECK: Address Range Header: length = 0x0000002c, format = DWARF32, version = 0x0002, cu_offset = 0x000000{{00|21}}, addr_size = 0x08, seg_size = 0x00
69 #DWARF-CHECK: [0x0000000000001130, 0x0000000000001170)
70 #DWARF-CHECK: .debug_addr contents:
71 #DWARF-CHECK: 0x00000000: Address table header: length = 0x00000024, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
72 #DWARF-CHECK: Addrs: [
73 #DWARF-CHECK: 0x0000000000001130
74 #DWARF-CHECK: 0x0000000000001140
75 #DWARF-CHECK: 0x0000000000001150
76 #DWARF-CHECK: 0x0000000000001160
78 #DWARF-CHECK: .debug_rnglists contents:
79 #DWARF-CHECK: 0x00000000: range list header: length = 0x00000026, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
81 #DWARF-CHECK: 0x[[F1RANGE_OFF]]: [DW_RLE_base_addressx]: 0x0000000000000000
82 #DWARF-CHECK: {{.}}: [DW_RLE_offset_pair ]: 0x0000000000000000, 0x0000000000000010
83 #DWARF-CHECK: {{.}}: [DW_RLE_end_of_list ]
84 #DWARF-CHECK: 0x[[F2RANGE_OFF]]: [DW_RLE_base_addressx]: 0x0000000000000001
85 #DWARF-CHECK: {{.}}: [DW_RLE_offset_pair ]: 0x0000000000000000, 0x0000000000000010
86 #DWARF-CHECK: {{.}}: [DW_RLE_end_of_list ]
87 #DWARF-CHECK: 0x[[F3RANGE_OFF]]: [DW_RLE_base_addressx]: 0x0000000000000002
88 #DWARF-CHECK: {{.}}: [DW_RLE_offset_pair ]: 0x0000000000000000, 0x0000000000000010
89 #DWARF-CHECK: {{.}}: [DW_RLE_end_of_list ]
90 #DWARF-CHECK: 0x[[F4RANGE_OFF]]: [DW_RLE_base_addressx]: 0x0000000000000003
91 #DWARF-CHECK: {{.}}: [DW_RLE_offset_pair ]: 0x0000000000000000, 0x0000000000000010
92 #DWARF-CHECK: {{.}}: [DW_RLE_end_of_list ]
93 #DWARF-CHECK 0x[[CURANGE_OFF]]: [DW_RLE_base_addressx]: 0x0000000000000000
94 #DWARF-CHECK: {{.}}: [DW_RLE_offset_pair ]: 0x0000000000000000, 0x0000000000000040
95 #DWARF-CHECK: {{.}}: [DW_RLE_end_of_list ]
97 #UPD-DWARF-CHECK: DW_TAG_compile_unit
98 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"CU1"
99 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
100 #UPD-DWARF-CHECK: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x4) rangelist = 0x0000003e
101 #UPD-DWARF-CHECK: [0x0000000000001130, 0x0000000000001170))
102 #UPD-DWARF-CHECK: DW_TAG_subprogram
103 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"foo1"
104 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
105 #UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
106 #UPD-DWARF-CHECK: DW_TAG_lexical_block
107 #UPD-DWARF-CHECK: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x00000020
108 #UPD-DWARF-CHECK: [0x0000000000001130, 0x0000000000001140))
109 #UPD-DWARF-CHECK: DW_TAG_subprogram
110 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"foo2"
111 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000001140)
112 #UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
113 #UPD-DWARF-CHECK: DW_TAG_lexical_block
114 #UPD-DWARF-CHECK: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = 0x00000024
115 #UPD-DWARF-CHECK: [0x0000000000001140, 0x0000000000001150))
116 #UPD-DWARF-CHECK: DW_TAG_subprogram
117 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"foo3"
118 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000001150)
119 #UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
120 #UPD-DWARF-CHECK: DW_TAG_lexical_block
121 #UPD-DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000028
122 #UPD-DWARF-CHECK: [0x0000000000001150, 0x0000000000001160))
123 #UPD-DWARF-CHECK: DW_TAG_subprogram
124 #UPD-DWARF-CHECK: DW_AT_name {{.*}}"foo4"
125 #UPD-DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003) address = 0x0000000000001160)
126 #UPD-DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
127 #UPD-DWARF-CHECK: DW_TAG_lexical_block
128 #UPD-DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000033
129 #UPD-DWARF-CHECK: [0x0000000000001160, 0x0000000000001170))
130 #UPD-DWARF-CHECK: .debug_addr contents:
131 #UPD-DWARF-CHECK: 0x00000000: Address table header: length = 0x00000024, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
132 #UPD-DWARF-CHECK: Addrs: [
133 #UPD-DWARF-CHECK: 0x0000000000001130
134 #UPD-DWARF-CHECK: 0x0000000000001140
135 #UPD-DWARF-CHECK: 0x0000000000001150
136 #UPD-DWARF-CHECK: 0x0000000000001160
138 #UPD-DWARF-CHECK: .debug_rnglists contents:
139 #UPD-DWARF-CHECK: 0x00000000: range list header: length = 0x0000003e, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000005
140 #UPD-DWARF-CHECK: offsets: [
141 #UPD-DWARF-CHECK: 0x00000014 => 0x00000020
142 #UPD-DWARF-CHECK: 0x00000018 => 0x00000024
143 #UPD-DWARF-CHECK: 0x0000001c => 0x00000028
144 #UPD-DWARF-CHECK: 0x00000027 => 0x00000033
145 #UPD-DWARF-CHECK: 0x00000032 => 0x0000003e
147 #UPD-DWARF-CHECK: ranges:
148 #UPD-DWARF-CHECK: 0x00000020: [DW_RLE_startx_length]: 0x0000000000000000, 0x0000000000000010
149 #UPD-DWARF-CHECK: 0x00000023: [DW_RLE_end_of_list ]
150 #UPD-DWARF-CHECK: 0x00000024: [DW_RLE_startx_length]: 0x0000000000000001, 0x0000000000000010
151 #UPD-DWARF-CHECK: 0x00000027: [DW_RLE_end_of_list ]
152 #UPD-DWARF-CHECK: 0x00000028: [DW_RLE_start_length ]: 0x0000000000001150, 0x0000000000000010
153 #UPD-DWARF-CHECK: 0x00000032: [DW_RLE_end_of_list ]
154 #UPD-DWARF-CHECK: 0x00000033: [DW_RLE_start_length ]: 0x0000000000001160, 0x0000000000000010
155 #UPD-DWARF-CHECK: 0x0000003d: [DW_RLE_end_of_list ]
156 #UPD-DWARF-CHECK: 0x0000003e: [DW_RLE_startx_length]: 0x0000000000000000, 0x0000000000000040
157 #UPD-DWARF-CHECK: 0x00000041: [DW_RLE_end_of_list ]
159 ## Following yaml description has Content of the .debug_rnglists exactly like above data ^^^^^^
169 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
172 - Name: .debug_rnglists
175 Content: "3e000000050008000500000014000000180000001c000000270000003200000003001000030110000750110000000000001000076011000000000000100003004000"
179 - Tag: DW_TAG_compile_unit
180 Children: DW_CHILDREN_yes
182 - Attribute: DW_AT_producer
184 - Attribute: DW_AT_language
186 - Attribute: DW_AT_name
188 - Attribute: DW_AT_low_pc
190 - Attribute: DW_AT_ranges
191 Form: DW_FORM_rnglistx
192 - Attribute: DW_AT_rnglists_base
193 Form: DW_FORM_sec_offset
194 - Attribute: DW_AT_addr_base
195 Form: DW_FORM_sec_offset
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_lexical_block
208 Children: DW_CHILDREN_no
210 - Attribute: DW_AT_ranges
211 Form: DW_FORM_rnglistx
212 - Tag: DW_TAG_lexical_block
213 Children: DW_CHILDREN_no
215 - Attribute: DW_AT_ranges
216 Form: DW_FORM_sec_offset
217 - Tag: DW_TAG_base_type
218 Children: DW_CHILDREN_no
220 - Attribute: DW_AT_name
224 UnitType: DW_UT_compile