41 throw std::bad_alloc();
53 throw std::bad_alloc();
77 ExtentPair left = *i++;
78 for (; i!=
end() && left.first+left.second+reagent >= i->first; i++)
79 left.second = (i->first + i->second) - left.first;
92 RangeMapType::const_iterator i2 =
ranges.find(addr);
95 throw std::bad_alloc();
98 if (i->first+i->second <= addr) {
100 throw std::bad_alloc();
103 assert(i->first==i2->first.begin);
104 assert(i->second==i2->first.size);
113 ExtentMap::exists_all(ExtentPair what)
const
115 while (what.second>0) {
117 ExtentPair found = find_address(what.first);
118 assert(found.second > 0);
119 assert(found.first <= what.first);
120 assert(what.first <= found.first + found.second);
121 rose_addr_t nfound = std::min(what.second, found.second-(what.first-found.first));
122 what.first = found.first + found.second;
123 what.second -= nfound;
124 }
catch (
const std::bad_alloc&) {
125 assert(!
ranges.contains(RangeType(what.first, what.second)));
129 assert(
ranges.contains(RangeType(what.first, what.second)));
140 o <<prefix <<(label.empty()?std::string(
"Extent"):label) <<
"[" <<idx <<
"]"
142 <<
" for " <<
unsignedToHex(i->first.size()) <<(1==i->first.size()?
" byte":
" bytes")
143 <<
" ending at " <<
unsignedToHex(i->first.first() + i->first.size()) <<
"\n";
155 if (!label) label =
"Extent";
156 sprintf(p,
"%s%s[%zd]", prefix, label, idx);
158 fprintf(f,
"%s%-*s = offset 0x%08"PRIx64
" (%"PRIu64
"),"
159 " for 0x%08"PRIx64
" (%"PRIu64
") byte%s,"
160 " ending at 0x%08"PRIx64
" (%"PRIu64
")\n",
161 p, w,
"", i->first.first(), i->first.first(),
162 i->first.size(), i->first.size(), 1==i->first.size()?
"":
"s",
163 i->first.first()+i->first.size(), i->first.first()+i->first.size());