mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-10 05:41:40 +00:00
[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
This commit is contained in:
parent
487ffb554f
commit
648cb89d38
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user