xref: /llvm-project/bolt/test/X86/dwarf4-split-gdb-index-types-gdb-generated.test (revision 33960ce5a8e26baf05521fd7f8be5c5abb6bb0ff)
1# REQUIRES: system-linux
2
3# RUN: rm -rf %t
4# RUN: mkdir -p %t
5# RUN: cd %t
6# RUN: llvm-mc --split-dwarf-file=main.dwo   -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-split-gdb-index-types-main.s -o maingdb.o
7# RUN: llvm-mc --split-dwarf-file=helper.dwo -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-split-gdb-index-types-helper.s -o helpergdb.o
8# RUN: %clang %cflags maingdb.o helpergdb.o -o maingdb.exe -Wl,-q
9# RUN: llvm-objcopy maingdb.exe --add-section=.gdb_index=%p/Inputs/dwarf4-split-gdb-index-types-v8.gdb-index
10# RUN: llvm-bolt maingdb.exe -o maingdb.exe.bolt --update-debug-sections
11# RUN: llvm-dwarfdump --gdb-index maingdb.exe.bolt | FileCheck --check-prefix=POSTCHECK %s
12
13## Tests that BOLT correctly handles gdb-index generated by GDB with split-dwarf DWARF4.
14
15# POSTCHECK:          Version = 8
16# POSTCHECK:          CU list offset = 0x18, has 2 entries
17# POSTCHECK-NEXT:         0: Offset = 0x0, Length = 0x34
18# POSTCHECK-NEXT:         1: Offset = 0x34, Length = 0x34
19# POSTCHECK:          Types CU list offset = 0x38, has 4 entries
20# POSTCHECK-NEXT:       0: offset = 0x0000004a, type_offset = 0x0000001e, type_signature = 0xb4580bc1535df1e4
21# POSTCHECK-NEXT:       1: offset = 0x00000000, type_offset = 0x0000001e, type_signature = 0x675d23e4f33235f2
22# POSTCHECK-NEXT:       2: offset = 0x0000004a, type_offset = 0x0000001e, type_signature = 0x49dc260088be7e56
23# POSTCHECK-NEXT:       3: offset = 0x00000000, type_offset = 0x0000001e, type_signature = 0x104ec427d2ebea6f
24# POSTCHECK:          Address area offset = 0x98, has 2 entries
25# POSTCHECK-NEXT:         Low/High address = [0x[[#%.4x,ADDR:]],
26# POSTCHECK-SAME:           0x[[#ADDR + 0x7a]]) (Size: 0x7a), CU id = 0
27# POSTCHECK-NEXT:         Low/High address = [0x[[#%.4x,ADDR1:]],
28# POSTCHECK-SAME:           0x[[#ADDR1 + 0x8]]) (Size: 0x8), CU id = 1
29# POSTCHECK:          Symbol table offset = 0xc0, size = 1024, filled slots
30# POSTCHECK-NEXT:       192: Name offset = 0x38, CU vector offset = 0x0
31# POSTCHECK-NEXT:         String name: Foo2, CU vector index: 0
32# POSTCHECK-NEXT:       193: Name offset = 0x3d, CU vector offset = 0x8
33# POSTCHECK-NEXT:         String name: Foo3, CU vector index: 1
34# POSTCHECK-NEXT:       489: Name offset = 0x42, CU vector offset = 0x10
35# POSTCHECK-NEXT:         String name: main, CU vector index: 2
36# POSTCHECK-NEXT:       518: Name offset = 0x47, CU vector offset = 0x18
37# POSTCHECK-NEXT:         String name: char, CU vector index: 3
38# POSTCHECK-NEXT:       560: Name offset = 0x4c, CU vector offset = 0x20
39# POSTCHECK-NEXT:         String name: Foo2a, CU vector index: 4
40# POSTCHECK-NEXT:       634: Name offset = 0x52, CU vector offset = 0x28
41# POSTCHECK-NEXT:         String name: Foo, CU vector index: 5
42# POSTCHECK-NEXT:       661: Name offset = 0x56, CU vector offset = 0x30
43# POSTCHECK-NEXT:         String name: foo, CU vector index: 6
44# POSTCHECK-NEXT:       754: Name offset = 0x5a, CU vector offset = 0x18
45# POSTCHECK-NEXT:         String name: int, CU vector index: 3
46# POSTCHECK:          Constant pool offset = 0x20c0, has 7 CU vectors
47# POSTCHECK-NEXT:       0(0x0): 0x10000003
48# POSTCHECK-NEXT:       1(0x8): 0x10000005
49# POSTCHECK-NEXT:       2(0x10): 0x30000000
50# POSTCHECK-NEXT:       3(0x18): 0x90000000
51# POSTCHECK-NEXT:       4(0x20): 0x10000004
52