[PATCH] D64396: [DWARF] Dump .gdb_index of version 8
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 03:49:51 PDT 2019
MaskRay created this revision.
MaskRay added reviewers: dblaikie, grimar, ikudrin.
Herald added subscribers: llvm-commits, arphaman, aprantl.
Herald added a project: LLVM.
gdb index version was bumped from 7 to 8 by commit 796a7ff8234cfaa8ad1ab884c1c8dafe29b18d42.
The format doesn't change.
Accept version 8 so that we can dump .gdb_index built by the 'save gdb-index' command of gdb (Jan 2013 or newer). Manually verified the result is plausible:
mkdir dir; gdb a -batch -q -ex 'save gdb-index dir'; objcopy --add-section .gdb_index=dir/a.gdb-index --set-section-flags .gdb_index=readonly a b
llvm-dwarfdump -gdb-index b
Repository:
rL LLVM
https://reviews.llvm.org/D64396
Files:
lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
test/DebugInfo/dwarfdump-dump-gdbindex.test
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
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64396.208630.patch
Type: text/x-patch
Size: 1670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190709/3156e475/attachment.bin>
More information about the llvm-commits
mailing list