Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 30abbf9

Browse files
committed
[llvm-dwarfdump] Print type names in DW_AT_type DIEs
This patch adds printing for DW_AT_type DIEs like it's currently already the case for DW_AT_specification DIEs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311492 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent bb516bc commit 30abbf9

File tree

2 files changed

+319
-1
lines changed

2 files changed

+319
-1
lines changed

lib/DebugInfo/DWARF/DWARFDie.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
135135
// We have dumped the attribute raw value. For some attributes
136136
// having both the raw value and the pretty-printed value is
137137
// interesting. These attributes are handled below.
138-
if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin) {
138+
if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin ||
139+
Attr == DW_AT_type) {
139140
if (const char *Name = Die.getAttributeValueAsReferencedDie(Attr).getName(DINameKind::LinkageName))
140141
OS << " \"" << Name << '\"';
141142
} else if (Attr == DW_AT_APPLE_property_attribute) {
Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,317 @@
1+
# RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \
2+
# RUN: | llvm-dwarfdump -debug-dump=info - \
3+
# RUN: | FileCheck %s
4+
5+
# $ cat verify_type_names.cpp
6+
# struct Struct {
7+
# int i;
8+
# };
9+
#
10+
# Struct Fn(int i) { return {i}; }
11+
# $ clang++ -g -S verify_type_names.cpp -std=c++11
12+
13+
# CHECK: DW_TAG_subprogram
14+
# CHECK: DW_AT_type {{.*}} "Struct"
15+
# CHECK: DW_TAG_formal_parameter
16+
# CHECK: DW_AT_type {{.*}} "int"
17+
# CHECK: DW_TAG_member
18+
# CHECK: DW_AT_type {{.*}} "int"
19+
20+
.section __TEXT,__text,regular,pure_instructions
21+
.macosx_version_min 10, 12
22+
.globl __Z2Fni ## -- Begin function _Z2Fni
23+
.p2align 4, 0x90
24+
__Z2Fni: ## @_Z2Fni
25+
Lfunc_begin0:
26+
.file 1 "verify_type_names.cpp"
27+
.loc 1 5 0 ## verify_type_names.cpp:5:0
28+
.cfi_startproc
29+
## BB#0: ## %entry
30+
pushq %rbp
31+
Lcfi0:
32+
.cfi_def_cfa_offset 16
33+
Lcfi1:
34+
.cfi_offset %rbp, -16
35+
movq %rsp, %rbp
36+
Lcfi2:
37+
.cfi_def_cfa_register %rbp
38+
movl %edi, -12(%rbp)
39+
Ltmp0:
40+
.loc 1 5 28 prologue_end ## verify_type_names.cpp:5:28
41+
movl -12(%rbp), %edi
42+
.loc 1 5 27 is_stmt 0 ## verify_type_names.cpp:5:27
43+
movl %edi, -8(%rbp)
44+
.loc 1 5 20 ## verify_type_names.cpp:5:20
45+
movl -8(%rbp), %eax
46+
popq %rbp
47+
retq
48+
Ltmp1:
49+
Lfunc_end0:
50+
.cfi_endproc
51+
## -- End function
52+
.section __DWARF,__debug_str,regular,debug
53+
Linfo_string:
54+
.asciz "clang version 6.0.0 (trunk 311115) (llvm/trunk 311450)" ## string offset=0
55+
.asciz "verify_type_names.cpp" ## string offset=55
56+
.asciz "/private/tmp" ## string offset=77
57+
.asciz "Fn" ## string offset=90
58+
.asciz "_Z2Fni" ## string offset=93
59+
.asciz "Struct" ## string offset=100
60+
.asciz "i" ## string offset=107
61+
.asciz "int" ## string offset=109
62+
.section __DWARF,__debug_abbrev,regular,debug
63+
Lsection_abbrev:
64+
.byte 1 ## Abbreviation Code
65+
.byte 17 ## DW_TAG_compile_unit
66+
.byte 1 ## DW_CHILDREN_yes
67+
.byte 37 ## DW_AT_producer
68+
.byte 14 ## DW_FORM_strp
69+
.byte 19 ## DW_AT_language
70+
.byte 5 ## DW_FORM_data2
71+
.byte 3 ## DW_AT_name
72+
.byte 14 ## DW_FORM_strp
73+
.byte 16 ## DW_AT_stmt_list
74+
.byte 23 ## DW_FORM_sec_offset
75+
.byte 27 ## DW_AT_comp_dir
76+
.byte 14 ## DW_FORM_strp
77+
.byte 17 ## DW_AT_low_pc
78+
.byte 1 ## DW_FORM_addr
79+
.byte 18 ## DW_AT_high_pc
80+
.byte 6 ## DW_FORM_data4
81+
.byte 0 ## EOM(1)
82+
.byte 0 ## EOM(2)
83+
.byte 2 ## Abbreviation Code
84+
.byte 46 ## DW_TAG_subprogram
85+
.byte 1 ## DW_CHILDREN_yes
86+
.byte 17 ## DW_AT_low_pc
87+
.byte 1 ## DW_FORM_addr
88+
.byte 18 ## DW_AT_high_pc
89+
.byte 6 ## DW_FORM_data4
90+
.byte 64 ## DW_AT_frame_base
91+
.byte 24 ## DW_FORM_exprloc
92+
.byte 110 ## DW_AT_linkage_name
93+
.byte 14 ## DW_FORM_strp
94+
.byte 3 ## DW_AT_name
95+
.byte 14 ## DW_FORM_strp
96+
.byte 58 ## DW_AT_decl_file
97+
.byte 11 ## DW_FORM_data1
98+
.byte 59 ## DW_AT_decl_line
99+
.byte 11 ## DW_FORM_data1
100+
.byte 73 ## DW_AT_type
101+
.byte 19 ## DW_FORM_ref4
102+
.byte 63 ## DW_AT_external
103+
.byte 25 ## DW_FORM_flag_present
104+
.byte 0 ## EOM(1)
105+
.byte 0 ## EOM(2)
106+
.byte 3 ## Abbreviation Code
107+
.byte 5 ## DW_TAG_formal_parameter
108+
.byte 0 ## DW_CHILDREN_no
109+
.byte 2 ## DW_AT_location
110+
.byte 24 ## DW_FORM_exprloc
111+
.byte 3 ## DW_AT_name
112+
.byte 14 ## DW_FORM_strp
113+
.byte 58 ## DW_AT_decl_file
114+
.byte 11 ## DW_FORM_data1
115+
.byte 59 ## DW_AT_decl_line
116+
.byte 11 ## DW_FORM_data1
117+
.byte 73 ## DW_AT_type
118+
.byte 19 ## DW_FORM_ref4
119+
.byte 0 ## EOM(1)
120+
.byte 0 ## EOM(2)
121+
.byte 4 ## Abbreviation Code
122+
.byte 19 ## DW_TAG_structure_type
123+
.byte 1 ## DW_CHILDREN_yes
124+
.byte 3 ## DW_AT_name
125+
.byte 14 ## DW_FORM_strp
126+
.byte 11 ## DW_AT_byte_size
127+
.byte 11 ## DW_FORM_data1
128+
.byte 58 ## DW_AT_decl_file
129+
.byte 11 ## DW_FORM_data1
130+
.byte 59 ## DW_AT_decl_line
131+
.byte 11 ## DW_FORM_data1
132+
.byte 0 ## EOM(1)
133+
.byte 0 ## EOM(2)
134+
.byte 5 ## Abbreviation Code
135+
.byte 13 ## DW_TAG_member
136+
.byte 0 ## DW_CHILDREN_no
137+
.byte 3 ## DW_AT_name
138+
.byte 14 ## DW_FORM_strp
139+
.byte 73 ## DW_AT_type
140+
.byte 19 ## DW_FORM_ref4
141+
.byte 58 ## DW_AT_decl_file
142+
.byte 11 ## DW_FORM_data1
143+
.byte 59 ## DW_AT_decl_line
144+
.byte 11 ## DW_FORM_data1
145+
.byte 56 ## DW_AT_data_member_location
146+
.byte 11 ## DW_FORM_data1
147+
.byte 0 ## EOM(1)
148+
.byte 0 ## EOM(2)
149+
.byte 6 ## Abbreviation Code
150+
.byte 36 ## DW_TAG_base_type
151+
.byte 0 ## DW_CHILDREN_no
152+
.byte 3 ## DW_AT_name
153+
.byte 14 ## DW_FORM_strp
154+
.byte 62 ## DW_AT_encoding
155+
.byte 11 ## DW_FORM_data1
156+
.byte 11 ## DW_AT_byte_size
157+
.byte 11 ## DW_FORM_data1
158+
.byte 0 ## EOM(1)
159+
.byte 0 ## EOM(2)
160+
.byte 0 ## EOM(3)
161+
.section __DWARF,__debug_info,regular,debug
162+
Lsection_info:
163+
Lcu_begin0:
164+
.long 111 ## Length of Unit
165+
.short 4 ## DWARF version number
166+
Lset0 = Lsection_abbrev-Lsection_abbrev ## Offset Into Abbrev. Section
167+
.long Lset0
168+
.byte 8 ## Address Size (in bytes)
169+
.byte 1 ## Abbrev [1] 0xb:0x68 DW_TAG_compile_unit
170+
.long 0 ## DW_AT_producer
171+
.short 4 ## DW_AT_language
172+
.long 55 ## DW_AT_name
173+
Lset1 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
174+
.long Lset1
175+
.long 77 ## DW_AT_comp_dir
176+
.quad Lfunc_begin0 ## DW_AT_low_pc
177+
Lset2 = Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc
178+
.long Lset2
179+
.byte 2 ## Abbrev [2] 0x2a:0x2c DW_TAG_subprogram
180+
.quad Lfunc_begin0 ## DW_AT_low_pc
181+
Lset3 = Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc
182+
.long Lset3
183+
.byte 1 ## DW_AT_frame_base
184+
.byte 86
185+
.long 93 ## DW_AT_linkage_name
186+
.long 90 ## DW_AT_name
187+
.byte 1 ## DW_AT_decl_file
188+
.byte 5 ## DW_AT_decl_line
189+
.long 86 ## DW_AT_type
190+
## DW_AT_external
191+
.byte 3 ## Abbrev [3] 0x47:0xe DW_TAG_formal_parameter
192+
.byte 2 ## DW_AT_location
193+
.byte 145
194+
.byte 116
195+
.long 107 ## DW_AT_name
196+
.byte 1 ## DW_AT_decl_file
197+
.byte 5 ## DW_AT_decl_line
198+
.long 107 ## DW_AT_type
199+
.byte 0 ## End Of Children Mark
200+
.byte 4 ## Abbrev [4] 0x56:0x15 DW_TAG_structure_type
201+
.long 100 ## DW_AT_name
202+
.byte 4 ## DW_AT_byte_size
203+
.byte 1 ## DW_AT_decl_file
204+
.byte 1 ## DW_AT_decl_line
205+
.byte 5 ## Abbrev [5] 0x5e:0xc DW_TAG_member
206+
.long 107 ## DW_AT_name
207+
.long 107 ## DW_AT_type
208+
.byte 1 ## DW_AT_decl_file
209+
.byte 2 ## DW_AT_decl_line
210+
.byte 0 ## DW_AT_data_member_location
211+
.byte 0 ## End Of Children Mark
212+
.byte 6 ## Abbrev [6] 0x6b:0x7 DW_TAG_base_type
213+
.long 109 ## DW_AT_name
214+
.byte 5 ## DW_AT_encoding
215+
.byte 4 ## DW_AT_byte_size
216+
.byte 0 ## End Of Children Mark
217+
.section __DWARF,__debug_ranges,regular,debug
218+
Ldebug_range:
219+
.section __DWARF,__debug_macinfo,regular,debug
220+
Ldebug_macinfo:
221+
Lcu_macro_begin0:
222+
.byte 0 ## End Of Macro List Mark
223+
.section __DWARF,__apple_names,regular,debug
224+
Lnames_begin:
225+
.long 1212240712 ## Header Magic
226+
.short 1 ## Header Version
227+
.short 0 ## Header Hash Function
228+
.long 2 ## Header Bucket Count
229+
.long 2 ## Header Hash Count
230+
.long 12 ## Header Data Length
231+
.long 0 ## HeaderData Die Offset Base
232+
.long 1 ## HeaderData Atom Count
233+
.short 1 ## DW_ATOM_die_offset
234+
.short 6 ## DW_FORM_data4
235+
.long -1 ## Bucket 0
236+
.long 0 ## Bucket 1
237+
.long 5862329 ## Hash in Bucket 1
238+
.long -336438995 ## Hash in Bucket 1
239+
.long LNames0-Lnames_begin ## Offset in Bucket 1
240+
.long LNames1-Lnames_begin ## Offset in Bucket 1
241+
LNames0:
242+
.long 90 ## Fn
243+
.long 1 ## Num DIEs
244+
.long 42
245+
.long 0
246+
LNames1:
247+
.long 93 ## _Z2Fni
248+
.long 1 ## Num DIEs
249+
.long 42
250+
.long 0
251+
.section __DWARF,__apple_objc,regular,debug
252+
Lobjc_begin:
253+
.long 1212240712 ## Header Magic
254+
.short 1 ## Header Version
255+
.short 0 ## Header Hash Function
256+
.long 1 ## Header Bucket Count
257+
.long 0 ## Header Hash Count
258+
.long 12 ## Header Data Length
259+
.long 0 ## HeaderData Die Offset Base
260+
.long 1 ## HeaderData Atom Count
261+
.short 1 ## DW_ATOM_die_offset
262+
.short 6 ## DW_FORM_data4
263+
.long -1 ## Bucket 0
264+
.section __DWARF,__apple_namespac,regular,debug
265+
Lnamespac_begin:
266+
.long 1212240712 ## Header Magic
267+
.short 1 ## Header Version
268+
.short 0 ## Header Hash Function
269+
.long 1 ## Header Bucket Count
270+
.long 0 ## Header Hash Count
271+
.long 12 ## Header Data Length
272+
.long 0 ## HeaderData Die Offset Base
273+
.long 1 ## HeaderData Atom Count
274+
.short 1 ## DW_ATOM_die_offset
275+
.short 6 ## DW_FORM_data4
276+
.long -1 ## Bucket 0
277+
.section __DWARF,__apple_types,regular,debug
278+
Ltypes_begin:
279+
.long 1212240712 ## Header Magic
280+
.short 1 ## Header Version
281+
.short 0 ## Header Hash Function
282+
.long 2 ## Header Bucket Count
283+
.long 2 ## Header Hash Count
284+
.long 20 ## Header Data Length
285+
.long 0 ## HeaderData Die Offset Base
286+
.long 3 ## HeaderData Atom Count
287+
.short 1 ## DW_ATOM_die_offset
288+
.short 6 ## DW_FORM_data4
289+
.short 3 ## DW_ATOM_die_tag
290+
.short 5 ## DW_FORM_data2
291+
.short 4 ## DW_ATOM_type_flags
292+
.short 11 ## DW_FORM_data1
293+
.long 0 ## Bucket 0
294+
.long -1 ## Bucket 1
295+
.long 193495088 ## Hash in Bucket 0
296+
.long -772878966 ## Hash in Bucket 0
297+
.long Ltypes1-Ltypes_begin ## Offset in Bucket 0
298+
.long Ltypes0-Ltypes_begin ## Offset in Bucket 0
299+
Ltypes1:
300+
.long 109 ## int
301+
.long 1 ## Num DIEs
302+
.long 107
303+
.short 36
304+
.byte 0
305+
.long 0
306+
Ltypes0:
307+
.long 100 ## Struct
308+
.long 1 ## Num DIEs
309+
.long 86
310+
.short 19
311+
.byte 0
312+
.long 0
313+
314+
.subsections_via_symbols
315+
.section __DWARF,__debug_line,regular,debug
316+
Lsection_line:
317+
Lline_table_start0:

0 commit comments

Comments
 (0)