[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 00:46:38 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: dblaikie, ikudrin.
Herald added subscribers: llvm-commits, arphaman.
Herald added a project: LLVM.

Unfortunately I can't make a test because I don't know how to produce a
non-empty types CU list.


Repository:
  rL LLVM

https://reviews.llvm.org/D63537

Files:
  lib/DebugInfo/DWARF/DWARFGdbIndex.cpp


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.205516.patch
Type: text/x-patch
Size: 1207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190619/509c7ebf/attachment.bin>


More information about the llvm-commits mailing list