1 ## Test loading an ELF file with DWARF. First we make the ELF file from yaml,
2 ## then we convert the ELF file to GSYM, then we do lookups on the newly
3 ## created GSYM, and finally we dump the entire GSYM.
5 # RUN: yaml2obj %s -o %t
6 # RUN: llvm-gsymutil --convert %t -o %t.gsym 2>&1 | FileCheck %s --check-prefix=CONVERT
7 # RUN: llvm-gsymutil --address=0x400391 --address=0x4004cd %t.gsym 2>&1 | FileCheck %s --check-prefix=ADDR
8 # RUN: echo -e "0x400391 %/t.gsym\n0x4004cd %/t.gsym" | llvm-gsymutil --addresses-from-stdin 2>&1 | FileCheck %s --check-prefix=ADDRI --dump-input=always
9 # RUN: llvm-gsymutil --address=0x400391 --address=0x4004cd --verbose %t.gsym 2>&1 | FileCheck %s --check-prefix=ADDRV --dump-input=always
10 # RUN: llvm-gsymutil --address=0x400391 --address=0x4004cd --verbose %t.gsym 2>&1 | FileCheck %s --check-prefix=ADDRV --dump-input=always
11 # RUN: llvm-gsymutil %t.gsym 2>&1 | FileCheck %s --check-prefix=DUMP
13 # ADDR: Looking up addresses in "{{.*\.yaml\.tmp\.gsym}}":
14 # ADDR: 0x0000000000400391: _init
15 # ADDR: 0x00000000004004cd: main @ /tmp/main.cpp:1
17 # ADDRI: 0x0000000000400391: _init
19 # ADDRI: 0x00000000004004cd: main @ /tmp/main.cpp:1
22 # ADDRV: Looking up addresses in "{{.*\.yaml\.tmp\.gsym}}":
23 # ADDRV: FunctionInfo for 0x0000000000400391:
24 # ADDRV: [0x0000000000400390 - 0x0000000000400390) "_init"
25 # ADDRV: LookupResult for 0x0000000000400391:
26 # ADDRV: 0x0000000000400391: _init
27 # ADDRV: FunctionInfo for 0x00000000004004cd:
28 # ADDRV: [0x00000000004004cd - 0x00000000004004df) "main"
30 # ADDRV: 0x00000000004004cd /tmp/main.cpp:1
31 # ADDRV: 0x00000000004004d8 /tmp/main.cpp:2
32 # ADDRV: 0x00000000004004dd /tmp/main.cpp:3
33 # ADDRV: LookupResult for 0x00000000004004cd:
34 # ADDRV: 0x00000000004004cd: main @ /tmp/main.cpp:1
36 # CONVERT: Input file: {{.*\.yaml\.tmp}}
37 # CONVERT: Output file (x86_64): {{.*\.yaml\.tmp\.gsym}}
38 # CONVERT: Loaded 1 functions from DWARF.
39 # CONVERT: Loaded 10 functions from symbol table.
40 # CONVERT: Pruned 1 functions, ended with 10 total
43 # DUMP-NEXT: Magic = 0x4753594d
44 # DUMP-NEXT: Version = 0x0001
45 # DUMP-NEXT: AddrOffSize = 0x02
46 # DUMP-NEXT: UUIDSize = 0x14
47 # DUMP-NEXT: BaseAddress = 0x0000000000400000
48 # DUMP-NEXT: NumAddresses = 0x0000000a
49 # DUMP-NEXT: StrtabOffset = 0x00000080
50 # DUMP-NEXT: StrtabSize = 0x00000091
51 # DUMP-NEXT: UUID = 0e62be89cad89206110ed1375b618656f32ac906
53 # DUMP: Address Table:
54 # DUMP-NEXT: INDEX OFFSET16 (ADDRESS)
55 # DUMP-NEXT: ====== ===============================
56 # DUMP-NEXT: [ 0] 0x0390 (0x0000000000400390)
57 # DUMP-NEXT: [ 1] 0x03e0 (0x00000000004003e0)
58 # DUMP-NEXT: [ 2] 0x0410 (0x0000000000400410)
59 # DUMP-NEXT: [ 3] 0x0440 (0x0000000000400440)
60 # DUMP-NEXT: [ 4] 0x0480 (0x0000000000400480)
61 # DUMP-NEXT: [ 5] 0x04a0 (0x00000000004004a0)
62 # DUMP-NEXT: [ 6] 0x04cd (0x00000000004004cd)
63 # DUMP-NEXT: [ 7] 0x04e0 (0x00000000004004e0)
64 # DUMP-NEXT: [ 8] 0x0550 (0x0000000000400550)
65 # DUMP-NEXT: [ 9] 0x0554 (0x0000000000400554)
67 # DUMP: Address Info Offsets:
68 # DUMP-NEXT: INDEX Offset
69 # DUMP-NEXT: ====== ==========
70 # DUMP-NEXT: [ 0] 0x00000114
71 # DUMP-NEXT: [ 1] 0x00000124
72 # DUMP-NEXT: [ 2] 0x00000134
73 # DUMP-NEXT: [ 3] 0x00000144
74 # DUMP-NEXT: [ 4] 0x00000154
75 # DUMP-NEXT: [ 5] 0x00000164
76 # DUMP-NEXT: [ 6] 0x00000174
77 # DUMP-NEXT: [ 7] 0x00000194
78 # DUMP-NEXT: [ 8] 0x000001a4
79 # DUMP-NEXT: [ 9] 0x000001b4
82 # DUMP-NEXT: INDEX DIRECTORY BASENAME PATH
83 # DUMP-NEXT: ====== ========== ========== ==============================
84 # DUMP-NEXT: [ 0] 0x00000000 0x00000000
85 # DUMP-NEXT: [ 1] 0x00000006 0x0000000b /tmp/main.cpp
88 # DUMP-NEXT: 0x00000000: ""
89 # DUMP-NEXT: 0x00000001: "main"
90 # DUMP-NEXT: 0x00000006: "/tmp"
91 # DUMP-NEXT: 0x0000000b: "main.cpp"
92 # DUMP-NEXT: 0x00000014: "deregister_tm_clones"
93 # DUMP-NEXT: 0x00000029: "register_tm_clones"
94 # DUMP-NEXT: 0x0000003c: "__do_global_dtors_aux"
95 # DUMP-NEXT: 0x00000052: "frame_dummy"
96 # DUMP-NEXT: 0x0000005e: "__libc_csu_fini"
97 # DUMP-NEXT: 0x0000006e: "_fini"
98 # DUMP-NEXT: 0x00000074: "__libc_csu_init"
99 # DUMP-NEXT: 0x00000084: "_start"
100 # DUMP-NEXT: 0x0000008b: "_init"
101 # DUMP: FunctionInfo @ 0x00000114: [0x0000000000400390 - 0x0000000000400390) "_init"
102 # DUMP: FunctionInfo @ 0x00000124: [0x00000000004003e0 - 0x00000000004003e0) "_start"
103 # DUMP: FunctionInfo @ 0x00000134: [0x0000000000400410 - 0x0000000000400410) "deregister_tm_clones"
104 # DUMP: FunctionInfo @ 0x00000144: [0x0000000000400440 - 0x0000000000400440) "register_tm_clones"
105 # DUMP: FunctionInfo @ 0x00000154: [0x0000000000400480 - 0x0000000000400480) "__do_global_dtors_aux"
106 # DUMP: FunctionInfo @ 0x00000164: [0x00000000004004a0 - 0x00000000004004a0) "frame_dummy"
107 # DUMP: FunctionInfo @ 0x00000174: [0x00000000004004cd - 0x00000000004004df) "main"
108 # DUMP-NEXT: LineTable:
109 # DUMP-NEXT: 0x00000000004004cd /tmp/main.cpp:1
110 # DUMP-NEXT: 0x00000000004004d8 /tmp/main.cpp:2
111 # DUMP-NEXT: 0x00000000004004dd /tmp/main.cpp:3
112 # DUMP: FunctionInfo @ 0x00000194: [0x00000000004004e0 - 0x0000000000400545) "__libc_csu_init"
113 # DUMP: FunctionInfo @ 0x000001a4: [0x0000000000400550 - 0x0000000000400552) "__libc_csu_fini"
114 # DUMP: FunctionInfo @ 0x000001b4: [0x0000000000400554 - 0x000000000040055d) "_fini"
121 Entry: 0x00000000004003E0
126 Address: 0x0000000000400238
127 AddressAlign: 0x0000000000000001
128 Content: 2F6C696236342F6C642D6C696E75782D7838362D36342E736F2E3200
129 - Name: .note.ABI-tag
132 Address: 0x0000000000400254
133 AddressAlign: 0x0000000000000004
136 Desc: '00000000020000000600000020000000'
138 - Name: .note.gnu.build-id
141 Address: 0x0000000000400274
142 AddressAlign: 0x0000000000000004
145 Desc: 0E62BE89CAD89206110ED1375B618656F32AC906
150 Address: 0x0000000000400298
152 AddressAlign: 0x0000000000000008
156 BloomFilter: [ 0x0000000000000000 ]
157 HashBuckets: [ 0x00000000 ]
162 Address: 0x0000000000400338
164 AddressAlign: 0x0000000000000002
165 EntSize: 0x0000000000000002
167 - Name: .gnu.version_r
168 Type: SHT_GNU_verneed
170 Address: 0x0000000000400340
172 AddressAlign: 0x0000000000000008
173 Info: 0x0000000000000001
185 Address: 0x0000000000400360
187 AddressAlign: 0x0000000000000008
188 EntSize: 0x0000000000000018
190 - Offset: 0x0000000000600FF8
191 Symbol: __gmon_start__
192 Type: R_X86_64_GLOB_DAT
195 Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
196 Address: 0x0000000000400378
198 AddressAlign: 0x0000000000000008
199 EntSize: 0x0000000000000018
202 - Offset: 0x0000000000601018
203 Symbol: __libc_start_main
204 Type: R_X86_64_JUMP_SLOT
207 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
208 Address: 0x0000000000400390
209 AddressAlign: 0x0000000000000004
210 Content: 4883EC08488B055D0C20004885C07405E82B0000004883C408C3
213 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
214 Address: 0x00000000004003B0
215 AddressAlign: 0x0000000000000010
216 EntSize: 0x0000000000000010
217 Content: FF35520C2000FF25540C20000F1F4000FF25520C20006800000000E9E0FFFFFF
220 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
221 Address: 0x00000000004003D0
222 AddressAlign: 0x0000000000000008
223 Content: FF25220C20006690
226 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
227 Address: 0x00000000004003E0
228 AddressAlign: 0x0000000000000010
229 Content: 31ED4989D15E4889E24883E4F0505449C7C05005400048C7C1E004400048C7C7CD044000E8B7FFFFFFF4660F1F440000B82F10600055482D281060004883F80E4889E577025DC3B8000000004885C074F45DBF28106000FFE00F1F8000000000B82810600055482D2810600048C1F8034889E54889C248C1EA3F4801D048D1F875025DC3BA000000004885D274F45D4889C6BF28106000FFE20F1F8000000000803D9D0B2000007511554889E5E87EFFFFFF5DC6058A0B200001F3C30F1F400048833D7809200000741EB8000000004885C0741455BF200E60004889E5FFD05DE97BFFFFFF0F1F00E973FFFFFF554889E5897DFC488975F0B8000000005DC39041574189FF41564989F641554989D541544C8D251809200055488D2D18092000534C29E531DB48C1FD034883EC08E87DFEFFFF4885ED741E0F1F8400000000004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F840000000000F3C3
232 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
233 Address: 0x0000000000400554
234 AddressAlign: 0x0000000000000004
235 Content: 4883EC084883C408C3
239 Address: 0x0000000000400560
240 AddressAlign: 0x0000000000000008
241 Content: '01000200000000000000000000000000'
242 - Name: .eh_frame_hdr
245 Address: 0x0000000000400570
246 AddressAlign: 0x0000000000000004
247 Content: 011B033B340000000500000040FEFFFF8000000070FEFFFF500000005DFFFFFFA800000070FFFFFFC8000000E0FFFFFF10010000
251 Address: 0x00000000004005A8
252 AddressAlign: 0x0000000000000008
253 Content: 1400000000000000017A5200017810011B0C070890010710140000001C00000018FEFFFF2A00000000000000000000001400000000000000017A5200017810011B0C070890010000240000001C000000B8FDFFFF20000000000E10460E184A0F0B770880003F1A3B2A332422000000001C00000044000000ADFEFFFF1200000000410E108602430D064D0C07080000004400000064000000A0FEFFFF6500000000420E108F02450E188E03450E208D04450E288C05480E308606480E3883074D0E406C0E38410E30410E28420E20420E18420E10420E080014000000AC000000C8FEFFFF02000000000000000000000000000000
256 Flags: [ SHF_WRITE, SHF_ALLOC ]
257 Address: 0x0000000000600E10
258 AddressAlign: 0x0000000000000008
259 EntSize: 0x0000000000000008
260 Content: A004400000000000
263 Flags: [ SHF_WRITE, SHF_ALLOC ]
264 Address: 0x0000000000600E18
265 AddressAlign: 0x0000000000000008
266 EntSize: 0x0000000000000008
267 Content: '8004400000000000'
270 Flags: [ SHF_WRITE, SHF_ALLOC ]
271 Address: 0x0000000000600E20
272 AddressAlign: 0x0000000000000008
273 Content: '0000000000000000'
276 Flags: [ SHF_WRITE, SHF_ALLOC ]
277 Address: 0x0000000000600E28
279 AddressAlign: 0x0000000000000008
280 EntSize: 0x0000000000000010
283 Value: 0x0000000000000001
285 Value: 0x0000000000400390
287 Value: 0x0000000000400554
289 Value: 0x0000000000600E10
290 - Tag: DT_INIT_ARRAYSZ
291 Value: 0x0000000000000008
293 Value: 0x0000000000600E18
294 - Tag: DT_FINI_ARRAYSZ
295 Value: 0x0000000000000008
297 Value: 0x0000000000400298
299 Value: 0x0000000000400300
301 Value: 0x00000000004002B8
303 Value: 0x0000000000000038
305 Value: 0x0000000000000018
307 Value: 0x0000000000000000
309 Value: 0x0000000000601000
311 Value: 0x0000000000000018
313 Value: 0x0000000000000007
315 Value: 0x0000000000400378
317 Value: 0x0000000000400360
319 Value: 0x0000000000000018
321 Value: 0x0000000000000018
323 Value: 0x0000000000400340
325 Value: 0x0000000000000001
327 Value: 0x0000000000400338
329 Value: 0x0000000000000000
331 Value: 0x0000000000000000
333 Value: 0x0000000000000000
335 Value: 0x0000000000000000
337 Value: 0x0000000000000000
339 Value: 0x0000000000000000
342 Flags: [ SHF_WRITE, SHF_ALLOC ]
343 Address: 0x0000000000600FF8
344 AddressAlign: 0x0000000000000008
345 EntSize: 0x0000000000000008
346 Content: '0000000000000000'
349 Flags: [ SHF_WRITE, SHF_ALLOC ]
350 Address: 0x0000000000601000
351 AddressAlign: 0x0000000000000008
352 EntSize: 0x0000000000000008
353 Content: 280E60000000000000000000000000000000000000000000C603400000000000
356 Flags: [ SHF_WRITE, SHF_ALLOC ]
357 Address: 0x0000000000601020
358 AddressAlign: 0x0000000000000001
362 Flags: [ SHF_WRITE, SHF_ALLOC ]
363 Address: 0x0000000000601024
364 AddressAlign: 0x0000000000000001
365 Size: 0x0000000000000004
368 Flags: [ SHF_MERGE, SHF_STRINGS ]
369 AddressAlign: 0x0000000000000001
370 EntSize: 0x0000000000000001
371 Content: 4743433A2028474E552920342E382E3520323031353036323320285265642048617420342E382E352D33362900
372 - Name: .debug_aranges
374 AddressAlign: 0x0000000000000001
375 Content: 2C000000020000000000080000000000CD04400000000000120000000000000000000000000000000000000000000000
378 AddressAlign: 0x0000000000000001
379 Content: 8700000004000000000008011D000000040F00000005000000CD04400000000000120000000000000000000000020A00000001016B000000CD044000000000001200000000000000019C6B000000031800000001016B00000002916C030000000001017200000002916000040405696E740005087800000005087E00000006830000000701066B00000000
380 - Name: .debug_abbrev
382 AddressAlign: 0x0000000000000001
383 Content: 011101250E130B030E1B0E1101120710170000022E013F19030E3A0B3B0B491311011207401897421901130000030500030E3A0B3B0B4913021800000424000B0B3E0B03080000050F000B0B49130000062600491300000724000B0B3E0B030E000000
386 AddressAlign: 0x0000000000000001
387 Content: 3800000002001F0000000101FB0E0D000101010100000001000001006D61696E2E6370700000000000000902CD0440000000000001AD590202000101
390 Flags: [ SHF_MERGE, SHF_STRINGS ]
391 AddressAlign: 0x0000000000000001
392 EntSize: 0x0000000000000001
393 Content: 61726776002F746D70006D61696E006D61696E2E637070006172676300474E5520432B2B20342E382E3520323031353036323320285265642048617420342E382E352D333629202D6D74756E653D67656E65726963202D6D617263683D7838362D3634202D67202D4F30006368617200
396 Flags: [ PF_X, PF_R ]
397 VAddr: 0x0000000000400000
405 Value: 0x0000000000400238
406 - Name: .note.ABI-tag
408 Section: .note.ABI-tag
409 Value: 0x0000000000400254
410 - Name: .note.gnu.build-id
412 Section: .note.gnu.build-id
413 Value: 0x0000000000400274
417 Value: 0x0000000000400298
421 Value: 0x00000000004002B8
425 Value: 0x0000000000400300
428 Section: .gnu.version
429 Value: 0x0000000000400338
430 - Name: .gnu.version_r
432 Section: .gnu.version_r
433 Value: 0x0000000000400340
437 Value: 0x0000000000400360
441 Value: 0x0000000000400378
445 Value: 0x0000000000400390
449 Value: 0x00000000004003B0
453 Value: 0x00000000004003D0
457 Value: 0x00000000004003E0
461 Value: 0x0000000000400554
465 Value: 0x0000000000400560
466 - Name: .eh_frame_hdr
468 Section: .eh_frame_hdr
469 Value: 0x0000000000400570
473 Value: 0x00000000004005A8
477 Value: 0x0000000000600E10
481 Value: 0x0000000000600E18
485 Value: 0x0000000000600E20
489 Value: 0x0000000000600E28
493 Value: 0x0000000000600FF8
497 Value: 0x0000000000601000
501 Value: 0x0000000000601020
505 Value: 0x0000000000601024
509 - Name: .debug_aranges
511 Section: .debug_aranges
515 - Name: .debug_abbrev
517 Section: .debug_abbrev
530 Value: 0x0000000000600E20
531 - Name: deregister_tm_clones
534 Value: 0x0000000000400410
535 - Name: register_tm_clones
538 Value: 0x0000000000400440
539 - Name: __do_global_dtors_aux
542 Value: 0x0000000000400480
543 - Name: completed.6355
546 Value: 0x0000000000601024
547 Size: 0x0000000000000001
548 - Name: __do_global_dtors_aux_fini_array_entry
551 Value: 0x0000000000600E18
555 Value: 0x00000000004004A0
556 - Name: __frame_dummy_init_array_entry
559 Value: 0x0000000000600E10
563 - Name: 'crtstuff.c (1)'
566 - Name: __FRAME_END__
569 Value: 0x0000000000400698
573 Value: 0x0000000000600E20
576 - Name: __init_array_end
578 Value: 0x0000000000600E18
582 Value: 0x0000000000600E28
583 - Name: __init_array_start
585 Value: 0x0000000000600E10
586 - Name: __GNU_EH_FRAME_HDR
587 Section: .eh_frame_hdr
588 Value: 0x0000000000400570
589 - Name: _GLOBAL_OFFSET_TABLE_
592 Value: 0x0000000000601000
593 - Name: __libc_csu_fini
597 Value: 0x0000000000400550
598 Size: 0x0000000000000002
602 Value: 0x0000000000601020
606 Value: 0x0000000000601024
611 Value: 0x0000000000400554
612 - Name: '__libc_start_main@@GLIBC_2.2.5'
618 Value: 0x0000000000601020
619 - Name: __gmon_start__
625 Value: 0x0000000000400568
626 Other: [ STV_HIDDEN ]
627 - Name: _IO_stdin_used
631 Value: 0x0000000000400560
632 Size: 0x0000000000000004
633 - Name: __libc_csu_init
637 Value: 0x00000000004004E0
638 Size: 0x0000000000000065
642 Value: 0x0000000000601028
647 Value: 0x00000000004003E0
651 Value: 0x0000000000601024
656 Value: 0x00000000004004CD
657 Size: 0x0000000000000012
662 Value: 0x0000000000601028
663 Other: [ STV_HIDDEN ]
668 Value: 0x0000000000400390
670 - Name: __libc_start_main
673 - Name: __gmon_start__