MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / MapRegion

Method MapRegion

view/sharedcache/core/VirtualMemory.cpp:3–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "VirtualMemory.h"
2
3void VirtualMemory::MapRegion(WeakFileAccessor fileAccessor, AddressRange mappedRange, uint64_t fileOffset)
4{
5 // Create a new VirtualMemoryRegion object
6 VirtualMemoryRegion region {fileOffset, std::move(fileAccessor)};
7
8 // TODO: How to handle overlapping regions?
9 for (const auto& [existingRange, existingRegion] : m_regions)
10 {
11 if (existingRange.Overlaps(mappedRange))
12 {
13 // Handle overlapping regions, e.g., throw an exception or skip the mapping
14 BinaryNinja::LogError("Overlapping memory region %llx", existingRange.start);
15 }
16 }
17
18 // Insert the region into the map
19 m_regions.insert_or_assign(mappedRange, region);
20}
21
22std::optional<VirtualMemoryRegion> VirtualMemory::GetRegionAtAddress(uint64_t address, uint64_t& addressOffset)
23{

Callers 1

AddEntryMethod · 0.80

Calls 1

OverlapsMethod · 0.80

Tested by

no test coverage detected