20 void DWARFGdbIndex::dumpCUList(
raw_ostream &OS)
const {
21 OS <<
format(
"\n CU list offset = 0x%x, has %" PRId64
" entries:",
22 CuListOffset, (uint64_t)CuList.
size())
25 for (
const CompUnitEntry &CU : CuList)
26 OS <<
format(
" %d: Offset = 0x%llx, Length = 0x%llx\n", I++, CU.Offset,
30 void DWARFGdbIndex::dumpAddressArea(
raw_ostream &OS)
const {
31 OS <<
format(
"\n Address area offset = 0x%x, has %" PRId64
" entries:",
32 AddressAreaOffset, (uint64_t)AddressArea.
size())
34 for (
const AddressEntry &Addr : AddressArea)
36 " Low address = 0x%llx, High address = 0x%llx, CU index = %d\n",
37 Addr.LowAddress, Addr.HighAddress, Addr.CuIndex);
40 void DWARFGdbIndex::dumpSymbolTable(
raw_ostream &OS)
const {
41 OS <<
format(
"\n Symbol table offset = 0x%x, size = %" PRId64
43 SymbolTableOffset, (uint64_t)SymbolTable.
size())
46 for (
const SymTableEntry &
E : SymbolTable) {
48 if (!
E.NameOffset && !
E.VecOffset)
51 OS <<
format(
" %d: Name offset = 0x%x, CU vector offset = 0x%x\n", I,
52 E.NameOffset,
E.VecOffset);
55 ConstantPoolOffset - StringPoolOffset +
E.NameOffset);
58 ConstantPoolVectors.begin(), ConstantPoolVectors.end(),
59 [&](
const std::pair<uint32_t, SmallVector<uint32_t, 0>> &V) {
60 return V.first ==
E.VecOffset;
62 assert(CuVector != ConstantPoolVectors.end() &&
"Invalid symbol table");
63 uint32_t CuVectorId = CuVector - ConstantPoolVectors.begin();
64 OS <<
format(
" String name: %s, CU vector index: %d\n", Name.
data(),
69 void DWARFGdbIndex::dumpConstantPool(
raw_ostream &OS)
const {
70 OS <<
format(
"\n Constant pool offset = 0x%x, has %" PRId64
" CU vectors:",
71 ConstantPoolOffset, (uint64_t)ConstantPoolVectors.size());
73 for (
const auto &V : ConstantPoolVectors) {
74 OS <<
format(
"\n %d(0x%x): ", I++, V.first);
76 OS <<
format(
"0x%x ", Val);
83 OS <<
"\n<error parsing>\n";
88 OS <<
" Version = " << Version <<
'\n';
100 Version = Data.
getU32(&Offset);
104 CuListOffset = Data.
getU32(&Offset);
106 AddressAreaOffset = Data.
getU32(&Offset);
107 SymbolTableOffset = Data.
getU32(&Offset);
108 ConstantPoolOffset = Data.
getU32(&Offset);
110 if (Offset != CuListOffset)
113 uint32_t CuListSize = (CuTypesOffset - CuListOffset) / 16;
116 uint64_t CuOffset = Data.
getU64(&Offset);
117 uint64_t CuLength = Data.
getU64(&Offset);
123 uint32_t CuTypesListSize = (AddressAreaOffset - CuTypesOffset) / 24;
124 if (CuTypesListSize != 0)
127 uint32_t AddressAreaSize = (SymbolTableOffset - AddressAreaOffset) / 20;
128 AddressArea.
reserve(AddressAreaSize);
130 uint64_t LowAddress = Data.
getU64(&Offset);
131 uint64_t HighAddress = Data.
getU64(&Offset);
133 AddressArea.
push_back({LowAddress, HighAddress, CuIndex});
144 uint32_t SymTableSize = (ConstantPoolOffset - SymbolTableOffset) / 8;
145 SymbolTable.reserve(SymTableSize);
150 SymbolTable.push_back({NameOffset, CuVecOffset});
151 if (NameOffset || CuVecOffset)
160 auto &Vec = ConstantPoolVectors.back();
161 Vec.first = Offset - ConstantPoolOffset;
165 Vec.second.push_back(Data.
getU32(&Offset));
169 StringPoolOffset =
Offset;
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.
void push_back(const T &Elt)
void reserve(size_type N)
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
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).
void dump(raw_ostream &OS)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void parse(DataExtractor Data)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
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).
StringRef - Represent a constant reference to a string, i.e.
auto find_if(R &&Range, UnaryPredicate P) -> decltype(std::begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...