1 # This test verifies that if a DW_TAG_compile_unit has DW_AT_ranges that
2 # overlap, that it doesn't end up producing invalid errors claiming a child
3 # DW_TAG_subprogram DIE is not in the parant (CU) ranges. Prior to the commit
4 # that fixed this, a loop was iterating over all DW_AT_ranges for a DIE and
5 # stopping the loop if any intersecting ranges were found. This would cause
6 # the DW_TAG_subprogram DIEs, like "stripped2" and "main", to improperly report
7 # that they were not contained in the parent's address ranges
9 # The DWARF looks like:
10 # 0x0000000b: DW_TAG_compile_unit
11 # DW_AT_name ("/tmp/main.c")
12 # DW_AT_language (DW_LANG_C)
13 # DW_AT_low_pc (0x0000000000000000)
14 # DW_AT_ranges (0x00000000
15 # [0x0000000000002000, 0x0000000000003000)
16 # [0x0000000000000000, 0x0000000000000020)
17 # [0x0000000000000000, 0x0000000000000030)
18 # [0x0000000000001000, 0x0000000000002000))
20 # 0x0000001e: DW_TAG_subprogram
21 # DW_AT_name ("stripped1")
22 # DW_AT_low_pc (0x0000000000000000)
23 # DW_AT_high_pc (0x0000000000000020)
25 # 0x0000002f: DW_TAG_subprogram
26 # DW_AT_name ("stripped2")
27 # DW_AT_low_pc (0x0000000000000000)
28 # DW_AT_high_pc (0x0000000000000030)
30 # 0x00000044: DW_TAG_subprogram
32 # DW_AT_low_pc (0x0000000000001000)
33 # DW_AT_high_pc (0x0000000000002000)
35 # 0x00000055: DW_TAG_subprogram
37 # DW_AT_low_pc (0x0000000000002000)
38 # DW_AT_high_pc (0x0000000000003000)
42 # RUN: yaml2obj %s | not llvm-dwarfdump --verify - | FileCheck %s --implicit-check-not=error:
44 # CHECK: error: DIE has overlapping ranges in DW_AT_ranges attribute: [0x0000000000000000, 0x0000000000000020) and [0x0000000000000000, 0x0000000000000030)
46 # CHECK: 0x0000000b: DW_TAG_compile_unit
47 # CHECK-NEXT: DW_AT_name ("/tmp/main.c")
48 # CHECK-NEXT: DW_AT_language (DW_LANG_C)
49 # CHECK-NEXT: DW_AT_low_pc (0x0000000000000000)
50 # CHECK-NEXT: DW_AT_ranges (0x00000000
51 # CHECK-NEXT: [0x0000000000002000, 0x0000000000003000)
52 # CHECK-NEXT: [0x0000000000000000, 0x0000000000000020)
53 # CHECK-NEXT: [0x0000000000000000, 0x0000000000000030)
54 # CHECK-NEXT: [0x0000000000001000, 0x0000000000002000))
56 # CHECK: error: DIEs have overlapping address ranges:
57 # CHECK: 0x0000002f: DW_TAG_subprogram
58 # CHECK-NEXT: DW_AT_name ("stripped2")
59 # CHECK-NEXT: DW_AT_low_pc (0x0000000000000000)
60 # CHECK-NEXT: DW_AT_high_pc (0x0000000000000030)
62 # CHECK: 0x0000001e: DW_TAG_subprogram
63 # CHECK-NEXT: DW_AT_name ("stripped1")
64 # CHECK-NEXT: DW_AT_low_pc (0x0000000000000000)
65 # CHECK-NEXT: DW_AT_high_pc (0x0000000000000020)
73 cpusubtype: 0x00000003
92 - sectname: __debug_abbrev
94 addr: 0x0000000000000000
101 reserved1: 0x00000000
102 reserved2: 0x00000000
103 reserved3: 0x00000000
104 - sectname: __debug_info
106 addr: 0x0000000000000024
113 reserved1: 0x00000000
114 reserved2: 0x00000000
115 reserved3: 0x00000000
116 - sectname: __debug_ranges
118 addr: 0x000000000000008B
125 reserved1: 0x00000000
126 reserved2: 0x00000000
127 reserved3: 0x00000000
128 - sectname: __debug_str
130 addr: 0x00000000000000DB
137 reserved1: 0x00000000
138 reserved2: 0x00000000
139 reserved3: 0x00000000
146 - cmd: LC_BUILD_VERSION
155 - cmd: LC_DATA_IN_CODE
179 Tag: DW_TAG_compile_unit
180 Children: DW_CHILDREN_yes
182 - Attribute: DW_AT_name
184 - Attribute: DW_AT_language
186 - Attribute: DW_AT_low_pc
188 - Attribute: DW_AT_ranges
189 Form: DW_FORM_sec_offset
191 Tag: DW_TAG_subprogram
192 Children: DW_CHILDREN_no
194 - Attribute: DW_AT_name
196 - Attribute: DW_AT_low_pc
198 - Attribute: DW_AT_high_pc
201 Tag: DW_TAG_subprogram
202 Children: DW_CHILDREN_no
204 - Attribute: DW_AT_name
206 - Attribute: DW_AT_low_pc
208 - Attribute: DW_AT_high_pc
214 - LowOffset: 0x0000000000002000
215 HighOffset: 0x0000000000003000
216 - LowOffset: 0x0000000000000000
217 HighOffset: 0x0000000000000020
218 - LowOffset: 0x0000000000000000
219 HighOffset: 0x0000000000000030
220 - LowOffset: 0x0000000000001000
221 HighOffset: 0x0000000000002000
226 - AbbrCode: 0x00000001
228 - Value: 0x0000000000000001
229 - Value: 0x0000000000000002
230 - Value: 0x0000000000000000
231 - Value: 0x0000000000000000
232 - AbbrCode: 0x00000002
234 - Value: 0x000000000000000D
235 - Value: 0x0000000000000000
236 - Value: 0x0000000000000020
237 - AbbrCode: 0x00000003
239 - Value: 0x0000000000000017
240 - Value: 0x0000000000000000
241 - Value: 0x0000000000000030
242 - AbbrCode: 0x00000002
244 - Value: 0x0000000000000021
245 - Value: 0x0000000000001000
246 - Value: 0x0000000000001000
247 - AbbrCode: 0x00000002
249 - Value: 0x0000000000000026
250 - Value: 0x0000000000002000
251 - Value: 0x0000000000001000
252 - AbbrCode: 0x00000000