diff options
author | Fangrui Song <maskray@google.com> | 2018-11-05 23:27:53 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-11-05 23:27:53 +0000 |
commit | 54d23a8eb7eac3445450bacbe7a6336197ccdbf5 (patch) | |
tree | 17377c11937d33a6022ff7fcb13db103b4396024 /llvm/lib/DebugInfo | |
parent | 0b5f8169b026f2faf2713892ecc9c9e48646f5a4 (diff) | |
download | bcm5719-llvm-54d23a8eb7eac3445450bacbe7a6336197ccdbf5.tar.gz bcm5719-llvm-54d23a8eb7eac3445450bacbe7a6336197ccdbf5.zip |
[DWARF] Support types CU list in .gdb_index dumping
Some executables have non-empty types CU list and -gdb-index would report "<error reporting>" before.
llvm-svn: 346181
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp b/llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp index ebd6104ab87..1abd931e3b8 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp @@ -11,6 +11,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Format.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> #include <cassert> @@ -33,6 +34,16 @@ void DWARFGdbIndex::dumpCUList(raw_ostream &OS) const { CU.Length); } +void DWARFGdbIndex::dumpTUList(raw_ostream &OS) const { + OS << formatv("\n Types CU list offset = {0:x}, has {1} entries:\n", + TuListOffset, TuList.size()); + uint32_t I = 0; + for (const TypeUnitEntry &TU : TuList) + OS << formatv(" {0}: offset = {1:x8}, type_offset = {2:x8}, " + "type_signature = {3:x16}\n", + I++, TU.Offset, TU.TypeOffset, TU.TypeSignature); +} + void DWARFGdbIndex::dumpAddressArea(raw_ostream &OS) const { OS << format("\n Address area offset = 0x%x, has %" PRId64 " entries:", AddressAreaOffset, (uint64_t)AddressArea.size()) @@ -94,6 +105,7 @@ void DWARFGdbIndex::dump(raw_ostream &OS) { if (HasContent) { OS << " Version = " << Version << '\n'; dumpCUList(OS); + dumpTUList(OS); dumpAddressArea(OS); dumpSymbolTable(OS); dumpConstantPool(OS); @@ -127,9 +139,14 @@ bool DWARFGdbIndex::parseImpl(DataExtractor Data) { // CU Types are no longer needed as DWARF skeleton type units never made it // into the standard. - uint32_t CuTypesListSize = (AddressAreaOffset - CuTypesOffset) / 24; - if (CuTypesListSize != 0) - return false; + uint32_t TuListSize = (AddressAreaOffset - CuTypesOffset) / 24; + TuList.resize(TuListSize); + for (uint32_t I = 0; I < TuListSize; ++I) { + uint64_t CuOffset = Data.getU64(&Offset); + uint64_t TypeOffset = Data.getU64(&Offset); + uint64_t Signature = Data.getU64(&Offset); + TuList[I] = {CuOffset, TypeOffset, Signature}; + } uint32_t AddressAreaSize = (SymbolTableOffset - AddressAreaOffset) / 20; AddressArea.reserve(AddressAreaSize); |