24 void DWARFDebugAranges::extract(
DataExtractor DebugArangesData) {
30 while (Set.
extract(DebugArangesData, &Offset)) {
33 uint64_t LowPC = Desc.Address;
34 uint64_t HighPC = Desc.getEndAddress();
35 appendRange(CUOffset, LowPC, HighPC);
37 ParsedCUOffsets.
insert(CUOffset);
56 if (ParsedCUOffsets.
insert(CUOffset).second) {
61 for (
const auto &R : *CURanges)
62 appendRange(CUOffset, R.LowPC, R.HighPC);
69 void DWARFDebugAranges::clear() {
72 ParsedCUOffsets.
clear();
75 void DWARFDebugAranges::appendRange(
uint32_t CUOffset, uint64_t LowPC,
79 Endpoints.emplace_back(LowPC, CUOffset,
true);
80 Endpoints.emplace_back(HighPC, CUOffset,
false);
83 void DWARFDebugAranges::construct() {
84 std::multiset<uint32_t> ValidCUs;
87 uint64_t PrevAddress = -1ULL;
88 for (
const auto &
E : Endpoints) {
89 if (PrevAddress <
E.Address && !ValidCUs.empty()) {
93 if (!Aranges.empty() && Aranges.back().HighPC() == PrevAddress &&
94 ValidCUs.find(Aranges.back().CUOffset) != ValidCUs.end()) {
95 Aranges.back().setHighPC(
E.Address);
97 Aranges.emplace_back(PrevAddress,
E.Address, *ValidCUs.begin());
101 if (
E.IsRangeStart) {
102 ValidCUs.insert(
E.CUOffset);
104 auto CUPos = ValidCUs.find(
E.CUOffset);
105 assert(CUPos != ValidCUs.end());
106 ValidCUs.erase(CUPos);
108 PrevAddress =
E.Address;
114 Endpoints.shrink_to_fit();
118 if (!Aranges.empty()) {
119 Range range(Address);
120 RangeCollIterator
begin = Aranges.begin();
121 RangeCollIterator
end = Aranges.end();
122 RangeCollIterator pos =
125 if (pos != end && pos->containsAddress(Address)) {
126 return pos->CUOffset;
127 }
else if (pos != begin) {
129 if (pos->containsAddress(Address))
130 return pos->CUOffset;
const_iterator end(StringRef path)
Get end iterator over path.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
This class represents lattice values for constants.
desc_iterator_range descriptors() const
static raw_ostream & error()
Convenience method for printing "error: " to stderr.
uint32_t findAddress(uint64_t Address) const
Error takeError()
Take ownership of the stored error.
void generate(DWARFContext *CTX)
std::string toString(Error E)
Write all error messages (if any) in E to a string.
unit_iterator_range compile_units()
Get compile units in this context.
Tagged union holding either a T or a Error.
virtual StringRef getARangeSection() const
auto lower_bound(R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
std::pair< iterator, bool > insert(const ValueT &V)
void sort(IteratorTy Start, IteratorTy End)
bool extract(DataExtractor data, uint32_t *offset_ptr)
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
bool isLittleEndian() const
const DWARFObject & getDWARFObj() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
uint32_t getCompileUnitDIEOffset() const