MCPcopy Create free account
hub / github.com/DFHack/dfhack / checkValidAddress

Method checkValidAddress

library/Process.cpp:601–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599#endif
600
601bool Process::checkValidAddress(void* ptr)
602{
603 uintptr_t addr = reinterpret_cast<uintptr_t>(ptr);
604 auto validate = [&] (t_memrange& r) {
605 uintptr_t lo = reinterpret_cast<uintptr_t>(r.start);
606 uintptr_t hi = reinterpret_cast<uintptr_t>(r.end);
607 return addr >= lo && addr < hi;
608 };
609 std::vector<t_memrange> mr;
610 getMemRanges(mr);
611 bool valid = std::any_of(mr.begin(), mr.end(), validate);
612 return valid;
613}
614
615uintptr_t Process::getBase()
616{

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected