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