1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

[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.

llvm-svn: 311492
This commit is contained in:
Jonas Devlieghere 2017-08-22 21:41:49 +00:00
parent 2028bd37c2
commit 8ce781ccc5
2 changed files with 319 additions and 1 deletions

View File

@ -135,7 +135,8 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
// We have dumped the attribute raw value. For some attributes
// having both the raw value and the pretty-printed value is
// interesting. These attributes are handled below.
if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin) {
if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin ||
Attr == DW_AT_type) {
if (const char *Name = Die.getAttributeValueAsReferencedDie(Attr).getName(DINameKind::LinkageName))
OS << " \"" << Name << '\"';
} else if (Attr == DW_AT_APPLE_property_attribute) {

View File

@ -0,0 +1,317 @@
# RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \
# RUN: | llvm-dwarfdump -debug-dump=info - \
# RUN: | FileCheck %s
# $ cat verify_type_names.cpp
# struct Struct {
# int i;
# };
#
# Struct Fn(int i) { return {i}; }
# $ clang++ -g -S verify_type_names.cpp -std=c++11
# CHECK: DW_TAG_subprogram
# CHECK: DW_AT_type {{.*}} "Struct"
# CHECK: DW_TAG_formal_parameter
# CHECK: DW_AT_type {{.*}} "int"
# CHECK: DW_TAG_member
# CHECK: DW_AT_type {{.*}} "int"
.section __TEXT,__text,regular,pure_instructions
.macosx_version_min 10, 12
.globl __Z2Fni ## -- Begin function _Z2Fni
.p2align 4, 0x90
__Z2Fni: ## @_Z2Fni
Lfunc_begin0:
.file 1 "verify_type_names.cpp"
.loc 1 5 0 ## verify_type_names.cpp:5:0
.cfi_startproc
## BB#0: ## %entry
pushq %rbp
Lcfi0:
.cfi_def_cfa_offset 16
Lcfi1:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Lcfi2:
.cfi_def_cfa_register %rbp
movl %edi, -12(%rbp)
Ltmp0:
.loc 1 5 28 prologue_end ## verify_type_names.cpp:5:28
movl -12(%rbp), %edi
.loc 1 5 27 is_stmt 0 ## verify_type_names.cpp:5:27
movl %edi, -8(%rbp)
.loc 1 5 20 ## verify_type_names.cpp:5:20
movl -8(%rbp), %eax
popq %rbp
retq
Ltmp1:
Lfunc_end0:
.cfi_endproc
## -- End function
.section __DWARF,__debug_str,regular,debug
Linfo_string:
.asciz "clang version 6.0.0 (trunk 311115) (llvm/trunk 311450)" ## string offset=0
.asciz "verify_type_names.cpp" ## string offset=55
.asciz "/private/tmp" ## string offset=77
.asciz "Fn" ## string offset=90
.asciz "_Z2Fni" ## string offset=93
.asciz "Struct" ## string offset=100
.asciz "i" ## string offset=107
.asciz "int" ## string offset=109
.section __DWARF,__debug_abbrev,regular,debug
Lsection_abbrev:
.byte 1 ## Abbreviation Code
.byte 17 ## DW_TAG_compile_unit
.byte 1 ## DW_CHILDREN_yes
.byte 37 ## DW_AT_producer
.byte 14 ## DW_FORM_strp
.byte 19 ## DW_AT_language
.byte 5 ## DW_FORM_data2
.byte 3 ## DW_AT_name
.byte 14 ## DW_FORM_strp
.byte 16 ## DW_AT_stmt_list
.byte 23 ## DW_FORM_sec_offset
.byte 27 ## DW_AT_comp_dir
.byte 14 ## DW_FORM_strp
.byte 17 ## DW_AT_low_pc
.byte 1 ## DW_FORM_addr
.byte 18 ## DW_AT_high_pc
.byte 6 ## DW_FORM_data4
.byte 0 ## EOM(1)
.byte 0 ## EOM(2)
.byte 2 ## Abbreviation Code
.byte 46 ## DW_TAG_subprogram
.byte 1 ## DW_CHILDREN_yes
.byte 17 ## DW_AT_low_pc
.byte 1 ## DW_FORM_addr
.byte 18 ## DW_AT_high_pc
.byte 6 ## DW_FORM_data4
.byte 64 ## DW_AT_frame_base
.byte 24 ## DW_FORM_exprloc
.byte 110 ## DW_AT_linkage_name
.byte 14 ## DW_FORM_strp
.byte 3 ## DW_AT_name
.byte 14 ## DW_FORM_strp
.byte 58 ## DW_AT_decl_file
.byte 11 ## DW_FORM_data1
.byte 59 ## DW_AT_decl_line
.byte 11 ## DW_FORM_data1
.byte 73 ## DW_AT_type
.byte 19 ## DW_FORM_ref4
.byte 63 ## DW_AT_external
.byte 25 ## DW_FORM_flag_present
.byte 0 ## EOM(1)
.byte 0 ## EOM(2)
.byte 3 ## Abbreviation Code
.byte 5 ## DW_TAG_formal_parameter
.byte 0 ## DW_CHILDREN_no
.byte 2 ## DW_AT_location
.byte 24 ## DW_FORM_exprloc
.byte 3 ## DW_AT_name
.byte 14 ## DW_FORM_strp
.byte 58 ## DW_AT_decl_file
.byte 11 ## DW_FORM_data1
.byte 59 ## DW_AT_decl_line
.byte 11 ## DW_FORM_data1
.byte 73 ## DW_AT_type
.byte 19 ## DW_FORM_ref4
.byte 0 ## EOM(1)
.byte 0 ## EOM(2)
.byte 4 ## Abbreviation Code
.byte 19 ## DW_TAG_structure_type
.byte 1 ## DW_CHILDREN_yes
.byte 3 ## DW_AT_name
.byte 14 ## DW_FORM_strp
.byte 11 ## DW_AT_byte_size
.byte 11 ## DW_FORM_data1
.byte 58 ## DW_AT_decl_file
.byte 11 ## DW_FORM_data1
.byte 59 ## DW_AT_decl_line
.byte 11 ## DW_FORM_data1
.byte 0 ## EOM(1)
.byte 0 ## EOM(2)
.byte 5 ## Abbreviation Code
.byte 13 ## DW_TAG_member
.byte 0 ## DW_CHILDREN_no
.byte 3 ## DW_AT_name
.byte 14 ## DW_FORM_strp
.byte 73 ## DW_AT_type
.byte 19 ## DW_FORM_ref4
.byte 58 ## DW_AT_decl_file
.byte 11 ## DW_FORM_data1
.byte 59 ## DW_AT_decl_line
.byte 11 ## DW_FORM_data1
.byte 56 ## DW_AT_data_member_location
.byte 11 ## DW_FORM_data1
.byte 0 ## EOM(1)
.byte 0 ## EOM(2)
.byte 6 ## Abbreviation Code
.byte 36 ## DW_TAG_base_type
.byte 0 ## DW_CHILDREN_no
.byte 3 ## DW_AT_name
.byte 14 ## DW_FORM_strp
.byte 62 ## DW_AT_encoding
.byte 11 ## DW_FORM_data1
.byte 11 ## DW_AT_byte_size
.byte 11 ## DW_FORM_data1
.byte 0 ## EOM(1)
.byte 0 ## EOM(2)
.byte 0 ## EOM(3)
.section __DWARF,__debug_info,regular,debug
Lsection_info:
Lcu_begin0:
.long 111 ## Length of Unit
.short 4 ## DWARF version number
Lset0 = Lsection_abbrev-Lsection_abbrev ## Offset Into Abbrev. Section
.long Lset0
.byte 8 ## Address Size (in bytes)
.byte 1 ## Abbrev [1] 0xb:0x68 DW_TAG_compile_unit
.long 0 ## DW_AT_producer
.short 4 ## DW_AT_language
.long 55 ## DW_AT_name
Lset1 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list
.long Lset1
.long 77 ## DW_AT_comp_dir
.quad Lfunc_begin0 ## DW_AT_low_pc
Lset2 = Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc
.long Lset2
.byte 2 ## Abbrev [2] 0x2a:0x2c DW_TAG_subprogram
.quad Lfunc_begin0 ## DW_AT_low_pc
Lset3 = Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc
.long Lset3
.byte 1 ## DW_AT_frame_base
.byte 86
.long 93 ## DW_AT_linkage_name
.long 90 ## DW_AT_name
.byte 1 ## DW_AT_decl_file
.byte 5 ## DW_AT_decl_line
.long 86 ## DW_AT_type
## DW_AT_external
.byte 3 ## Abbrev [3] 0x47:0xe DW_TAG_formal_parameter
.byte 2 ## DW_AT_location
.byte 145
.byte 116
.long 107 ## DW_AT_name
.byte 1 ## DW_AT_decl_file
.byte 5 ## DW_AT_decl_line
.long 107 ## DW_AT_type
.byte 0 ## End Of Children Mark
.byte 4 ## Abbrev [4] 0x56:0x15 DW_TAG_structure_type
.long 100 ## DW_AT_name
.byte 4 ## DW_AT_byte_size
.byte 1 ## DW_AT_decl_file
.byte 1 ## DW_AT_decl_line
.byte 5 ## Abbrev [5] 0x5e:0xc DW_TAG_member
.long 107 ## DW_AT_name
.long 107 ## DW_AT_type
.byte 1 ## DW_AT_decl_file
.byte 2 ## DW_AT_decl_line
.byte 0 ## DW_AT_data_member_location
.byte 0 ## End Of Children Mark
.byte 6 ## Abbrev [6] 0x6b:0x7 DW_TAG_base_type
.long 109 ## DW_AT_name
.byte 5 ## DW_AT_encoding
.byte 4 ## DW_AT_byte_size
.byte 0 ## End Of Children Mark
.section __DWARF,__debug_ranges,regular,debug
Ldebug_range:
.section __DWARF,__debug_macinfo,regular,debug
Ldebug_macinfo:
Lcu_macro_begin0:
.byte 0 ## End Of Macro List Mark
.section __DWARF,__apple_names,regular,debug
Lnames_begin:
.long 1212240712 ## Header Magic
.short 1 ## Header Version
.short 0 ## Header Hash Function
.long 2 ## Header Bucket Count
.long 2 ## Header Hash Count
.long 12 ## Header Data Length
.long 0 ## HeaderData Die Offset Base
.long 1 ## HeaderData Atom Count
.short 1 ## DW_ATOM_die_offset
.short 6 ## DW_FORM_data4
.long -1 ## Bucket 0
.long 0 ## Bucket 1
.long 5862329 ## Hash in Bucket 1
.long -336438995 ## Hash in Bucket 1
.long LNames0-Lnames_begin ## Offset in Bucket 1
.long LNames1-Lnames_begin ## Offset in Bucket 1
LNames0:
.long 90 ## Fn
.long 1 ## Num DIEs
.long 42
.long 0
LNames1:
.long 93 ## _Z2Fni
.long 1 ## Num DIEs
.long 42
.long 0
.section __DWARF,__apple_objc,regular,debug
Lobjc_begin:
.long 1212240712 ## Header Magic
.short 1 ## Header Version
.short 0 ## Header Hash Function
.long 1 ## Header Bucket Count
.long 0 ## Header Hash Count
.long 12 ## Header Data Length
.long 0 ## HeaderData Die Offset Base
.long 1 ## HeaderData Atom Count
.short 1 ## DW_ATOM_die_offset
.short 6 ## DW_FORM_data4
.long -1 ## Bucket 0
.section __DWARF,__apple_namespac,regular,debug
Lnamespac_begin:
.long 1212240712 ## Header Magic
.short 1 ## Header Version
.short 0 ## Header Hash Function
.long 1 ## Header Bucket Count
.long 0 ## Header Hash Count
.long 12 ## Header Data Length
.long 0 ## HeaderData Die Offset Base
.long 1 ## HeaderData Atom Count
.short 1 ## DW_ATOM_die_offset
.short 6 ## DW_FORM_data4
.long -1 ## Bucket 0
.section __DWARF,__apple_types,regular,debug
Ltypes_begin:
.long 1212240712 ## Header Magic
.short 1 ## Header Version
.short 0 ## Header Hash Function
.long 2 ## Header Bucket Count
.long 2 ## Header Hash Count
.long 20 ## Header Data Length
.long 0 ## HeaderData Die Offset Base
.long 3 ## HeaderData Atom Count
.short 1 ## DW_ATOM_die_offset
.short 6 ## DW_FORM_data4
.short 3 ## DW_ATOM_die_tag
.short 5 ## DW_FORM_data2
.short 4 ## DW_ATOM_type_flags
.short 11 ## DW_FORM_data1
.long 0 ## Bucket 0
.long -1 ## Bucket 1
.long 193495088 ## Hash in Bucket 0
.long -772878966 ## Hash in Bucket 0
.long Ltypes1-Ltypes_begin ## Offset in Bucket 0
.long Ltypes0-Ltypes_begin ## Offset in Bucket 0
Ltypes1:
.long 109 ## int
.long 1 ## Num DIEs
.long 107
.short 36
.byte 0
.long 0
Ltypes0:
.long 100 ## Struct
.long 1 ## Num DIEs
.long 86
.short 19
.byte 0
.long 0
.subsections_via_symbols
.section __DWARF,__debug_line,regular,debug
Lsection_line:
Lline_table_start0: