[PATCH] D63537: [llvm-dwarfdump] --gdb-index: fix uninitialized TuListOffset

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 06:06:06 PDT 2019


MaskRay updated this revision to Diff 205566.
MaskRay added a comment.

Update test/DebugInfo/dwarfdump-dump-gdbindex.test


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63537/new/

https://reviews.llvm.org/D63537

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
@@ -17,6 +17,8 @@
 ; 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
Index: lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
+++ lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
@@ -120,7 +120,7 @@
     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 @@
   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 @@
 
   // 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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63537.205566.patch
Type: text/x-patch
Size: 1818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190619/db5f05b7/attachment.bin>


More information about the llvm-commits mailing list