llvm.org GIT mirror llvm / 1d019ae
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346181 91177308-0d34-0410-b5e6-96231b3b80d8 Fangrui Song 11 months ago
2 changed file(s) with 29 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
2323 uint32_t Version;
2424
2525 uint32_t CuListOffset;
26 uint32_t TuListOffset;
2627 uint32_t AddressAreaOffset;
2728 uint32_t SymbolTableOffset;
2829 uint32_t ConstantPoolOffset;
3233 uint64_t Length; /// Length of that CU.
3334 };
3435 SmallVector CuList;
36
37 struct TypeUnitEntry {
38 uint64_t Offset;
39 uint64_t TypeOffset;
40 uint64_t TypeSignature;
41 };
42 SmallVector TuList;
3543
3644 struct AddressEntry {
3745 uint64_t LowAddress; /// The low address.
5462 uint32_t StringPoolOffset;
5563
5664 void dumpCUList(raw_ostream &OS) const;
65 void dumpTUList(raw_ostream &OS) const;
5766 void dumpAddressArea(raw_ostream &OS) const;
5867 void dumpSymbolTable(raw_ostream &OS) const;
5968 void dumpConstantPool(raw_ostream &OS) const;
1010 #include "llvm/ADT/SmallVector.h"
1111 #include "llvm/ADT/StringRef.h"
1212 #include "llvm/Support/Format.h"
13 #include "llvm/Support/FormatVariadic.h"
1314 #include "llvm/Support/raw_ostream.h"
1415 #include
1516 #include
3031 for (const CompUnitEntry &CU : CuList)
3132 OS << format(" %d: Offset = 0x%llx, Length = 0x%llx\n", I++, CU.Offset,
3233 CU.Length);
34 }
35
36 void DWARFGdbIndex::dumpTUList(raw_ostream &OS) const {
37 OS << formatv("\n Types CU list offset = {0:x}, has {1} entries:\n",
38 TuListOffset, TuList.size());
39 uint32_t I = 0;
40 for (const TypeUnitEntry &TU : TuList)
41 OS << formatv(" {0}: offset = {1:x8}, type_offset = {2:x8}, "
42 "type_signature = {3:x16}\n",
43 I++, TU.Offset, TU.TypeOffset, TU.TypeSignature);
3344 }
3445
3546 void DWARFGdbIndex::dumpAddressArea(raw_ostream &OS) const {
93104 if (HasContent) {
94105 OS << " Version = " << Version << '\n';
95106 dumpCUList(OS);
107 dumpTUList(OS);
96108 dumpAddressArea(OS);
97109 dumpSymbolTable(OS);
98110 dumpConstantPool(OS);
126138
127139 // CU Types are no longer needed as DWARF skeleton type units never made it
128140 // into the standard.
129 uint32_t CuTypesListSize = (AddressAreaOffset - CuTypesOffset) / 24;
130 if (CuTypesListSize != 0)
131 return false;
141 uint32_t TuListSize = (AddressAreaOffset - CuTypesOffset) / 24;
142 TuList.resize(TuListSize);
143 for (uint32_t I = 0; I < TuListSize; ++I) {
144 uint64_t CuOffset = Data.getU64(&Offset);
145 uint64_t TypeOffset = Data.getU64(&Offset);
146 uint64_t Signature = Data.getU64(&Offset);
147 TuList[I] = {CuOffset, TypeOffset, Signature};
148 }
132149
133150 uint32_t AddressAreaSize = (SymbolTableOffset - AddressAreaOffset) / 20;
134151 AddressArea.reserve(AddressAreaSize);