//
//===----------------------------------------------------------------------===//
-#include "DWARFDebugRangeList.h"
+#include "llvm/DebugInfo/DWARFDebugRangeList.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
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);
}
}
void DWARFDebugRangeList::dump(raw_ostream &OS) const {
- for (int i = 0, n = Entries.size(); i != n; ++i) {
+ 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, Entries[i].StartAddress,
- Entries[i].EndAddress);
+ ? "%08x %08" PRIx64 " %08" PRIx64 "\n"
+ : "%08x %016" PRIx64 " %016" PRIx64 "\n");
+ OS << format(format_str, Offset, RLE.StartAddress, RLE.EndAddress);
}
OS << format("%08x <End of list>\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;
+}