Skip to content

Commit d5e33cc

Browse files
authored
[DebugInfo] Use human-friendly printing for DWARF column attributes (#71062)
1 parent 7d367bc commit d5e33cc

File tree

6 files changed

+113
-12
lines changed

6 files changed

+113
-12
lines changed

bolt/test/AArch64/go_dwarf.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ CHECKORIG-NEXT: DW_AT_external (true)
2323
CHECKORIG-NEXT: DW_AT_name ("main")
2424
CHECKORIG-NEXT: DW_AT_decl_file
2525
CHECKORIG-NEXT: DW_AT_decl_line (1)
26-
CHECKORIG-NEXT: DW_AT_decl_column (0x05)
26+
CHECKORIG-NEXT: DW_AT_decl_column (5)
2727
CHECKORIG-NEXT: DW_AT_type
2828
CHECKORIG-NEXT: DW_AT_low_pc (0x0000000000000660)
2929
CHECKORIG-NEXT: DW_AT_high_pc (0x0000000000000684)
@@ -47,7 +47,7 @@ CHECK-NEXT: DW_AT_external (true)
4747
CHECK-NEXT: DW_AT_name ("main")
4848
CHECK-NEXT: DW_AT_decl_file
4949
CHECK-NEXT: DW_AT_decl_line (1)
50-
CHECK-NEXT: DW_AT_decl_column (0x05)
50+
CHECK-NEXT: DW_AT_decl_column (5)
5151
CHECK-NEXT: DW_AT_type
5252
CHECK-NEXT: DW_AT_low_pc (0x0000000000000660)
5353
CHECK-NEXT: DW_AT_high_pc (0x0000000000000024)

bolt/test/X86/dwarf5-df-inlined-subroutine-range-0.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
; BOLT-MAIN: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x005a => {0x0000005a} "_Z11doStuffSamei")
2828
; BOLT-MAIN: DW_AT_call_file [DW_FORM_data1] (0x00)
2929
; BOLT-MAIN: DW_AT_call_line [DW_FORM_data1] (16)
30-
; BOLT-MAIN: DW_AT_call_column [DW_FORM_data1] (0x1d)
30+
; BOLT-MAIN: DW_AT_call_column [DW_FORM_data1] (29)
3131
; BOLT-MAIN: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = <unresolved>)
3232
; BOLT-MAIN: DW_AT_high_pc [DW_FORM_data4] (0x00000042)

llvm/lib/DebugInfo/DWARF/DWARFDie.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
147147

148148
if (!Name.empty())
149149
WithColor(OS, Color) << Name;
150-
else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line) {
150+
else if (Attr == DW_AT_decl_line || Attr == DW_AT_decl_column ||
151+
Attr == DW_AT_call_line || Attr == DW_AT_call_column) {
151152
if (std::optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
152153
OS << *Val;
153154
else

llvm/test/DebugInfo/X86/fission-inline.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
; CHECK-NOT: {{DW_AT|DW_TAG|NULL}}
7171
; CHECK: DW_AT_call_file
7272
; CHECK-NEXT: DW_AT_call_line {{.*}} (18)
73-
; CHECK-NEXT: DW_AT_call_column {{.*}} (0x05)
73+
; CHECK-NEXT: DW_AT_call_column {{.*}} (5)
7474
; CHECK: DW_AT_call_file
7575
; CHECK-NEXT: DW_AT_call_line {{.*}} (21)
7676
; CHECK-NOT: DW_

llvm/test/tools/llvm-dwarfdump/X86/locstats-for-absctract-origin-vars.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
## DW_AT_high_pc (0x0000000000000007)
3333
## DW_AT_call_file (0x01)
3434
## DW_AT_call_line (1)
35-
## DW_AT_call_column (0x01)
35+
## DW_AT_call_column (1)
3636
## DW_TAG_formal_parameter
3737
## DW_AT_abstract_origin (0x00000018)
3838
## DW_TAG_variable
@@ -44,7 +44,7 @@
4444
## DW_AT_high_pc (0x0000000000000007)
4545
## DW_AT_call_file (0x01)
4646
## DW_AT_call_line (1)
47-
## DW_AT_call_column (0x01)
47+
## DW_AT_call_column (1)
4848
## DW_TAG_formal_parameter
4949
## DW_AT_abstract_origin (0x00000018)
5050
## DW_AT_location ()
@@ -57,28 +57,28 @@
5757
## DW_AT_high_pc (0x0000000000000007)
5858
## DW_AT_call_file (0x01)
5959
## DW_AT_call_line (1)
60-
## DW_AT_call_column (0x01)
60+
## DW_AT_call_column (1)
6161
## DW_TAG_inlined_subroutine
6262
## DW_AT_abstract_origin (0x00000014)
6363
## DW_AT_low_pc (0x0000000000000002)
6464
## DW_AT_high_pc (0x000000000000000a)
6565
## DW_AT_call_file (0x01)
6666
## DW_AT_call_line (3)
67-
## DW_AT_call_column (0x03)
67+
## DW_AT_call_column (3)
6868
## DW_TAG_inlined_subroutine
6969
## DW_AT_abstract_origin (0x000000e5)
7070
## DW_AT_low_pc (0x0000000000000006)
7171
## DW_AT_high_pc (0x0000000000000010)
7272
## DW_AT_call_file (0x01)
7373
## DW_AT_call_line (3)
74-
## DW_AT_call_column (0x03)
74+
## DW_AT_call_column (3)
7575
## DW_TAG_inlined_subroutine
7676
## DW_AT_abstract_origin (0x000000e5)
7777
## DW_AT_low_pc (0x0000000000000006)
7878
## DW_AT_high_pc (0x0000000000000010)
7979
## DW_AT_call_file (0x01)
8080
## DW_AT_call_line (3)
81-
## DW_AT_call_column (0x03)
81+
## DW_AT_call_column (3)
8282
## DW_TAG_formal_parameter
8383
## DW_AT_abstract_origin (0x000000e9)
8484
## DW_AT_location ()
@@ -88,7 +88,7 @@
8888
## DW_AT_high_pc (0x000000000000001a)
8989
## DW_AT_call_file (0x01)
9090
## DW_AT_call_line (3)
91-
## DW_AT_call_column (0x03)
91+
## DW_AT_call_column (3)
9292
## DW_TAG_formal_parameter
9393
## DW_AT_abstract_origin (0x000000f4)
9494
## DW_TAG_lexical_block
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# RUN: yaml2obj %s | llvm-dwarfdump - | FileCheck %s
2+
3+
# CHECK: 0x0000001e: DW_TAG_subprogram
4+
# CHECK-NEXT: DW_AT_name ("main")
5+
# CHECK-NEXT: DW_AT_low_pc (0x0000000000001000)
6+
# CHECK-NEXT: DW_AT_high_pc (0x0000000000002000)
7+
# CHECK-NEXT: DW_AT_decl_line (5)
8+
# CHECK-NEXT: DW_AT_decl_column (2)
9+
# CHECK: 0x00000035: DW_TAG_inlined_subroutine
10+
# CHECK-NEXT: DW_AT_name ("inline1")
11+
# CHECK-NEXT: DW_AT_low_pc (0x0000000000001100)
12+
# CHECK-NEXT: DW_AT_high_pc (0x0000000000001200)
13+
# CHECK-NEXT: DW_AT_call_line (10)
14+
# CHECK-NEXT: DW_AT_call_column (6)
15+
16+
--- !ELF
17+
FileHeader:
18+
Class: ELFCLASS64
19+
Data: ELFDATA2LSB
20+
Type: ET_EXEC
21+
Machine: EM_X86_64
22+
DWARF:
23+
debug_str:
24+
- ''
25+
- '/tmp/main.c'
26+
- main
27+
- inline1
28+
debug_abbrev:
29+
- Table:
30+
- Code: 0x0000000000000001
31+
Tag: DW_TAG_compile_unit
32+
Children: DW_CHILDREN_yes
33+
Attributes:
34+
- Attribute: DW_AT_name
35+
Form: DW_FORM_strp
36+
- Attribute: DW_AT_language
37+
Form: DW_FORM_data2
38+
- Attribute: DW_AT_low_pc
39+
Form: DW_FORM_addr
40+
- Attribute: DW_AT_stmt_list
41+
Form: DW_FORM_sec_offset
42+
- Code: 0x0000000000000002
43+
Tag: DW_TAG_subprogram
44+
Children: DW_CHILDREN_yes
45+
Attributes:
46+
- Attribute: DW_AT_name
47+
Form: DW_FORM_strp
48+
- Attribute: DW_AT_low_pc
49+
Form: DW_FORM_addr
50+
- Attribute: DW_AT_high_pc
51+
Form: DW_FORM_addr
52+
- Attribute: DW_AT_decl_line
53+
Form: DW_FORM_data1
54+
- Attribute: DW_AT_decl_column
55+
Form: DW_FORM_data1
56+
- Code: 0x0000000000000003
57+
Tag: DW_TAG_inlined_subroutine
58+
Children: DW_CHILDREN_no
59+
Attributes:
60+
- Attribute: DW_AT_name
61+
Form: DW_FORM_strp
62+
- Attribute: DW_AT_low_pc
63+
Form: DW_FORM_addr
64+
- Attribute: DW_AT_high_pc
65+
Form: DW_FORM_data4
66+
- Attribute: DW_AT_call_line
67+
Form: DW_FORM_data1
68+
- Attribute: DW_AT_call_column
69+
Form: DW_FORM_data1
70+
debug_info:
71+
- Length: 0x0000000000000046
72+
Version: 4
73+
AbbrOffset: 0x0000000000000000
74+
AddrSize: 8
75+
Entries:
76+
- AbbrCode: 0x00000001
77+
Values:
78+
- Value: 0x0000000000000001
79+
- Value: 0x0000000000000002
80+
- Value: 0x0000000000000000
81+
- Value: 0x0000000000000000
82+
- AbbrCode: 0x00000002
83+
Values:
84+
- Value: 0x000000000000000D
85+
- Value: 0x0000000000001000
86+
- Value: 0x0000000000002000
87+
- Value: 0x0000000000000005
88+
- Value: 0x0000000000000002
89+
- AbbrCode: 0x00000003
90+
Values:
91+
- Value: 0x0000000000000012
92+
- Value: 0x0000000000001100
93+
- Value: 0x0000000000000100
94+
- Value: 0x000000000000000A
95+
- Value: 0x0000000000000006
96+
- AbbrCode: 0x00000000
97+
Values: []
98+
- AbbrCode: 0x00000000
99+
Values: []
100+
...

0 commit comments

Comments
 (0)