debug-info.ll
9.32 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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
; RUN: llc -filetype=obj %s -o - | llvm-readobj -r -S --symbols | FileCheck %s
; CHECK: Format: WASM
; CHECK-NEXT:Arch: wasm32
; CHECK-NEXT:AddressSize: 32bit
; CHECK-NEXT:Sections [
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: TYPE (0x1)
; CHECK-NEXT: Size: 4
; CHECK-NEXT: Offset: 8
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: IMPORT (0x2)
; CHECK-NEXT: Size: 58
; CHECK-NEXT: Offset: 18
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: FUNCTION (0x3)
; CHECK-NEXT: Size: 2
; CHECK-NEXT: Offset: 82
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: ELEM (0x9)
; CHECK-NEXT: Size: 7
; CHECK-NEXT: Offset: 90
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: DATACOUNT (0xC)
; CHECK-NEXT: Size: 1
; CHECK-NEXT: Offset: 103
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CODE (0xA)
; CHECK-NEXT: Size: 4
; CHECK-NEXT: Offset: 110
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: DATA (0xB)
; CHECK-NEXT: Size: 19
; CHECK-NEXT: Offset: 120
; CHECK-NEXT: Segments [
; CHECK-NEXT: Segment {
; CHECK-NEXT: Name: .data.foo
; CHECK-NEXT: Size: 4
; CHECK-NEXT: Offset: 0
; CHECK-NEXT: }
; CHECK-NEXT: Segment {
; CHECK-NEXT: Name: .data.ptr2
; CHECK-NEXT: Size: 4
; CHECK-NEXT: Offset: 4
; CHECK-NEXT: }
; CHECK-NEXT: ]
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 121
; CHECK-NEXT: Offset: 145
; CHECK-NEXT: Name: .debug_str
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 84
; CHECK-NEXT: Offset: 283
; CHECK-NEXT: Name: .debug_abbrev
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 106
; CHECK-NEXT: Offset: 387
; CHECK-NEXT: Name: .debug_info
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 42
; CHECK-NEXT: Offset: 511
; CHECK-NEXT: Name: .debug_pubnames
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 26
; CHECK-NEXT: Offset: 575
; CHECK-NEXT: Name: .debug_pubtypes
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 57
; CHECK-NEXT: Offset: 623
; CHECK-NEXT: Name: .debug_line
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 88
; CHECK-NEXT: Offset: 698
; CHECK-NEXT: Name: linking
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 9
; CHECK-NEXT: Offset: 800
; CHECK-NEXT: Name: reloc.DATA
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 58
; CHECK-NEXT: Offset: 826
; CHECK-NEXT: Name: reloc..debug_info
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 6
; CHECK-NEXT: Offset: 908
; CHECK-NEXT: Name: reloc..debug_pubnames
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 6
; CHECK-NEXT: Offset: 942
; CHECK-NEXT: Name: reloc..debug_pubtypes
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 6
; CHECK-NEXT: Offset: 976
; CHECK-NEXT: Name: reloc..debug_line
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 77
; CHECK-NEXT: Offset: 1006
; CHECK-NEXT: Name: producers
; CHECK-NEXT: }
; CHECK-NEXT:]
; CHECK-NEXT:Relocations [
; CHECK-NEXT: Section (7) DATA {
; CHECK-NEXT: 0x6 R_WASM_MEMORY_ADDR_I32 myextern 0
; CHECK-NEXT: 0xF R_WASM_TABLE_INDEX_I32 f2
; CHECK-NEXT: }
; CHECK-NEXT: Section (10) .debug_info {
; CHECK-NEXT: 0x6 R_WASM_SECTION_OFFSET_I32 .debug_abbrev 0
; CHECK-NEXT: 0xC R_WASM_SECTION_OFFSET_I32 .debug_str 0
; CHECK-NEXT: 0x12 R_WASM_SECTION_OFFSET_I32 .debug_str 55
; CHECK-NEXT: 0x16 R_WASM_SECTION_OFFSET_I32 .debug_line 0
; CHECK-NEXT: 0x1A R_WASM_SECTION_OFFSET_I32 .debug_str 62
; CHECK-NEXT: 0x1E R_WASM_FUNCTION_OFFSET_I32 f2 0
; CHECK-NEXT: 0x27 R_WASM_SECTION_OFFSET_I32 .debug_str 105
; CHECK-NEXT: 0x33 R_WASM_MEMORY_ADDR_I32 foo 0
; CHECK-NEXT: 0x3D R_WASM_SECTION_OFFSET_I32 .debug_str 109
; CHECK-NEXT: 0x44 R_WASM_SECTION_OFFSET_I32 .debug_str 113
; CHECK-NEXT: 0x50 R_WASM_MEMORY_ADDR_I32 ptr2 0
; CHECK-NEXT: 0x5B R_WASM_FUNCTION_OFFSET_I32 f2 0
; CHECK-NEXT: 0x63 R_WASM_SECTION_OFFSET_I32 .debug_str 118
; CHECK-NEXT: }
; CHECK-NEXT: Section (11) .debug_pubnames {
; CHECK-NEXT: 0x6 R_WASM_SECTION_OFFSET_I32 .debug_info 0
; CHECK-NEXT: }
; CHECK-NEXT: Section (12) .debug_pubtypes {
; CHECK-NEXT: 0x6 R_WASM_SECTION_OFFSET_I32 .debug_info 0
; CHECK-NEXT: }
; CHECK-NEXT: Section (13) .debug_line {
; CHECK-NEXT: 0x2B R_WASM_FUNCTION_OFFSET_I32 f2 0
; CHECK-NEXT: }
; CHECK-NEXT:]
; CHECK-NEXT:Symbols [
; CHECK-NEXT: Symbol {
; CHECK-NEXT: Name: f2
; CHECK-NEXT: Type: FUNCTION (0x0)
; CHECK-NEXT: Flags [ (0x4)
; CHECK-NEXT: VISIBILITY_HIDDEN (0x4)
; CHECK-NEXT: ]
; CHECK-NEXT: ElementIndex: 0x0
; CHECK-NEXT: }
; CHECK-NEXT: Symbol {
; CHECK-NEXT: Name: foo
; CHECK-NEXT: Type: DATA (0x1)
; CHECK-NEXT: Flags [ (0x4)
; CHECK-NEXT: VISIBILITY_HIDDEN (0x4)
; CHECK-NEXT: ]
; CHECK-NEXT: Offset: 0x0
; CHECK-NEXT: Segment: 0x0
; CHECK-NEXT: Size: 0x4
; CHECK-NEXT: }
; CHECK-NEXT: Symbol {
; CHECK-NEXT: Name: myextern
; CHECK-NEXT: Type: DATA (0x1)
; CHECK-NEXT: Flags [ (0x10)
; CHECK-NEXT: UNDEFINED (0x10)
; CHECK-NEXT: ]
; CHECK-NEXT: ImportName:
; CHECK-NEXT: ImportModule:
; CHECK-NEXT: }
; CHECK-NEXT: Symbol {
; CHECK-NEXT: Name: ptr2
; CHECK-NEXT: Type: DATA (0x1)
; CHECK-NEXT: Flags [ (0x4)
; CHECK-NEXT: VISIBILITY_HIDDEN (0x4)
; CHECK-NEXT: ]
; CHECK-NEXT: Offset: 0x0
; CHECK-NEXT: Segment: 0x1
; CHECK-NEXT: Size: 0x4
; CHECK-NEXT: }
; CHECK-NEXT: Symbol {
; CHECK-NEXT: Name: .debug_str
; CHECK-NEXT: Type: SECTION (0x3)
; CHECK-NEXT: Flags [ (0x2)
; CHECK-NEXT: BINDING_LOCAL (0x2)
; CHECK-NEXT: ]
; CHECK-NEXT: ElementIndex: 0x7
; CHECK-NEXT: }
; CHECK-NEXT: Symbol {
; CHECK-NEXT: Name: .debug_abbrev
; CHECK-NEXT: Type: SECTION (0x3)
; CHECK-NEXT: Flags [ (0x2)
; CHECK-NEXT: BINDING_LOCAL (0x2)
; CHECK-NEXT: ]
; CHECK-NEXT: ElementIndex: 0x8
; CHECK-NEXT: }
; CHECK-NEXT: Symbol {
; CHECK-NEXT: Name: .debug_info
; CHECK-NEXT: Type: SECTION (0x3)
; CHECK-NEXT: Flags [ (0x2)
; CHECK-NEXT: BINDING_LOCAL (0x2)
; CHECK-NEXT: ]
; CHECK-NEXT: ElementIndex: 0x9
; CHECK-NEXT: }
; CHECK-NEXT: Symbol {
; CHECK-NEXT: Name: .debug_line
; CHECK-NEXT: Type: SECTION (0x3)
; CHECK-NEXT: Flags [ (0x2)
; CHECK-NEXT: BINDING_LOCAL (0x2)
; CHECK-NEXT: ]
; CHECK-NEXT: ElementIndex: 0xC
; CHECK-NEXT: }
; CHECK-NEXT:]
; generated from the following C code using: clang --target=wasm32 -g -O0 -S -emit-llvm test.c
; extern int myextern;
; void f2(void) { return; }
;
; int* foo = &myextern;
; void (*ptr2)(void) = f2;
target triple = "wasm32-unknown-unknown"
source_filename = "test.c"
@myextern = external global i32, align 4
@foo = hidden global i32* @myextern, align 4, !dbg !0
@ptr2 = hidden global void ()* @f2, align 4, !dbg !6
; Function Attrs: noinline nounwind optnone
define hidden void @f2() #0 !dbg !17 {
entry:
ret void, !dbg !18
}
attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!13, !14, !15}
!llvm.ident = !{!16}
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 4, type: !11, isLocal: false, isDefinition: true)
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0 (trunk 332303) (llvm/trunk 332406)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
!3 = !DIFile(filename: "test.c", directory: "/usr/local/google/home/sbc/dev/wasm/simple")
!4 = !{}
!5 = !{!0, !6}
!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
!7 = distinct !DIGlobalVariable(name: "ptr2", scope: !2, file: !3, line: 5, type: !8, isLocal: false, isDefinition: true)
!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 32)
!9 = !DISubroutineType(types: !10)
!10 = !{null}
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 32)
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!13 = !{i32 2, !"Dwarf Version", i32 4}
!14 = !{i32 2, !"Debug Info Version", i32 3}
!15 = !{i32 1, !"wchar_size", i32 4}
!16 = !{!"clang version 7.0.0 (trunk 332303) (llvm/trunk 332406)"}
!17 = distinct !DISubprogram(name: "f2", scope: !3, file: !3, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)
!18 = !DILocation(line: 2, column: 17, scope: !17)