[llvm] r346181 - [DWARF] Support types CU list in .gdb_index dumping
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 5 15:27:53 PST 2018
Author: maskray
Date: Mon Nov 5 15:27:53 2018
New Revision: 346181
URL: http://llvm.org/viewvc/llvm-project?rev=346181&view=rev
Log:
[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.
Modified:
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h
llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h?rev=346181&r1=346180&r2=346181&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h Mon Nov 5 15:27:53 2018
@@ -24,6 +24,7 @@ class DWARFGdbIndex {
uint32_t Version;
uint32_t CuListOffset;
+ uint32_t TuListOffset;
uint32_t AddressAreaOffset;
uint32_t SymbolTableOffset;
uint32_t ConstantPoolOffset;
@@ -34,6 +35,13 @@ class DWARFGdbIndex {
};
SmallVector<CompUnitEntry, 0> CuList;
+ struct TypeUnitEntry {
+ uint64_t Offset;
+ uint64_t TypeOffset;
+ uint64_t TypeSignature;
+ };
+ SmallVector<TypeUnitEntry, 0> TuList;
+
struct AddressEntry {
uint64_t LowAddress; /// The low address.
uint64_t HighAddress; /// The high address.
@@ -55,6 +63,7 @@ class DWARFGdbIndex {
uint32_t StringPoolOffset;
void dumpCUList(raw_ostream &OS) const;
+ void dumpTUList(raw_ostream &OS) const;
void dumpAddressArea(raw_ostream &OS) const;
void dumpSymbolTable(raw_ostream &OS) const;
void dumpConstantPool(raw_ostream &OS) const;
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp?rev=346181&r1=346180&r2=346181&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp Mon Nov 5 15:27:53 2018
@@ -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_ostre
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(DataExtrac
// 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);
More information about the llvm-commits
mailing list