27void DWARFGdbIndex::dumpCUList(
raw_ostream &OS)
const {
28 OS <<
format(
"\n CU list offset = 0x%x, has %" PRId64
" entries:",
29 CuListOffset, (uint64_t)CuList.size())
32 for (
const CompUnitEntry &CU : CuList)
33 OS <<
format(
" %d: Offset = 0x%llx, Length = 0x%llx\n",
I++, CU.Offset,
37void DWARFGdbIndex::dumpTUList(
raw_ostream &OS)
const {
38 OS <<
formatv(
"\n Types CU list offset = {0:x}, has {1} entries:\n",
39 TuListOffset, TuList.size());
41 for (
const TypeUnitEntry &TU : TuList)
42 OS <<
formatv(
" {0}: offset = {1:x8}, type_offset = {2:x8}, "
43 "type_signature = {3:x16}\n",
44 I++, TU.Offset, TU.TypeOffset, TU.TypeSignature);
47void DWARFGdbIndex::dumpAddressArea(
raw_ostream &OS)
const {
48 OS <<
format(
"\n Address area offset = 0x%x, has %" PRId64
" entries:",
49 AddressAreaOffset, (uint64_t)AddressArea.size())
51 for (
const AddressEntry &Addr : AddressArea)
53 " Low/High address = [0x%llx, 0x%llx) (Size: 0x%llx), CU id = %d\n",
54 Addr.LowAddress, Addr.HighAddress, Addr.HighAddress - Addr.LowAddress,
58void DWARFGdbIndex::dumpSymbolTable(
raw_ostream &OS)
const {
59 OS <<
format(
"\n Symbol table offset = 0x%x, size = %" PRId64
61 SymbolTableOffset, (uint64_t)SymbolTable.size())
64 const auto FindCuVectorId = [&](uint32_t VecOffset) {
69 [](
const auto &ConstantPoolEntry, uint32_t
Offset) {
70 return ConstantPoolEntry.first <
Offset;
72 assert(It != ConstantPoolVectors.end() && It->first == VecOffset &&
73 "Invalid symbol table");
74 return It - ConstantPoolVectors.begin();
78 for (
const SymTableEntry &
E : SymbolTable) {
80 if (!
E.NameOffset && !
E.VecOffset)
83 OS <<
format(
" %d: Name offset = 0x%x, CU vector offset = 0x%x\n",
I,
84 E.NameOffset,
E.VecOffset);
86 StringRef
Name = ConstantPoolStrings.substr(
87 ConstantPoolOffset - StringPoolOffset +
E.NameOffset);
89 const uint32_t CuVectorId = FindCuVectorId(
E.VecOffset);
90 OS <<
format(
" String name: %s, CU vector index: %d\n",
Name.data(),
95void DWARFGdbIndex::dumpConstantPool(
raw_ostream &OS)
const {
96 OS <<
format(
"\n Constant pool offset = 0x%x, has %" PRId64
" CU vectors:",
97 ConstantPoolOffset, (uint64_t)ConstantPoolVectors.size());
99 for (
const auto &V : ConstantPoolVectors) {
100 OS <<
format(
"\n %d(0x%x): ",
I++,
V.first);
101 for (uint32_t Val :
V.second)
102 OS <<
format(
"0x%x ", Val);
109 OS <<
"\n<error parsing>\n";
114 OS <<
" Version = " << Version <<
'\n';
119 dumpConstantPool(OS);
137 if (
Offset != CuListOffset)
140 uint32_t CuListSize = (TuListOffset - CuListOffset) / 16;
142 for (
uint32_t i = 0; i < CuListSize; ++i) {
150 uint32_t TuListSize = (AddressAreaOffset - TuListOffset) / 24;
151 TuList.resize(TuListSize);
152 for (uint32_t
I = 0;
I < TuListSize; ++
I) {
156 TuList[
I] = {CuOffset, TypeOffset, Signature};
159 uint32_t AddressAreaSize = (SymbolTableOffset - AddressAreaOffset) / 20;
160 AddressArea.reserve(AddressAreaSize);
161 for (uint32_t i = 0; i < AddressAreaSize; ++i) {
165 AddressArea.push_back({LowAddress, HighAddress, CuIndex});
176 uint32_t SymTableSize = (ConstantPoolOffset - SymbolTableOffset) / 8;
177 SymbolTable.reserve(SymTableSize);
178 std::set<uint32_t> CUOffsets;
179 for (uint32_t i = 0; i < SymTableSize; ++i) {
182 SymbolTable.push_back({NameOffset, CuVecOffset});
183 if (NameOffset || CuVecOffset)
184 CUOffsets.insert(CuVecOffset);
190 for (
auto CUOffset : CUOffsets) {
191 Offset = ConstantPoolOffset + CUOffset;
192 ConstantPoolVectors.emplace_back(0, SmallVector<uint32_t, 0>());
193 auto &Vec = ConstantPoolVectors.back();
194 Vec.first =
Offset - ConstantPoolOffset;
197 for (uint32_t J = 0; J < Num; ++J)
201 ConstantPoolStrings =
Data.getData().drop_front(
Offset);
202 StringPoolOffset =
Offset;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the SmallVector class.
void dump(raw_ostream &OS)
void parse(DataExtractor Data)
void reserve(size_type N)
void push_back(const T &Elt)
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
FunctionAddr VTableAddr uintptr_t uintptr_t Version
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...