1 # This test ensures that dwarfdump doesn't crash for malformed DWARF where a
2 # DIE references itself.
6 # __attribute__((always_inline)) void g() {
14 # clang inlined.c -S -g -o inlined.s
16 # RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \
17 # RUN: | llvm-dwarfdump -debug-info - \
20 # CHECK: 0x0000005a: DW_TAG_inlined_subroutine
21 # CHECK-NEXT: DW_AT_abstract_origin (0x0000005a)
23 .section __TEXT,__text,regular,pure_instructions
24 .macosx_version_min 10, 13
25 .globl _g ## -- Begin function g
30 .loc 1 2 0 ## inlined.c:2:0
34 .cfi_def_cfa_offset 16
37 .cfi_def_cfa_register %rbp
39 .loc 1 3 3 prologue_end ## inlined.c:3:3
42 .loc 1 4 1 ## inlined.c:4:1
49 .globl _h ## -- Begin function h
53 .loc 1 5 0 ## inlined.c:5:0
57 .cfi_def_cfa_offset 16
60 .cfi_def_cfa_register %rbp
62 .loc 1 3 3 prologue_end ## inlined.c:3:3
66 .loc 1 7 1 ## inlined.c:7:1
73 .section __DWARF,__debug_str,regular,debug
75 .asciz "clang version 7.0.0 " ## string offset=0
76 .asciz "inlined.c" ## string offset=21
77 .asciz "/private/tmp" ## string offset=31
78 .asciz "g" ## string offset=44
79 .asciz "h" ## string offset=46
80 .section __DWARF,__debug_abbrev,regular,debug
82 .byte 1 ## Abbreviation Code
83 .byte 17 ## DW_TAG_compile_unit
84 .byte 1 ## DW_CHILDREN_yes
85 .byte 37 ## DW_AT_producer
86 .byte 14 ## DW_FORM_strp
87 .byte 19 ## DW_AT_language
88 .byte 5 ## DW_FORM_data2
90 .byte 14 ## DW_FORM_strp
91 .byte 16 ## DW_AT_stmt_list
92 .byte 23 ## DW_FORM_sec_offset
93 .byte 27 ## DW_AT_comp_dir
94 .byte 14 ## DW_FORM_strp
95 .byte 17 ## DW_AT_low_pc
96 .byte 1 ## DW_FORM_addr
97 .byte 18 ## DW_AT_high_pc
98 .byte 6 ## DW_FORM_data4
101 .byte 2 ## Abbreviation Code
102 .byte 46 ## DW_TAG_subprogram
103 .byte 0 ## DW_CHILDREN_no
104 .byte 17 ## DW_AT_low_pc
105 .byte 1 ## DW_FORM_addr
106 .byte 18 ## DW_AT_high_pc
107 .byte 6 ## DW_FORM_data4
108 .byte 64 ## DW_AT_frame_base
109 .byte 24 ## DW_FORM_exprloc
110 .byte 49 ## DW_AT_abstract_origin
111 .byte 19 ## DW_FORM_ref4
114 .byte 3 ## Abbreviation Code
115 .byte 46 ## DW_TAG_subprogram
116 .byte 0 ## DW_CHILDREN_no
117 .byte 3 ## DW_AT_name
118 .byte 14 ## DW_FORM_strp
119 .byte 58 ## DW_AT_decl_file
120 .byte 11 ## DW_FORM_data1
121 .byte 59 ## DW_AT_decl_line
122 .byte 11 ## DW_FORM_data1
123 .byte 63 ## DW_AT_external
124 .byte 25 ## DW_FORM_flag_present
125 .byte 32 ## DW_AT_inline
126 .byte 11 ## DW_FORM_data1
129 .byte 4 ## Abbreviation Code
130 .byte 46 ## DW_TAG_subprogram
131 .byte 1 ## DW_CHILDREN_yes
132 .byte 17 ## DW_AT_low_pc
133 .byte 1 ## DW_FORM_addr
134 .byte 18 ## DW_AT_high_pc
135 .byte 6 ## DW_FORM_data4
136 .byte 64 ## DW_AT_frame_base
137 .byte 24 ## DW_FORM_exprloc
138 .byte 3 ## DW_AT_name
139 .byte 14 ## DW_FORM_strp
140 .byte 58 ## DW_AT_decl_file
141 .byte 11 ## DW_FORM_data1
142 .byte 59 ## DW_AT_decl_line
143 .byte 11 ## DW_FORM_data1
144 .byte 63 ## DW_AT_external
145 .byte 25 ## DW_FORM_flag_present
148 .byte 5 ## Abbreviation Code
149 .byte 29 ## DW_TAG_inlined_subroutine
150 .byte 0 ## DW_CHILDREN_no
151 .byte 49 ## DW_AT_abstract_origin
152 .byte 19 ## DW_FORM_ref4
153 .byte 17 ## DW_AT_low_pc
154 .byte 1 ## DW_FORM_addr
155 .byte 18 ## DW_AT_high_pc
156 .byte 6 ## DW_FORM_data4
157 .byte 88 ## DW_AT_call_file
158 .byte 11 ## DW_FORM_data1
159 .byte 89 ## DW_AT_call_line
160 .byte 11 ## DW_FORM_data1
164 .section __DWARF,__debug_info,regular,debug
167 .long 107 ## Length of Unit
168 .short 4 ## DWARF version number
169 Lset0
= Lsection_abbrev-Lsection_abbrev
## Offset Into Abbrev. Section
171 .byte 8 ## Address Size (in bytes)
172 .byte 1 ## Abbrev [1] 0xb:0x64 DW_TAG_compile_unit
173 .long 0 ## DW_AT_producer
174 .short 12 ## DW_AT_language
175 .long 21 ## DW_AT_name
176 Lset1
= Lline_table_start0-Lsection_line
## DW_AT_stmt_list
178 .long 31 ## DW_AT_comp_dir
179 .quad Lfunc_begin0 ## DW_AT_low_pc
180 Lset2
= Lfunc_end1-Lfunc_begin0
## DW_AT_high_pc
182 .byte 2 ## Abbrev [2] 0x2a:0x13 DW_TAG_subprogram
183 .quad Lfunc_begin0 ## DW_AT_low_pc
184 Lset3
= Lfunc_end0-Lfunc_begin0
## DW_AT_high_pc
186 .byte 1 ## DW_AT_frame_base
188 .long 61 ## DW_AT_abstract_origin
189 .byte 3 ## Abbrev [3] 0x3d:0x8 DW_TAG_subprogram
190 .long 44 ## DW_AT_name
191 .byte 1 ## DW_AT_decl_file
192 .byte 2 ## DW_AT_decl_line
194 .byte 1 ## DW_AT_inline
195 .byte 4 ## Abbrev [4] 0x45:0x29 DW_TAG_subprogram
196 .quad Lfunc_begin1 ## DW_AT_low_pc
197 Lset4
= Lfunc_end1-Lfunc_begin1
## DW_AT_high_pc
199 .byte 1 ## DW_AT_frame_base
201 .long 46 ## DW_AT_name
202 .byte 1 ## DW_AT_decl_file
203 .byte 5 ## DW_AT_decl_line
205 .byte 5 ## Abbrev [5] 0x5a:0x13 DW_TAG_inlined_subroutine
206 .long 90 ## DW_AT_abstract_origin <- We modified the value so the DIE references itself.
207 .quad Ltmp2 ## DW_AT_low_pc
208 Lset5
= Ltmp3-Ltmp2
## DW_AT_high_pc
210 .byte 1 ## DW_AT_call_file
211 .byte 6 ## DW_AT_call_line
212 .byte 0 ## End Of Children Mark
213 .byte 0 ## End Of Children Mark
214 .section __DWARF,__debug_ranges,regular,debug
216 .section __DWARF,__debug_macinfo,regular,debug
219 .byte 0 ## End Of Macro List Mark
220 .section __DWARF,__apple_names,regular,debug
222 .long 1212240712 ## Header Magic
223 .short 1 ## Header Version
224 .short 0 ## Header Hash Function
225 .long 2 ## Header Bucket Count
226 .long 2 ## Header Hash Count
227 .long 12 ## Header Data Length
228 .long 0 ## HeaderData Die Offset Base
229 .long 1 ## HeaderData Atom Count
230 .short 1 ## DW_ATOM_die_offset
231 .short 6 ## DW_FORM_data4
234 .long 177676 ## Hash in Bucket 0
235 .long 177677 ## Hash in Bucket 1
236 .long LNames0-Lnames_begin ## Offset in Bucket 0
237 .long LNames1-Lnames_begin ## Offset in Bucket 1
249 .section __DWARF,__apple_objc,regular,debug
251 .long 1212240712 ## Header Magic
252 .short 1 ## Header Version
253 .short 0 ## Header Hash Function
254 .long 1 ## Header Bucket Count
255 .long 0 ## Header Hash Count
256 .long 12 ## Header Data Length
257 .long 0 ## HeaderData Die Offset Base
258 .long 1 ## HeaderData Atom Count
259 .short 1 ## DW_ATOM_die_offset
260 .short 6 ## DW_FORM_data4
262 .section __DWARF,__apple_namespac,regular,debug
264 .long 1212240712 ## Header Magic
265 .short 1 ## Header Version
266 .short 0 ## Header Hash Function
267 .long 1 ## Header Bucket Count
268 .long 0 ## Header Hash Count
269 .long 12 ## Header Data Length
270 .long 0 ## HeaderData Die Offset Base
271 .long 1 ## HeaderData Atom Count
272 .short 1 ## DW_ATOM_die_offset
273 .short 6 ## DW_FORM_data4
275 .section __DWARF,__apple_types,regular,debug
277 .long 1212240712 ## Header Magic
278 .short 1 ## Header Version
279 .short 0 ## Header Hash Function
280 .long 1 ## Header Bucket Count
281 .long 0 ## Header Hash Count
282 .long 20 ## Header Data Length
283 .long 0 ## HeaderData Die Offset Base
284 .long 3 ## HeaderData Atom Count
285 .short 1 ## DW_ATOM_die_offset
286 .short 6 ## DW_FORM_data4
287 .short 3 ## DW_ATOM_die_tag
288 .short 5 ## DW_FORM_data2
289 .short 4 ## DW_ATOM_type_flags
290 .short 11 ## DW_FORM_data1
293 .subsections_via_symbols
294 .section __DWARF,__debug_line,regular,debug