xref: /llvm-project/llvm/test/DebugInfo/dwarfdump-dump-gdbindex-v8.test (revision 4d64fcdd43a195302de216b57ddb685b1aafe297)
1RUN: llvm-dwarfdump -gdb-index %p/Inputs/dwarfdump-gdbindex-v8.elf-x86-64 | FileCheck %s
2
3; main.cpp:
4; typedef struct
5; {
6;   unsigned a;
7;   unsigned b;
8; } S;
9;
10; int main() {
11;   S s;
12;   s.a = 0x64A40101;
13; }
14; helper.cpp:
15; typedef struct
16; {
17;   unsigned a;
18;   unsigned b;
19; } S2;
20;
21; int foo() {
22;   S2 s;
23;   s.a = 0x64A40101;
24; }
25; Compiled with:
26; clang++ -ggnu-pubnames -g2 -gdwarf-4 -fdebug-types-section -c test.cpp test2.cpp
27; ld.lld main.o helper.o -o dwarfdump-gdbindex-v8.elf-x86-64
28; gdb-11/bin/gdb-add-index dwarfdump-gdbindex-v8.elf-x86-64
29; clang version 17.0.0 (https://github.com/llvm/llvm-project.git 128b050d3c234c7238966349f8878884123a0030)
30; GNU gdb (GDB) 11.2
31; Info about gdb-index: https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html
32
33; CHECK-LABEL: .gdb_index contents:
34; CHECK: Version = 8
35
36; CHECK:      CU list offset = 0x18, has 2 entries:
37; CHECK-NEXT:   0: Offset = 0x0, Length = 0x6e
38; CHECK-NEXT:   1: Offset = 0x6e, Length = 0x72
39
40; CHECK:      Types CU list offset = 0x38, has 2 entries:
41; CHECK-NEXT:   0: offset = 0x00000000, type_offset = 0x0000001e, type_signature = 0x418503b8111e9a7b
42; CHECK-NEXT;   1: offset = 0x00000044, type_offset = 0x0000001e, type_signature = 0x00f6cca4e3a15118
43
44; CHECK:      Address area offset = 0x68, has 2 entries:
45; CHECK-NEXT:   Low/High address = [0x201180, 0x20118f) (Size: 0xf), CU id = 0
46; CHECK-NEXT:   Low/High address = [0x201190, 0x20119d) (Size: 0xd), CU id = 1
47
48; CHECK:        Symbol table offset = 0x90, size = 1024, filled slots:
49; CHECK-NEXT:     2: Name offset = 0x28, CU vector offset = 0x0
50; CHECK-NEXT:       String name: S, CU vector index: 0
51; CHECK-NEXT:     71: Name offset = 0x2a, CU vector offset = 0x8
52; CHECK-NEXT:       String name: S2, CU vector index: 1
53; CHECK-NEXT:     489: Name offset = 0x2d, CU vector offset = 0x10
54; CHECK-NEXT:       String name: main, CU vector index: 2
55; CHECK-NEXT:     661: Name offset = 0x32, CU vector offset = 0x18
56; CHECK-NEXT:       String name: foo, CU vector index: 3
57; CHECK-NEXT:     732: Name offset = 0x36, CU vector offset = 0x20
58; CHECK-NEXT:       String name: unsigned int, CU vector index: 4
59; CHECK-NEXT:     754: Name offset = 0x43, CU vector offset = 0x0
60; CHECK-NEXT:       String name: int, CU vector index: 0
61
62
63; CHECK:      Constant pool offset = 0x2090, has 5 CU vectors:
64; CHECK-NEXT:   0(0x0): 0x90000000
65; CHECK-NEXT:   1(0x8): 0x90000001
66; CHECK-NEXT:   2(0x10): 0x30000000
67; CHECK-NEXT:   3(0x18): 0x30000001
68; CHECK-NEXT:   4(0x20): 0x90000002
69