Skip to content

Commit fbc6520

Browse files
authored
[llvm-dwarfdump] pretty-print DW_AT_call_origin reference (llvm#71693)
1 parent 87081f1 commit fbc6520

File tree

2 files changed

+89
-1
lines changed

2 files changed

+89
-1
lines changed

llvm/lib/DebugInfo/DWARF/DWARFDie.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
190190
// We have dumped the attribute raw value. For some attributes
191191
// having both the raw value and the pretty-printed value is
192192
// interesting. These attributes are handled below.
193-
if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin) {
193+
if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin ||
194+
Attr == DW_AT_call_origin) {
194195
if (const char *Name =
195196
Die.getAttributeValueAsReferencedDie(FormValue).getName(
196197
DINameKind::LinkageName))
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# RUN: yaml2obj %s | llvm-dwarfdump - | FileCheck %s
2+
3+
## Check the name (preferring linkage name) of the DW_AT_call_origin DIE
4+
## reference is printed after the address.
5+
6+
# CHECK: DW_TAG_call_site
7+
# CHECK-NEXT: DW_AT_call_origin (0x{{[0-9a-f]+}} "_Z2f2v")
8+
9+
# CHECK: DW_TAG_call_site
10+
# CHECK-NEXT: DW_AT_call_origin (0x{{[0-9a-f]+}} "f1")
11+
12+
--- !ELF
13+
FileHeader:
14+
Class: ELFCLASS64
15+
Data: ELFDATA2LSB
16+
Type: ET_EXEC
17+
Machine: EM_X86_64
18+
DWARF:
19+
debug_str:
20+
- "_Z2f2v"
21+
- "f2"
22+
- "f1"
23+
24+
debug_abbrev:
25+
- Table:
26+
- Code: 0x0000000000000001
27+
Tag: DW_TAG_compile_unit
28+
Children: DW_CHILDREN_yes
29+
Attributes:
30+
- Attribute: DW_AT_low_pc
31+
Form: DW_FORM_addr
32+
- Code: 0x0000000000000002
33+
Tag: DW_TAG_subprogram
34+
Children: DW_CHILDREN_yes
35+
Attributes:
36+
- Attribute: DW_AT_name
37+
Form: DW_FORM_strp
38+
- Attribute: DW_AT_low_pc
39+
Form: DW_FORM_addr
40+
- Attribute: DW_AT_high_pc
41+
Form: DW_FORM_addr
42+
- Code: 0x0000000000000003
43+
Tag: DW_TAG_call_site
44+
Children: DW_CHILDREN_no
45+
Attributes:
46+
- Attribute: DW_AT_call_origin
47+
Form: DW_FORM_ref4
48+
- Code: 0x0000000000000004
49+
Tag: DW_TAG_subprogram
50+
Children: DW_CHILDREN_no
51+
Attributes:
52+
- Attribute: DW_AT_linkage_name
53+
Form: DW_FORM_strp
54+
- Attribute: DW_AT_name
55+
Form: DW_FORM_strp
56+
- Attribute: DW_AT_declaration
57+
Form: DW_FORM_flag_present
58+
debug_info:
59+
- Length: 0x3b
60+
Version: 5
61+
UnitType: 0x01 # DW_TU_compile
62+
AbbrOffset: 0x0000000000000000
63+
AddrSize: 8
64+
Entries:
65+
- AbbrCode: 0x00000001 # start compile unit
66+
Values: #
67+
- Value: 0x0000000000000000 #
68+
- AbbrCode: 0x00000002 ## start f1
69+
Values: ##
70+
- Value: 0x000000000000000a ##
71+
- Value: 0x0000000000001000 ##
72+
- Value: 0x0000000000002000 ##
73+
- AbbrCode: 0x00000003 ### call site
74+
Values: ###
75+
- Value: 0x0000000000000035 ### (f2)
76+
- AbbrCode: 0x00000003 ### call site
77+
Values: ###
78+
- Value: 0x0000000000000015 ### (f1)
79+
- AbbrCode: 0x00000000 ## end f1
80+
Values: [] #
81+
- AbbrCode: 0x00000004 ## f2
82+
Values: ##
83+
- Value: 0x0000000000000000 ##
84+
- Value: 0x0000000000000007 ##
85+
- AbbrCode: 0x00000000 # end compile unit
86+
Values: []
87+
...

0 commit comments

Comments
 (0)