[llvm] r363800 - [llvm-dwarfdump] --gdb-index: fix uninitialized TuListOffset
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 19 06:51:30 PDT 2019
Author: maskray
Date: Wed Jun 19 06:51:29 2019
New Revision: 363800
URL: http://llvm.org/viewvc/llvm-project?rev=363800&view=rev
Log:
[llvm-dwarfdump] --gdb-index: fix uninitialized TuListOffset
The test only checks the existence of the `Types CU list` line.
Unfortunately I can't make a better test because
{gcc,clang} -fuse-ld={lld,gold} --gdb-index do not give me a non-empty types CU list.
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D63537
Modified:
llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
llvm/trunk/test/DebugInfo/dwarfdump-dump-gdbindex.test
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp?rev=363800&r1=363799&r2=363800&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp Wed Jun 19 06:51:29 2019
@@ -120,7 +120,7 @@ bool DWARFGdbIndex::parseImpl(DataExtrac
return false;
CuListOffset = Data.getU32(&Offset);
- uint32_t CuTypesOffset = Data.getU32(&Offset);
+ TuListOffset = Data.getU32(&Offset);
AddressAreaOffset = Data.getU32(&Offset);
SymbolTableOffset = Data.getU32(&Offset);
ConstantPoolOffset = Data.getU32(&Offset);
@@ -128,7 +128,7 @@ bool DWARFGdbIndex::parseImpl(DataExtrac
if (Offset != CuListOffset)
return false;
- uint32_t CuListSize = (CuTypesOffset - CuListOffset) / 16;
+ uint32_t CuListSize = (TuListOffset - CuListOffset) / 16;
CuList.reserve(CuListSize);
for (uint32_t i = 0; i < CuListSize; ++i) {
uint64_t CuOffset = Data.getU64(&Offset);
@@ -138,7 +138,7 @@ bool DWARFGdbIndex::parseImpl(DataExtrac
// CU Types are no longer needed as DWARF skeleton type units never made it
// into the standard.
- uint32_t TuListSize = (AddressAreaOffset - CuTypesOffset) / 24;
+ uint32_t TuListSize = (AddressAreaOffset - TuListOffset) / 24;
TuList.resize(TuListSize);
for (uint32_t I = 0; I < TuListSize; ++I) {
uint64_t CuOffset = Data.getU64(&Offset);
Modified: llvm/trunk/test/DebugInfo/dwarfdump-dump-gdbindex.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-dump-gdbindex.test?rev=363800&r1=363799&r2=363800&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarfdump-dump-gdbindex.test (original)
+++ llvm/trunk/test/DebugInfo/dwarfdump-dump-gdbindex.test Wed Jun 19 06:51:29 2019
@@ -17,6 +17,8 @@ RUN: llvm-dwarfdump -gdb-index %p/Inputs
; CHECK-NEXT: 0: Offset = 0x0, Length = 0x34
; CHECK-NEXT: 1: Offset = 0x34, Length = 0x34
+; CHECK: Types CU list offset = 0x38, has 0 entries:
+
; CHECK: Address area offset = 0x38, has 2 entries:
; CHECK-NEXT: Low/High address = [0x4000e8, 0x4000f3) (Size: 0xb), CU id = 0
; CHECK-NEXT: Low/High address = [0x4000f3, 0x4000fe) (Size: 0xb), CU id = 1
More information about the llvm-commits
mailing list