26void DWARFGdbIndex::dumpCUList(
raw_ostream &OS)
const {
27 OS <<
format(
"\n CU list offset = 0x%x, has %" PRId64
" entries:",
28 CuListOffset, (uint64_t)CuList.size())
31 for (
const CompUnitEntry &CU : CuList)
32 OS <<
format(
" %d: Offset = 0x%llx, Length = 0x%llx\n",
I++, CU.Offset,
36void DWARFGdbIndex::dumpTUList(
raw_ostream &OS)
const {
37 OS <<
formatv(
"\n Types CU list offset = {0:x}, has {1} entries:\n",
38 TuListOffset, TuList.size());
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);
46void DWARFGdbIndex::dumpAddressArea(
raw_ostream &OS)
const {
47 OS <<
format(
"\n Address area offset = 0x%x, has %" PRId64
" entries:",
48 AddressAreaOffset, (uint64_t)AddressArea.size())
50 for (
const AddressEntry &Addr : AddressArea)
52 " Low/High address = [0x%llx, 0x%llx) (Size: 0x%llx), CU id = %d\n",
53 Addr.LowAddress, Addr.HighAddress, Addr.HighAddress - Addr.LowAddress,
57void DWARFGdbIndex::dumpSymbolTable(
raw_ostream &OS)
const {
58 OS <<
format(
"\n Symbol table offset = 0x%x, size = %" PRId64
60 SymbolTableOffset, (uint64_t)SymbolTable.size())
63 const auto FindCuVectorId = [&](uint32_t VecOffset) {
68 [](
const auto &ConstantPoolEntry, uint32_t
Offset) {
69 return ConstantPoolEntry.first <
Offset;
71 assert(It != ConstantPoolVectors.end() && It->first == VecOffset &&
72 "Invalid symbol table");
73 return It - ConstantPoolVectors.begin();
77 for (
const SymTableEntry &
E : SymbolTable) {
79 if (!
E.NameOffset && !
E.VecOffset)
82 OS <<
format(
" %d: Name offset = 0x%x, CU vector offset = 0x%x\n",
I,
83 E.NameOffset,
E.VecOffset);
85 StringRef
Name = ConstantPoolStrings.substr(
86 ConstantPoolOffset - StringPoolOffset +
E.NameOffset);
88 const uint32_t CuVectorId = FindCuVectorId(
E.VecOffset);
89 OS <<
format(
" String name: %s, CU vector index: %d\n",
Name.data(),
94void DWARFGdbIndex::dumpConstantPool(
raw_ostream &OS)
const {
95 OS <<
format(
"\n Constant pool offset = 0x%x, has %" PRId64
" CU vectors:",
96 ConstantPoolOffset, (uint64_t)ConstantPoolVectors.size());
98 for (
const auto &V : ConstantPoolVectors) {
99 OS <<
format(
"\n %d(0x%x): ",
I++,
V.first);
100 for (uint32_t Val :
V.second)
101 OS <<
format(
"0x%x ", Val);
108 OS <<
"\n<error parsing>\n";
113 OS <<
" Version = " << Version <<
'\n';
118 dumpConstantPool(OS);
136 if (
Offset != CuListOffset)
139 uint32_t CuListSize = (TuListOffset - CuListOffset) / 16;
141 for (
uint32_t i = 0; i < CuListSize; ++i) {
149 uint32_t TuListSize = (AddressAreaOffset - TuListOffset) / 24;
150 TuList.resize(TuListSize);
151 for (uint32_t
I = 0;
I < TuListSize; ++
I) {
155 TuList[
I] = {CuOffset, TypeOffset, Signature};
158 uint32_t AddressAreaSize = (SymbolTableOffset - AddressAreaOffset) / 20;
159 AddressArea.reserve(AddressAreaSize);
160 for (uint32_t i = 0; i < AddressAreaSize; ++i) {
164 AddressArea.push_back({LowAddress, HighAddress, CuIndex});
175 uint32_t SymTableSize = (ConstantPoolOffset - SymbolTableOffset) / 8;
176 SymbolTable.reserve(SymTableSize);
177 std::set<uint32_t> CUOffsets;
178 for (uint32_t i = 0; i < SymTableSize; ++i) {
181 SymbolTable.push_back({NameOffset, CuVecOffset});
182 if (NameOffset || CuVecOffset)
183 CUOffsets.insert(CuVecOffset);
189 for (
auto CUOffset : CUOffsets) {
190 Offset = ConstantPoolOffset + CUOffset;
191 ConstantPoolVectors.emplace_back(0, SmallVector<uint32_t, 0>());
192 auto &Vec = ConstantPoolVectors.back();
193 Vec.first =
Offset - ConstantPoolOffset;
196 for (uint32_t J = 0; J < Num; ++J)
200 ConstantPoolStrings =
Data.getData().drop_front(
Offset);
201 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...