Skip to content

Commit a970f9f

Browse files
committed
add support for DW_OP_GNU_implicit_pointer
1 parent 3b5413c commit a970f9f

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

llvm/include/llvm/BinaryFormat/Dwarf.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,7 @@ HANDLE_DW_OP(0xed, WASM_location, -1, -1, 0, WASM)
887887
HANDLE_DW_OP(0xee, WASM_location_int, -1, -1, 0, WASM)
888888
// Historic and not implemented in LLVM.
889889
HANDLE_DW_OP(0xf0, APPLE_uninit, -1, -1, 0, APPLE)
890+
HANDLE_DW_OP(0xf2, GNU_implicit_pointer, 2, 0, 4, GNU)
890891
// The GNU entry value extension.
891892
HANDLE_DW_OP(0xf3, GNU_entry_value, 2, 0, 0, GNU)
892893
HANDLE_DW_OP(0xf8, PGI_omp_thread_num, -1, -1, 0, PGI)

llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ static std::vector<Desc> getOpDescriptions() {
104104
Descriptions[DW_OP_GNU_addr_index] = Desc(Op::Dwarf4, Op::SizeLEB);
105105
Descriptions[DW_OP_GNU_const_index] = Desc(Op::Dwarf4, Op::SizeLEB);
106106
Descriptions[DW_OP_GNU_entry_value] = Desc(Op::Dwarf4, Op::SizeLEB);
107+
Descriptions[DW_OP_GNU_implicit_pointer] =
108+
Desc(Op::Dwarf4, Op::SizeRefAddr, Op::SignedSizeLEB);
107109
// This Description acts as a marker that getSubOpDesc must be called
108110
// to fetch the final Description for the operation. Each such final
109111
// Description must share the same first SizeSubOpLEB operand.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Test that we can decode `DW_OP_GNU_implicit_pointer` (0xf2)
2+
# RUN: yaml2obj %s | llvm-dwarfdump - | FileCheck %s
3+
4+
# CHECK: DW_TAG_variable
5+
# CHECK-NEXT: DW_AT_location (DW_OP_GNU_implicit_pointer 0x2a +4)
6+
7+
--- !ELF
8+
FileHeader:
9+
Class: ELFCLASS64
10+
Data: ELFDATA2LSB
11+
Type: ET_DYN
12+
Machine: EM_X86_64
13+
DWARF:
14+
debug_abbrev:
15+
- Table:
16+
- Code: 0x00000001
17+
Tag: DW_TAG_compile_unit
18+
Children: DW_CHILDREN_yes
19+
Attributes:
20+
- Attribute: DW_AT_language
21+
Form: DW_FORM_data2
22+
- Attribute: DW_AT_low_pc
23+
Form: DW_FORM_addr
24+
- Attribute: DW_AT_high_pc
25+
Form: DW_FORM_data4
26+
- Code: 0x00000002
27+
Tag: DW_TAG_subprogram
28+
Children: DW_CHILDREN_yes
29+
Attributes:
30+
- Attribute: DW_AT_low_pc
31+
Form: DW_FORM_addr
32+
- Attribute: DW_AT_high_pc
33+
Form: DW_FORM_data4
34+
- Attribute: DW_AT_frame_base
35+
Form: DW_FORM_exprloc
36+
- Code: 0x00000003
37+
Tag: DW_TAG_formal_parameter
38+
Children: DW_CHILDREN_no
39+
Attributes:
40+
- Attribute: DW_AT_location
41+
Form: DW_FORM_exprloc
42+
- Code: 0x00000004
43+
Tag: DW_TAG_variable
44+
Children: DW_CHILDREN_no
45+
Attributes:
46+
- Attribute: DW_AT_location
47+
Form: DW_FORM_exprloc
48+
debug_info:
49+
- Length: 52
50+
Version: 5
51+
UnitType: DW_UT_compile
52+
AbbrOffset: 0
53+
AddrSize: 8
54+
Entries:
55+
- AbbrCode: 0x00000001
56+
Values:
57+
- Value: 0x000000000000000C
58+
- Value: 0x0000000100000F50
59+
- Value: 0x0000000000000034
60+
- AbbrCode: 0x00000002
61+
Values:
62+
- Value: 0x0000000100000F50
63+
- Value: 0x0000000000000034
64+
- Value: 0x0000000000000001
65+
BlockData:
66+
- 0x56
67+
- AbbrCode: 0x00000003
68+
Values:
69+
- Value: 0x0000000000000002
70+
BlockData:
71+
- 0x91
72+
- 0x78
73+
- AbbrCode: 0x00000004
74+
Values:
75+
- Value: 0x0000000000000006
76+
BlockData:
77+
- 0xf2 # DW_OP_GNU_implicit_pointer
78+
- 0x2a # Section offset of parameter in the previous entry
79+
- 0x00
80+
- 0x00
81+
- 0x00
82+
- 0x04 # Pointer references location 4 bytes into value of previous entry
83+
- AbbrCode: 0x00000000
84+
Values:
85+
- AbbrCode: 0x00000000
86+
Values:
87+
...

0 commit comments

Comments
 (0)