X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FDebugInfo%2FDWARFDebugRangeList.cpp;h=07b23b32d1f33ef697abe5119a2d0de84fdb781a;hb=fd0a8133e56e6c48d04e395290da69c3926a48d1;hp=10f51b4aa09ccff5288b54ccdb7d39b6c55e172d;hpb=eceb5b99777ba944a0ae3748a0371e9a3aa94d56;p=oota-llvm.git diff --git a/lib/DebugInfo/DWARFDebugRangeList.cpp b/lib/DebugInfo/DWARFDebugRangeList.cpp index 10f51b4aa09..07b23b32d1f 100644 --- a/lib/DebugInfo/DWARFDebugRangeList.cpp +++ b/lib/DebugInfo/DWARFDebugRangeList.cpp @@ -37,10 +37,7 @@ bool DWARFDebugRangeList::extract(DataExtractor data, uint32_t *offset_ptr) { clear(); return false; } - // The end of any given range list is marked by an end of list entry, - // which consists of a 0 for the beginning address offset - // and a 0 for the ending address offset. - if (entry.StartAddress == 0 && entry.EndAddress == 0) + if (entry.isEndOfListEntry()) break; Entries.push_back(entry); } @@ -48,11 +45,25 @@ bool DWARFDebugRangeList::extract(DataExtractor data, uint32_t *offset_ptr) { } void DWARFDebugRangeList::dump(raw_ostream &OS) const { - for (int i = 0, n = Entries.size(); i != n; ++i) { - const char *format_str = (AddressSize == 4) ? "%08x %08x %08x\n" - : "%08x %016x %016x\n"; - OS << format(format_str, Offset, Entries[i].StartAddress, - Entries[i].EndAddress); + for (const RangeListEntry &RLE : Entries) { + const char *format_str = (AddressSize == 4 + ? "%08x %08" PRIx64 " %08" PRIx64 "\n" + : "%08x %016" PRIx64 " %016" PRIx64 "\n"); + OS << format(format_str, Offset, RLE.StartAddress, RLE.EndAddress); } OS << format("%08x \n", Offset); } + +DWARFAddressRangesVector +DWARFDebugRangeList::getAbsoluteRanges(uint64_t BaseAddress) const { + DWARFAddressRangesVector Res; + for (const RangeListEntry &RLE : Entries) { + if (RLE.isBaseAddressSelectionEntry(AddressSize)) { + BaseAddress = RLE.EndAddress; + } else { + Res.push_back(std::make_pair(BaseAddress + RLE.StartAddress, + BaseAddress + RLE.EndAddress)); + } + } + return Res; +}