Index: lib/DebugInfo/DWARF/DWARFGdbIndex.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFGdbIndex.cpp +++ lib/DebugInfo/DWARF/DWARFGdbIndex.cpp @@ -114,9 +114,9 @@ bool DWARFGdbIndex::parseImpl(DataExtractor Data) { uint32_t Offset = 0; - // Only version 7 is supported at this moment. + // Only versions 7 and 8 are supported at this moment. Version = Data.getU32(&Offset); - if (Version != 7) + if (Version != 7 && Version != 8) return false; CuListOffset = Data.getU32(&Offset); Index: test/DebugInfo/dwarfdump-dump-gdbindex.test =================================================================== --- test/DebugInfo/dwarfdump-dump-gdbindex.test +++ test/DebugInfo/dwarfdump-dump-gdbindex.test @@ -1,4 +1,10 @@ -RUN: llvm-dwarfdump -gdb-index %p/Inputs/dwarfdump-gdbindex-v7.elf-x86-64 | FileCheck %s +RUN: llvm-dwarfdump -gdb-index %p/Inputs/dwarfdump-gdbindex-v7.elf-x86-64 | \ +RUN: FileCheck --check-prefixes=CHECK,CHECK-V7 %s + +; Change the version number (first byte of .gdb_index) from 7 to 8. +RUN: cp %p/Inputs/dwarfdump-gdbindex-v7.elf-x86-64 %t +RUN: %python -c 'with open("%/t", "r+b") as f: f.seek(0x1748); f.write(b"\x08")' +RUN: llvm-dwarfdump -gdb-index %t | FileCheck --check-prefixes=CHECK,CHECK-V8 %s ; test.cpp: ; int main() { return 0; } @@ -11,7 +17,8 @@ ; Info about gdb-index: https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html ; CHECK-LABEL: .gdb_index contents: -; CHECK: Version = 7 +; CHECK-V7: Version = 7 +; CHECK-V8: Version = 8 ; CHECK: CU list offset = 0x18, has 2 entries: ; CHECK-NEXT: 0: Offset = 0x0, Length = 0x34