MemoryMap provides access to the system-level memory map describing how a BinaryView is loaded into memory.
- Note
- Architecture: This API-side MemoryMap class is a proxy that accesses the BinaryView's current MemoryMap state through the core API. The proxy provides a simple mutable interface: when you call modification operations (AddMemoryRegion, RemoveMemoryRegion, etc.), the proxy automatically accesses the updated MemoryMap. Internally, the core uses immutable copy-on-write data structures, but the proxy abstracts this away.
When you access a BinaryView's MemoryMap, you always see the current state. For lock-free access during analysis, AnalysisContext provides memory layout query methods (IsValidOffset, IsOffsetReadable, GetStart, GetLength, etc.) that operate on an immutable snapshot of the MemoryMap cached when the analysis was initiated.
A MemoryMap can contain multiple, arbitrarily overlapping memory regions. When modified, address space segmentation is automatically managed. If multiple regions overlap, the most recently added region takes precedence by default.
|
| | MemoryMap (BNBinaryView *view) |
| | ~MemoryMap ()=default |
| void | SetLogicalMemoryMapEnabled (bool enabled) |
| bool | IsActivated () |
| | Returns true if this MemoryMap represents a parsed BinaryView with real segments.
|
| bool | AddBinaryMemoryRegion (const std::string &name, uint64_t start, Ref< BinaryView > source, uint32_t flags=0) |
| bool | AddDataMemoryRegion (const std::string &name, uint64_t start, const DataBuffer &source, uint32_t flags=0) |
| bool | AddRemoteMemoryRegion (const std::string &name, uint64_t start, FileAccessor *source, uint32_t flags=0) |
| bool | AddUnbackedMemoryRegion (const std::string &name, uint64_t start, uint64_t length, uint32_t flags=0, uint8_t fill=0) |
| bool | RemoveMemoryRegion (const std::string &name) |
| std::string | GetActiveMemoryRegionAt (uint64_t addr) |
| uint32_t | GetMemoryRegionFlags (const std::string &name) |
| bool | SetMemoryRegionFlags (const std::string &name, uint32_t flags) |
| bool | IsMemoryRegionEnabled (const std::string &name) |
| bool | SetMemoryRegionEnabled (const std::string &name, bool enabled) |
| bool | IsMemoryRegionRebaseable (const std::string &name) |
| bool | SetMemoryRegionRebaseable (const std::string &name, bool rebaseable) |
| uint8_t | GetMemoryRegionFill (const std::string &name) |
| bool | SetMemoryRegionFill (const std::string &name, uint8_t fill) |
| std::string | GetMemoryRegionDisplayName (const std::string &name) |
| bool | SetMemoryRegionDisplayName (const std::string &name, const std::string &displayName) |
| bool | IsMemoryRegionLocal (const std::string &name) |
| void | Reset () |
| bool BinaryNinja::MemoryMap::IsActivated |
( |
| ) |
|
|
inline |
Returns true if this MemoryMap represents a parsed BinaryView with real segments.
This is determined by whether the BinaryView has a parent view - parsed views (ELF, PE, Mach-O, etc.) have a parent Raw view, while Raw views have no parent.
Returns true for parsed BinaryViews (ELF, PE, Mach-O, etc.) with segments from binary format parsing. Returns false for Raw BinaryViews (flat file view with synthetic MemoryMap) or views that failed to parse segments.
Use this to gate features that require parsed binary structure (sections, imports, relocations, etc.). For basic analysis queries (GetStart, IsOffsetReadable, GetLength, etc.), use the MemoryMap directly regardless of activation state - all BinaryViews have a usable MemoryMap.
- Returns
- True if this is an activated (parsed) memory map, false otherwise