[llvm-dwarfdump] - Teach tool about few GNU call_sites constants.

This teaches tool about following consants: 
DW_TAG_GNU_call_site,
DW_TAG_GNU_call_site_parameter,
DW_AT_GNU_call_site_value,
DW_AT_GNU_all_call_sites.

Constants documented here: https://sourceware.org/elfutils/DwarfExtensions

Differential revision: https://reviews.llvm.org/D39119

llvm-svn: 316321
This commit is contained in:
George Rimar 2017-10-23 11:24:14 +00:00
parent 4b2bd5ff5e
commit 7fc298afe4
3 changed files with 124 additions and 1 deletions

View File

@ -176,6 +176,8 @@ HANDLE_DW_TAG(0x4103, class_template, 0, GNU)
HANDLE_DW_TAG(0x4106, GNU_template_template_param, 0, GNU)
HANDLE_DW_TAG(0x4107, GNU_template_parameter_pack, 0, GNU)
HANDLE_DW_TAG(0x4108, GNU_formal_parameter_pack, 0, GNU)
HANDLE_DW_TAG(0x4109, GNU_call_site, 0, GNU)
HANDLE_DW_TAG(0x410a, GNU_call_site_parameter, 0, GNU)
HANDLE_DW_TAG(0x4200, APPLE_property, 0, APPLE)
HANDLE_DW_TAG(0xb000, BORLAND_property, 0, BORLAND)
HANDLE_DW_TAG(0xb001, BORLAND_Delphi_string, 0, BORLAND)
@ -338,6 +340,8 @@ HANDLE_DW_AT(0x2106, body_end, 0, GNU)
HANDLE_DW_AT(0x2107, GNU_vector, 0, GNU)
HANDLE_DW_AT(0x2110, GNU_template_name, 0, GNU)
HANDLE_DW_AT(0x210f, GNU_odr_signature, 0, GNU)
HANDLE_DW_AT(0x2111, GNU_call_site_value, 0, GNU)
HANDLE_DW_AT(0x2117, GNU_all_call_sites, 0, GNU)
HANDLE_DW_AT(0x2119, GNU_macros, 0, GNU)
// Extensions for Fission proposal.
HANDLE_DW_AT(0x2130, GNU_dwo_name, 0, GNU)

View File

@ -234,7 +234,8 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line)
OS << *formValue.getAsUnsignedConstant();
else if (Attr == DW_AT_location || Attr == DW_AT_frame_base ||
Attr == DW_AT_data_member_location)
Attr == DW_AT_data_member_location ||
Attr == DW_AT_GNU_call_site_value)
dumpLocation(OS, formValue, U, sizeof(BaseIndent) + Indent + 4, DumpOpts);
else
formValue.dump(OS, DumpOpts);

View File

@ -0,0 +1,118 @@
# RUN: llvm-mc %s -filetype obj -triple i686-pc-linux -o %t
# RUN: llvm-dwarfdump %t | FileCheck %s
# CHECK: DW_TAG_subprogram
# CHECK-NEXT: DW_AT_external (true)
# CHECK-NEXT: DW_AT_name ("fn4")
# CHECK-NEXT: DW_AT_linkage_name ()
# CHECK-NEXT: DW_AT_low_pc (0x0000000000000000)
# CHECK-NEXT: DW_AT_high_pc (0x00000000)
# CHECK-NEXT: DW_AT_frame_base (DW_OP_call_frame_cfa)
# CHECK-NEXT: DW_AT_GNU_all_call_sites (true)
# CHECK: DW_TAG_GNU_call_site
# CHECK-NEXT: DW_AT_low_pc (0x0000000000000000)
# CHECK-NEXT: DW_AT_abstract_origin (cu + 0x0001)
# CHECK: DW_TAG_GNU_call_site_parameter
# CHECK-NEXT: DW_AT_location (DW_OP_reg0 EAX)
# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_addr 0x0)
.section .debug_info,"",@progbits
.long 0x47
.value 0x4
.long 0
.byte 0x4
.uleb128 0x1 # DW_TAG_compile_unit [1]
.long 0
.byte 0x0
.long 0
.long 0
.long 0
.long 0
.long 0
.uleb128 0xe # DW_TAG_subprogram [14]
.string "fn4"
.long 0
.long 0
.long 0
.uleb128 0x1 # DW_AT_GNU_all_call_sites
.byte 0x9c
.uleb128 0x12 # DW_TAG_GNU_call_site [18]
.long 0x0
.long 0x1
.uleb128 0x13 # DW_TAG_GNU_call_site_parameter [19]
.uleb128 0x1
.byte 0x50
.uleb128 0x5
.byte 0x3
.long X
.byte 0
.byte 0
.byte 0
.section .debug_abbrev,"",@progbits
.uleb128 0x1
.uleb128 0x11
.byte 0x1 # [1]
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x10
.uleb128 0x17
.byte 0
.byte 0
.uleb128 0xe # [14]
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0x8
.uleb128 0x6e
.uleb128 0xe
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2117
.uleb128 0x19
.byte 0
.byte 0
.uleb128 0x12 # [18]
.uleb128 0x4109
.byte 0x1
.uleb128 0x11
.uleb128 0x1
.uleb128 0x31
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x13 # [19]
.uleb128 0x410a
.byte 0
.uleb128 0x2
.uleb128 0x18
.uleb128 0x2111
.uleb128 0x18
.byte 0
.byte 0
.byte 0