Go to the documentation of this file.
29 #ifndef BLOATY_RANGE_MAP_H_
30 #define BLOATY_RANGE_MAP_H_
40 #include "absl/strings/str_cat.h"
129 it->second.other_start,
it->second.label);
133 template <
class Func>
134 static void ComputeRollup(
const std::vector<const RangeMap*>& range_maps,
137 template <
class Func>
144 template <
class Func>
176 typedef std::map<uint64_t, Entry>
Map;
250 template <
class Func>
253 assert(range_maps.size() > 0);
254 std::vector<Map::const_iterator> iters;
257 for (
int i = 0;
i < range_maps.size();
i++) {
258 const RangeMap* range_map = range_maps[
i];
261 "Error, range (%s) exists at index %d, but base map is empty\n",
265 throw std::runtime_error(
"Range extends beyond base map.");
271 iters.reserve(range_maps.size());
272 for (
auto range_map : range_maps) {
273 iters.push_back(range_map->mappings_.begin());
300 std::vector<std::string>
keys;
303 if (range_maps[0]->
IterIsEnd(iters[0])) {
305 for (
int i = 0;
i < range_maps.size();
i++) {
308 "Error, range (%s) extends beyond final base map range "
313 throw std::runtime_error(
"Range extends beyond base map.");
320 current = iters[0]->first;
321 for (
int i = 0;
i < range_maps.size();
i++) {
324 "Error, no more ranges for index %d but we need one "
328 throw std::runtime_error(
"No more ranges.");
329 }
else if (iters[
i]->
first != current) {
331 "Error, range (%s) doesn't match the beginning of base range "
336 throw std::runtime_error(
"No more ranges.");
342 bool continuous =
true;
348 for (
int i = 0;
i < iters.size();
i++) {
355 for (
int i = 0;
i < iters.size();
i++) {
357 Map::const_iterator&
iter = iters[
i];
359 :
map.RangeEndUnknownLimit(
iter, next_break);
361 if (
end != next_break) {
367 if (
map.IterIsEnd(
iter) ||
iter->first != next_break) {
368 if (
i > 0 && continuous) {
370 "Error, gap between ranges (%s) and (%s) fails to cover base "
372 map.EntryDebugString(std::prev(
iter)).c_str(),
373 map.EntryDebugString(
iter).c_str(),
374 range_maps[0]->EntryDebugString(iters[0]).c_str());
376 throw std::runtime_error(
"Entry range extends beyond base range");
378 assert(
i == 0 || !continuous);
385 current = next_break;
392 #endif // BLOATY_RANGE_MAP_H_
static std::string EntryDebugString(uint64_t addr, uint64_t size, uint64_t other_start, const std::string &label)
uint64_t RangeEndUnknownLimit(Map::const_iterator iter, uint64_t unknown) const
bool TranslateAndTrimRangeWithEntry(T iter, uint64_t addr, uint64_t size, uint64_t *trimmed_addr, uint64_t *translated_addr, uint64_t *trimmed_size) const
bool IterIsEnd(Map::const_iterator iter) const
uint64_t GetMaxAddress() const
void StrAppend(std::string *dest, const AlphaNum &a)
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
static const uint64_t kNoTranslation
bool EntryContainsStrict(T iter, uint64_t addr) const
Map::const_iterator FindContaining(uint64_t addr) const
void MaybeSetLabel(T iter, const std::string &label, uint64_t addr, uint64_t end)
static constexpr uint64_t kUnknownSize
bool TryGetLabelForRange(uint64_t addr, uint64_t size, std::string *label) const
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
bool CoversRange(uint64_t addr, uint64_t size) const
bool AddRangeWithTranslation(uint64_t addr, uint64_t size, const std::string &val, const RangeMap &translator, bool verbose, RangeMap *other)
bool HasTranslation() const
const typedef MCPhysReg * iterator
uint64_t RangeEnd(Map::const_iterator iter) const
#define T(upbtypeconst, upbtype, ctype, default_value)
std::map< uint64_t, Entry > Map
std::string DebugString() const
bool IsShortFallback() const
void AddDualRange(uint64_t addr, uint64_t size, uint64_t otheraddr, const std::string &val)
uint64_t TranslateWithEntry(T iter, uint64_t addr) const
def c_str(s, encoding='ascii')
FuncOutput(*)(const void *, FuncInput) Func
bool TryGetSize(uint64_t addr, uint64_t *size) const
void AddRange(uint64_t addr, uint64_t size, const std::string &val)
bool EntryContains(T iter, uint64_t addr) const
unsigned __int64 uint64_t
Map::iterator FindContainingOrAfter(uint64_t addr)
void CheckConsistency(T iter) const
bool Translate(uint64_t addr, uint64_t *translated) const
bool HasFallbackLabel() const
Entry(const std::string &label_, uint64_t size_, uint64_t other_)
void ForEachRange(Func func) const
UniquePtr< SSL_SESSION > ret
AllocList * next[kMaxLevel]
RangeMap & operator=(RangeMap &&other)=default
bool TryGetLabel(uint64_t addr, std::string *label) const
static void ComputeRollup(const std::vector< const RangeMap * > &range_maps, Func func)
std::string EntryDebugString(T it) const
void ForEachRangeWithStart(uint64_t start, Func func) const
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:59