Skip to content

[DebugInfo] Use human-friendly printing for DWARF column attributes #71062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bolt/test/AArch64/go_dwarf.test
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CHECKORIG-NEXT: DW_AT_external (true)
CHECKORIG-NEXT: DW_AT_name ("main")
CHECKORIG-NEXT: DW_AT_decl_file
CHECKORIG-NEXT: DW_AT_decl_line (1)
CHECKORIG-NEXT: DW_AT_decl_column (0x05)
CHECKORIG-NEXT: DW_AT_decl_column (5)
CHECKORIG-NEXT: DW_AT_type
CHECKORIG-NEXT: DW_AT_low_pc (0x0000000000000660)
CHECKORIG-NEXT: DW_AT_high_pc (0x0000000000000684)
Expand All @@ -47,7 +47,7 @@ CHECK-NEXT: DW_AT_external (true)
CHECK-NEXT: DW_AT_name ("main")
CHECK-NEXT: DW_AT_decl_file
CHECK-NEXT: DW_AT_decl_line (1)
CHECK-NEXT: DW_AT_decl_column (0x05)
CHECK-NEXT: DW_AT_decl_column (5)
CHECK-NEXT: DW_AT_type
CHECK-NEXT: DW_AT_low_pc (0x0000000000000660)
CHECK-NEXT: DW_AT_high_pc (0x0000000000000024)
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-df-inlined-subroutine-range-0.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
; BOLT-MAIN: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x005a => {0x0000005a} "_Z11doStuffSamei")
; BOLT-MAIN: DW_AT_call_file [DW_FORM_data1] (0x00)
; BOLT-MAIN: DW_AT_call_line [DW_FORM_data1] (16)
; BOLT-MAIN: DW_AT_call_column [DW_FORM_data1] (0x1d)
; BOLT-MAIN: DW_AT_call_column [DW_FORM_data1] (29)
; BOLT-MAIN: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = <unresolved>)
; BOLT-MAIN: DW_AT_high_pc [DW_FORM_data4] (0x00000042)
3 changes: 2 additions & 1 deletion llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,

if (!Name.empty())
WithColor(OS, Color) << Name;
else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line) {
else if (Attr == DW_AT_decl_line || Attr == DW_AT_decl_column ||
Attr == DW_AT_call_line || Attr == DW_AT_call_column) {
if (std::optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
OS << *Val;
else
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/DebugInfo/X86/fission-inline.ll
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
; CHECK-NOT: {{DW_AT|DW_TAG|NULL}}
; CHECK: DW_AT_call_file
; CHECK-NEXT: DW_AT_call_line {{.*}} (18)
; CHECK-NEXT: DW_AT_call_column {{.*}} (0x05)
; CHECK-NEXT: DW_AT_call_column {{.*}} (5)
; CHECK: DW_AT_call_file
; CHECK-NEXT: DW_AT_call_line {{.*}} (21)
; CHECK-NOT: DW_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
## DW_AT_high_pc (0x0000000000000007)
## DW_AT_call_file (0x01)
## DW_AT_call_line (1)
## DW_AT_call_column (0x01)
## DW_AT_call_column (1)
## DW_TAG_formal_parameter
## DW_AT_abstract_origin (0x00000018)
## DW_TAG_variable
Expand All @@ -44,7 +44,7 @@
## DW_AT_high_pc (0x0000000000000007)
## DW_AT_call_file (0x01)
## DW_AT_call_line (1)
## DW_AT_call_column (0x01)
## DW_AT_call_column (1)
## DW_TAG_formal_parameter
## DW_AT_abstract_origin (0x00000018)
## DW_AT_location ()
Expand All @@ -57,28 +57,28 @@
## DW_AT_high_pc (0x0000000000000007)
## DW_AT_call_file (0x01)
## DW_AT_call_line (1)
## DW_AT_call_column (0x01)
## DW_AT_call_column (1)
## DW_TAG_inlined_subroutine
## DW_AT_abstract_origin (0x00000014)
## DW_AT_low_pc (0x0000000000000002)
## DW_AT_high_pc (0x000000000000000a)
## DW_AT_call_file (0x01)
## DW_AT_call_line (3)
## DW_AT_call_column (0x03)
## DW_AT_call_column (3)
## DW_TAG_inlined_subroutine
## DW_AT_abstract_origin (0x000000e5)
## DW_AT_low_pc (0x0000000000000006)
## DW_AT_high_pc (0x0000000000000010)
## DW_AT_call_file (0x01)
## DW_AT_call_line (3)
## DW_AT_call_column (0x03)
## DW_AT_call_column (3)
## DW_TAG_inlined_subroutine
## DW_AT_abstract_origin (0x000000e5)
## DW_AT_low_pc (0x0000000000000006)
## DW_AT_high_pc (0x0000000000000010)
## DW_AT_call_file (0x01)
## DW_AT_call_line (3)
## DW_AT_call_column (0x03)
## DW_AT_call_column (3)
## DW_TAG_formal_parameter
## DW_AT_abstract_origin (0x000000e9)
## DW_AT_location ()
Expand All @@ -88,7 +88,7 @@
## DW_AT_high_pc (0x000000000000001a)
## DW_AT_call_file (0x01)
## DW_AT_call_line (3)
## DW_AT_call_column (0x03)
## DW_AT_call_column (3)
## DW_TAG_formal_parameter
## DW_AT_abstract_origin (0x000000f4)
## DW_TAG_lexical_block
Expand Down
100 changes: 100 additions & 0 deletions llvm/test/tools/llvm-dwarfdump/X86/source-coordinates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# RUN: yaml2obj %s | llvm-dwarfdump - | FileCheck %s

# CHECK: 0x0000001e: DW_TAG_subprogram
# CHECK-NEXT: DW_AT_name ("main")
# CHECK-NEXT: DW_AT_low_pc (0x0000000000001000)
# CHECK-NEXT: DW_AT_high_pc (0x0000000000002000)
# CHECK-NEXT: DW_AT_decl_line (5)
# CHECK-NEXT: DW_AT_decl_column (2)
# CHECK: 0x00000035: DW_TAG_inlined_subroutine
# CHECK-NEXT: DW_AT_name ("inline1")
# CHECK-NEXT: DW_AT_low_pc (0x0000000000001100)
# CHECK-NEXT: DW_AT_high_pc (0x0000000000001200)
# CHECK-NEXT: DW_AT_call_line (10)
# CHECK-NEXT: DW_AT_call_column (6)

--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
DWARF:
debug_str:
- ''
- '/tmp/main.c'
- main
- inline1
debug_abbrev:
- Table:
- Code: 0x0000000000000001
Tag: DW_TAG_compile_unit
Children: DW_CHILDREN_yes
Attributes:
- Attribute: DW_AT_name
Form: DW_FORM_strp
- Attribute: DW_AT_language
Form: DW_FORM_data2
- Attribute: DW_AT_low_pc
Form: DW_FORM_addr
- Attribute: DW_AT_stmt_list
Form: DW_FORM_sec_offset
- Code: 0x0000000000000002
Tag: DW_TAG_subprogram
Children: DW_CHILDREN_yes
Attributes:
- Attribute: DW_AT_name
Form: DW_FORM_strp
- Attribute: DW_AT_low_pc
Form: DW_FORM_addr
- Attribute: DW_AT_high_pc
Form: DW_FORM_addr
- Attribute: DW_AT_decl_line
Form: DW_FORM_data1
- Attribute: DW_AT_decl_column
Form: DW_FORM_data1
- Code: 0x0000000000000003
Tag: DW_TAG_inlined_subroutine
Children: DW_CHILDREN_no
Attributes:
- Attribute: DW_AT_name
Form: DW_FORM_strp
- Attribute: DW_AT_low_pc
Form: DW_FORM_addr
- Attribute: DW_AT_high_pc
Form: DW_FORM_data4
- Attribute: DW_AT_call_line
Form: DW_FORM_data1
- Attribute: DW_AT_call_column
Form: DW_FORM_data1
debug_info:
- Length: 0x0000000000000046
Version: 4
AbbrOffset: 0x0000000000000000
AddrSize: 8
Entries:
- AbbrCode: 0x00000001
Values:
- Value: 0x0000000000000001
- Value: 0x0000000000000002
- Value: 0x0000000000000000
- Value: 0x0000000000000000
- AbbrCode: 0x00000002
Values:
- Value: 0x000000000000000D
- Value: 0x0000000000001000
- Value: 0x0000000000002000
- Value: 0x0000000000000005
- Value: 0x0000000000000002
- AbbrCode: 0x00000003
Values:
- Value: 0x0000000000000012
- Value: 0x0000000000001100
- Value: 0x0000000000000100
- Value: 0x000000000000000A
- Value: 0x0000000000000006
- AbbrCode: 0x00000000
Values: []
- AbbrCode: 0x00000000
Values: []
...