27 void 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,
37 void 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);
47 void 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,
58 void DWARFGdbIndex::dumpSymbolTable(
raw_ostream &OS)
const {
59 OS <<
format(
"\n Symbol table offset = 0x%x, size = %" PRId64
61 SymbolTableOffset, (uint64_t)SymbolTable.
size())
64 for (
const SymTableEntry &
E : SymbolTable) {
66 if (!
E.NameOffset && !
E.VecOffset)
69 OS <<
format(
" %d: Name offset = 0x%x, CU vector offset = 0x%x\n", I,
70 E.NameOffset,
E.VecOffset);
73 ConstantPoolOffset - StringPoolOffset +
E.NameOffset);
76 ConstantPoolVectors.begin(), ConstantPoolVectors.end(),
77 [&](
const std::pair<uint32_t, SmallVector<uint32_t, 0>> &V) {
78 return V.first ==
E.VecOffset;
80 assert(CuVector != ConstantPoolVectors.end() &&
"Invalid symbol table");
81 uint32_t CuVectorId = CuVector - ConstantPoolVectors.begin();
82 OS <<
format(
" String name: %s, CU vector index: %d\n", Name.
data(),
87 void DWARFGdbIndex::dumpConstantPool(
raw_ostream &OS)
const {
88 OS <<
format(
"\n Constant pool offset = 0x%x, has %" PRId64
" CU vectors:",
89 ConstantPoolOffset, (uint64_t)ConstantPoolVectors.size());
91 for (
const auto &V : ConstantPoolVectors) {
92 OS <<
format(
"\n %d(0x%x): ", I++, V.first);
94 OS <<
format(
"0x%x ", Val);
101 OS <<
"\n<error parsing>\n";
106 OS <<
" Version = " << Version <<
'\n';
111 dumpConstantPool(OS);
119 Version = Data.
getU32(&Offset);
123 CuListOffset = Data.
getU32(&Offset);
125 AddressAreaOffset = Data.
getU32(&Offset);
126 SymbolTableOffset = Data.
getU32(&Offset);
127 ConstantPoolOffset = Data.
getU32(&Offset);
129 if (Offset != CuListOffset)
132 uint32_t CuListSize = (CuTypesOffset - CuListOffset) / 16;
134 for (
uint32_t i = 0; i < CuListSize; ++i) {
135 uint64_t CuOffset = Data.
getU64(&Offset);
136 uint64_t CuLength = Data.
getU64(&Offset);
142 uint32_t TuListSize = (AddressAreaOffset - CuTypesOffset) / 24;
143 TuList.
resize(TuListSize);
144 for (
uint32_t I = 0; I < TuListSize; ++
I) {
145 uint64_t CuOffset = Data.
getU64(&Offset);
146 uint64_t TypeOffset = Data.
getU64(&Offset);
147 uint64_t Signature = Data.
getU64(&Offset);
148 TuList[
I] = {CuOffset, TypeOffset, Signature};
151 uint32_t AddressAreaSize = (SymbolTableOffset - AddressAreaOffset) / 20;
152 AddressArea.
reserve(AddressAreaSize);
153 for (
uint32_t i = 0; i < AddressAreaSize; ++i) {
154 uint64_t LowAddress = Data.
getU64(&Offset);
155 uint64_t HighAddress = Data.
getU64(&Offset);
157 AddressArea.
push_back({LowAddress, HighAddress, CuIndex});
168 uint32_t SymTableSize = (ConstantPoolOffset - SymbolTableOffset) / 8;
169 SymbolTable.reserve(SymTableSize);
171 for (
uint32_t i = 0; i < SymTableSize; ++i) {
174 SymbolTable.push_back({NameOffset, CuVecOffset});
175 if (NameOffset || CuVecOffset)
182 for (
uint32_t i = 0; i < CuVectorsTotal; ++i) {
184 auto &Vec = ConstantPoolVectors.back();
185 Vec.first = Offset - ConstantPoolOffset;
189 Vec.second.push_back(Data.
getU32(&Offset));
193 StringPoolOffset =
Offset;
This class represents lattice values for constants.
void push_back(const T &Elt)
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
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).
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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.