dwp.s
11.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# REQUIRES: x86
# RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t --defsym MAIN=0
# RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t.dwp --defsym DWP=0
# RUN: %lldb %t -o "target variable A" -o "image lookup -v -n F1" -b | FileCheck %s
# RUN: lldb-test symbols %t | FileCheck %s --check-prefix=SYMBOLS
# CHECK-LABEL: target variable A
# CHECK: (INT0) A = 0
# CHECK: (INT1) A = 1
# CHECK: (INT2) A = 2
# CHECK: (INT3) A = 3
# CHECK-LABEL: image lookup -v -n F1
# CHECK: CompileUnit: id = {0x00000001}, file = "1.c", language = "unknown"
# CHECK: Function: {{.*}}, name = "F1", range = [0x0000000000000001-0x0000000000000002)
# CHECK: Variable: {{.*}}, name = "x", type = "int", location = DW_OP_reg1 RDX
# SYMBOLS: Compile units:
# SYMBOLS-NEXT: CompileUnit{0x00000000}, language = "unknown", file = '0.c'
# SYMBOLS-NEXT: Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x0
# SYMBOLS-NEXT: Function{{.*}}, demangled = F0
# SYMBOLS-NEXT: Block{{.*}}, ranges = [0x00000000-0x00000001)
# SYMBOLS-NEXT: Variable{{.*}}, name = "x", {{.*}}, location =
# SYMBOLS-NEXT: DW_LLE_startx_length (0x0000000000000001, 0x0000000000000001): DW_OP_reg0 RAX
# SYMBOLS-EMPTY:
# SYMBOLS-NEXT: CompileUnit{0x00000001}, language = "unknown", file = '1.c'
# SYMBOLS-NEXT: Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x2
# SYMBOLS-NEXT: Function{{.*}}, demangled = F1
# SYMBOLS-NEXT: Block{{.*}}, ranges = [0x00000001-0x00000002)
# SYMBOLS-NEXT: Variable{{.*}}, name = "x", {{.*}}, location =
# SYMBOLS-NEXT: DW_LLE_startx_length (0x0000000000000003, 0x0000000000000001): DW_OP_reg1 RDX
# SYMBOLS-EMPTY:
# SYMBOLS-NEXT: CompileUnit{0x00000002}, language = "unknown", file = '2.c'
# SYMBOLS-NEXT: Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x4
# SYMBOLS-NEXT: Function{{.*}}, demangled = F2
# SYMBOLS-NEXT: Block{{.*}}, ranges = [0x00000002-0x00000003)
# SYMBOLS-NEXT: Variable{{.*}}, name = "x", {{.*}}, location =
# SYMBOLS-NEXT: DW_LLE_startx_length (0x0000000000000005, 0x0000000000000001): DW_OP_reg2 RCX
# SYMBOLS-EMPTY:
# SYMBOLS-NEXT: CompileUnit{0x00000003}, language = "unknown", file = '3.c'
# SYMBOLS-NEXT: Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x6
# SYMBOLS-NEXT: Function{{.*}}, demangled = F3
# SYMBOLS-NEXT: Block{{.*}}, ranges = [0x00000003-0x00000004)
# SYMBOLS-NEXT: Variable{{.*}}, name = "x", {{.*}}, location =
# SYMBOLS-NEXT: DW_LLE_startx_length (0x0000000000000007, 0x0000000000000001): DW_OP_reg3 RBX
# SYMBOLS-EMPTY:
# SYMBOLS-NEXT: CompileUnit{0x00000004}, language = "unknown", file = ''
# SYMBOLS-EMPTY:
.section .debug_abbrev,"",@progbits
.byte 1 # Abbreviation Code
.byte 17 # DW_TAG_compile_unit
.byte 0 # DW_CHILDREN_no
.ascii "\260B" # DW_AT_GNU_dwo_name
.byte 8 # DW_FORM_string
.ascii "\261B" # DW_AT_GNU_dwo_id
.byte 7 # DW_FORM_data8
.ascii "\263B" # DW_AT_GNU_addr_base
.byte 23 # DW_FORM_sec_offset
.byte 85 # DW_AT_ranges
.byte 23 # DW_FORM_sec_offset
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 0 # EOM(3)
.ifdef MAIN
.irpc I,01234
.data
A\I:
.long \I
.text
F\I:
nop
.section .debug_info,"",@progbits
.Lcu_begin\I:
.long .Ldebug_info_end\I-.Ldebug_info_start\I # Length of Unit
.Ldebug_info_start\I:
.short 4 # DWARF version number
.long .debug_abbrev # Offset Into Abbrev. Section
.byte 8 # Address Size (in bytes)
.byte 1 # Abbrev [1] 0xb:0x25 DW_TAG_compile_unit
.asciz "A.dwo" # DW_AT_GNU_dwo_name
.quad \I # DW_AT_GNU_dwo_id
.long .debug_addr # DW_AT_GNU_addr_base
.long .Lranges\I # DW_AT_ranges
.Ldebug_info_end\I:
.section .debug_addr,"",@progbits
.quad A\I
.quad F\I
.section .debug_ranges,"",@progbits
.Lranges\I:
.quad F\I
.quad F\I+1
.quad 0
.quad 0
.endr
.endif
.ifdef DWP
# This deliberately excludes compile unit 4 to check test the case of a missing
# split unit.
.irpc I,0123
.section .debug_str.dwo,"MSe",@progbits,1
.Lstr\I:
.byte 'I', 'N', 'T', '0'+\I, 0
.section .debug_str_offsets.dwo,"e",@progbits
.Lstr_offsets\I:
.long .Lstr\I-.debug_str.dwo
.Lstr_offsets_end\I:
.section .debug_loc.dwo,"e",@progbits
.Lloc\I:
.byte 3 # DW_LLE_startx_length
.uleb128 \I*2+1
.long 1
.short 1 # Expression size
.byte 80+\I # super-register DW_OP_reg0+\I
.byte 0 # DW_LLE_end_of_list
.Lloc_end\I:
.section .debug_abbrev.dwo,"e",@progbits
.Labbrev\I:
.byte \I*10+1 # Abbreviation Code
.byte 17 # DW_TAG_compile_unit
.byte 1 # DW_CHILDREN_yes
.byte 37 # DW_AT_producer
.byte 8 # DW_FORM_string
.byte 3 # DW_AT_name
.byte 8 # DW_FORM_string
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte \I*10+2 # Abbreviation Code
.byte 52 # DW_TAG_variable
.byte 0 # DW_CHILDREN_no
.byte 3 # DW_AT_name
.byte 8 # DW_FORM_string
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 2 # DW_AT_location
.byte 24 # DW_FORM_exprloc
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte \I*10+3 # Abbreviation Code
.byte 36 # DW_TAG_base_type
.byte 0 # DW_CHILDREN_no
.byte 3 # DW_AT_name
.byte 8 # DW_FORM_string
.byte 62 # DW_AT_encoding
.byte 11 # DW_FORM_data1
.byte 11 # DW_AT_byte_size
.byte 11 # DW_FORM_data1
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte \I*10+4 # Abbreviation Code
.byte 22 # DW_TAG_typedef
.byte 0 # DW_CHILDREN_no
.byte 3 # DW_AT_name
.uleb128 0x1f02 # DW_FORM_GNU_str_index
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte \I*10+5 # Abbreviation Code
.byte 46 # DW_TAG_subprogram
.byte 1 # DW_CHILDREN_yes
.byte 17 # DW_AT_low_pc
.uleb128 0x1f01 # DW_FORM_GNU_addr_index
.byte 18 # DW_AT_high_pc
.byte 11 # DW_FORM_data1
.byte 3 # DW_AT_name
.byte 8 # DW_FORM_string
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte \I*10+6 # Abbreviation Code
.byte 5 # DW_TAG_formal_parameter
.byte 0 # DW_CHILDREN_no
.byte 2 # DW_AT_location
.byte 23 # DW_FORM_sec_offset
.byte 3 # DW_AT_name
.byte 8 # DW_FORM_string
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 0 # EOM(3)
.Labbrev_end\I:
.section .debug_info.dwo,"e",@progbits
.Lcu_begin\I:
.long .Ldebug_info_end\I-.Ldebug_info_start\I # Length of Unit
.Ldebug_info_start\I:
.short 4 # DWARF version number
.long 0 # Offset Into Abbrev. Section
.byte 8 # Address Size (in bytes)
.byte \I*10+1 # Abbrev DW_TAG_compile_unit
.asciz "Hand-written DWARF" # DW_AT_producer
.byte '0'+\I, '.', 'c', 0 # DW_AT_name
.byte \I*10+2 # Abbrev DW_TAG_variable
.asciz "A" # DW_AT_name
.long .Ltypedef\I-.Lcu_begin\I# DW_AT_type
.byte 2 # DW_AT_location
.byte 0xfb # DW_OP_GNU_addr_index
.byte \I*2
.Ltypedef\I:
.byte \I*10+4 # Abbrev DW_TAG_typedef
.byte 0 # DW_AT_name
.long .Ltype\I-.Lcu_begin\I # DW_AT_type
.Ltype\I:
.byte \I*10+3 # Abbrev DW_TAG_base_type
.asciz "int" # DW_AT_name
.byte 5 # DW_AT_encoding
.byte 4 # DW_AT_byte_size
.byte \I*10+5 # Abbrev DW_TAG_subprogram
.uleb128 \I*2+1 # DW_AT_low_pc
.byte 1 # DW_AT_high_pc
.byte 'F', '0'+\I, 0 # DW_AT_name
.byte \I*10+6 # Abbrev DW_TAG_formal_parameter
.long 0 # DW_AT_location
.asciz "x" # DW_AT_name
.long .Ltype\I-.Lcu_begin\I # DW_AT_type
.byte 0 # End Of Children Mark
.byte 0 # End Of Children Mark
.Ldebug_info_end\I:
.endr
.section .debug_cu_index,"",@progbits
.short 2 # DWARF version number
.short 0 # Reserved
.long 4 # Section count
.long 4 # Unit count
.long 8 # Slot count
.quad 0, 1, 2, 3, 0, 0, 0, 0 # Hash table
.long 1, 2, 3, 4, 0, 0, 0, 0 # Index table
.long 1 # DW_SECT_INFO
.long 3 # DW_SECT_ABBREV
.long 5 # DW_SECT_LOC
.long 6 # DW_SECT_STR_OFFSETS
.irpc I,0123
.long .Lcu_begin\I-.debug_info.dwo
.long .Labbrev\I-.debug_abbrev.dwo
.long .Lloc\I-.debug_loc.dwo
.long .Lstr_offsets\I-.debug_str_offsets.dwo
.endr
.irpc I,0123
.long .Ldebug_info_end\I-.Lcu_begin\I
.long .Labbrev_end\I-.Labbrev\I
.long .Lloc_end\I-.Lloc\I
.long .Lstr_offsets_end\I-.Lstr_offsets\I
.endr
.endif