26 void 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,
36 void DWARFGdbIndex::dumpAddressArea(
raw_ostream &OS)
const {
37 OS <<
format(
"\n Address area offset = 0x%x, has %" PRId64
" entries:",
38 AddressAreaOffset, (uint64_t)AddressArea.
size())
40 for (
const AddressEntry &Addr : AddressArea)
42 " Low/High address = [0x%llx, 0x%llx) (Size: 0x%llx), CU id = %d\n",
43 Addr.LowAddress, Addr.HighAddress, Addr.HighAddress - Addr.LowAddress,
47 void DWARFGdbIndex::dumpSymbolTable(
raw_ostream &OS)
const {
48 OS <<
format(
"\n Symbol table offset = 0x%x, size = %" PRId64
50 SymbolTableOffset, (uint64_t)SymbolTable.
size())
53 for (
const SymTableEntry &
E : SymbolTable) {
55 if (!
E.NameOffset && !
E.VecOffset)
58 OS <<
format(
" %d: Name offset = 0x%x, CU vector offset = 0x%x\n", I,
59 E.NameOffset,
E.VecOffset);
62 ConstantPoolOffset - StringPoolOffset +
E.NameOffset);
65 ConstantPoolVectors.begin(), ConstantPoolVectors.end(),
66 [&](
const std::pair<uint32_t, SmallVector<uint32_t, 0>> &V) {
67 return V.first ==
E.VecOffset;
69 assert(CuVector != ConstantPoolVectors.end() &&
"Invalid symbol table");
70 uint32_t CuVectorId = CuVector - ConstantPoolVectors.begin();
71 OS <<
format(
" String name: %s, CU vector index: %d\n", Name.
data(),
76 void DWARFGdbIndex::dumpConstantPool(
raw_ostream &OS)
const {
77 OS <<
format(
"\n Constant pool offset = 0x%x, has %" PRId64
" CU vectors:",
78 ConstantPoolOffset, (uint64_t)ConstantPoolVectors.size());
80 for (
const auto &V : ConstantPoolVectors) {
81 OS <<
format(
"\n %d(0x%x): ", I++, V.first);
83 OS <<
format(
"0x%x ", Val);
90 OS <<
"\n<error parsing>\n";
95 OS <<
" Version = " << Version <<
'\n';
107 Version = Data.
getU32(&Offset);
111 CuListOffset = Data.
getU32(&Offset);
113 AddressAreaOffset = Data.
getU32(&Offset);
114 SymbolTableOffset = Data.
getU32(&Offset);
115 ConstantPoolOffset = Data.
getU32(&Offset);
117 if (Offset != CuListOffset)
120 uint32_t CuListSize = (CuTypesOffset - CuListOffset) / 16;
122 for (
uint32_t i = 0; i < CuListSize; ++i) {
123 uint64_t CuOffset = Data.
getU64(&Offset);
124 uint64_t CuLength = Data.
getU64(&Offset);
130 uint32_t CuTypesListSize = (AddressAreaOffset - CuTypesOffset) / 24;
131 if (CuTypesListSize != 0)
134 uint32_t AddressAreaSize = (SymbolTableOffset - AddressAreaOffset) / 20;
135 AddressArea.
reserve(AddressAreaSize);
136 for (
uint32_t i = 0; i < AddressAreaSize; ++i) {
137 uint64_t LowAddress = Data.
getU64(&Offset);
138 uint64_t HighAddress = Data.
getU64(&Offset);
140 AddressArea.
push_back({LowAddress, HighAddress, CuIndex});
151 uint32_t SymTableSize = (ConstantPoolOffset - SymbolTableOffset) / 8;
152 SymbolTable.reserve(SymTableSize);
154 for (
uint32_t i = 0; i < SymTableSize; ++i) {
157 SymbolTable.push_back({NameOffset, CuVecOffset});
158 if (NameOffset || CuVecOffset)
165 for (
uint32_t i = 0; i < CuVectorsTotal; ++i) {
167 auto &Vec = ConstantPoolVectors.back();
168 Vec.first = Offset - ConstantPoolOffset;
172 Vec.second.push_back(Data.
getU32(&Offset));
176 StringPoolOffset =
Offset;
void push_back(const T &Elt)
Compute iterated dominance frontiers using a linear time algorithm.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
void reserve(size_type N)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void dump(raw_ostream &OS)
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void parse(DataExtractor Data)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.