Loading...
Searching...
No Matches
BinaryNinja::MemoryMap Class Reference

Public Member Functions

 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)
std::optional< MemoryRegionInfoGetMemoryRegionInfo (const std::string &name)
std::optional< MemoryRegionInfoGetActiveMemoryRegionInfoAt (uint64_t addr)
std::optional< ResolvedMemoryRangeGetResolvedMemoryRangeAt (uint64_t addr)
std::vector< MemoryRegionInfoGetMemoryRegions ()
std::vector< ResolvedMemoryRangeGetResolvedRanges ()
void Reset ()

Constructor & Destructor Documentation

◆ MemoryMap()

BinaryNinja::MemoryMap::MemoryMap ( BNBinaryView * view)
inline

◆ ~MemoryMap()

BinaryNinja::MemoryMap::~MemoryMap ( )
default

Member Function Documentation

◆ SetLogicalMemoryMapEnabled()

void BinaryNinja::MemoryMap::SetLogicalMemoryMapEnabled ( bool enabled)
inline

◆ IsActivated()

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

◆ AddBinaryMemoryRegion()

bool BinaryNinja::MemoryMap::AddBinaryMemoryRegion ( const std::string & name,
uint64_t start,
Ref< BinaryView > source,
uint32_t flags = 0 )
inline

◆ AddDataMemoryRegion()

bool BinaryNinja::MemoryMap::AddDataMemoryRegion ( const std::string & name,
uint64_t start,
const DataBuffer & source,
uint32_t flags = 0 )
inline

◆ AddRemoteMemoryRegion()

bool BinaryNinja::MemoryMap::AddRemoteMemoryRegion ( const std::string & name,
uint64_t start,
FileAccessor * source,
uint32_t flags = 0 )
inline

◆ AddUnbackedMemoryRegion()

bool BinaryNinja::MemoryMap::AddUnbackedMemoryRegion ( const std::string & name,
uint64_t start,
uint64_t length,
uint32_t flags = 0,
uint8_t fill = 0 )
inline

◆ RemoveMemoryRegion()

bool BinaryNinja::MemoryMap::RemoveMemoryRegion ( const std::string & name)
inline

◆ GetActiveMemoryRegionAt()

std::string BinaryNinja::MemoryMap::GetActiveMemoryRegionAt ( uint64_t addr)
inline

◆ GetMemoryRegionFlags()

uint32_t BinaryNinja::MemoryMap::GetMemoryRegionFlags ( const std::string & name)
inline

◆ SetMemoryRegionFlags()

bool BinaryNinja::MemoryMap::SetMemoryRegionFlags ( const std::string & name,
uint32_t flags )
inline

◆ IsMemoryRegionEnabled()

bool BinaryNinja::MemoryMap::IsMemoryRegionEnabled ( const std::string & name)
inline

◆ SetMemoryRegionEnabled()

bool BinaryNinja::MemoryMap::SetMemoryRegionEnabled ( const std::string & name,
bool enabled )
inline

◆ IsMemoryRegionRebaseable()

bool BinaryNinja::MemoryMap::IsMemoryRegionRebaseable ( const std::string & name)
inline

◆ SetMemoryRegionRebaseable()

bool BinaryNinja::MemoryMap::SetMemoryRegionRebaseable ( const std::string & name,
bool rebaseable )
inline

◆ GetMemoryRegionFill()

uint8_t BinaryNinja::MemoryMap::GetMemoryRegionFill ( const std::string & name)
inline

◆ SetMemoryRegionFill()

bool BinaryNinja::MemoryMap::SetMemoryRegionFill ( const std::string & name,
uint8_t fill )
inline

◆ GetMemoryRegionDisplayName()

std::string BinaryNinja::MemoryMap::GetMemoryRegionDisplayName ( const std::string & name)
inline

◆ SetMemoryRegionDisplayName()

bool BinaryNinja::MemoryMap::SetMemoryRegionDisplayName ( const std::string & name,
const std::string & displayName )
inline

◆ IsMemoryRegionLocal()

bool BinaryNinja::MemoryMap::IsMemoryRegionLocal ( const std::string & name)
inline

◆ GetMemoryRegionInfo()

std::optional< MemoryRegionInfo > BinaryNinja::MemoryMap::GetMemoryRegionInfo ( const std::string & name)
inline

◆ GetActiveMemoryRegionInfoAt()

std::optional< MemoryRegionInfo > BinaryNinja::MemoryMap::GetActiveMemoryRegionInfoAt ( uint64_t addr)
inline

◆ GetResolvedMemoryRangeAt()

std::optional< ResolvedMemoryRange > BinaryNinja::MemoryMap::GetResolvedMemoryRangeAt ( uint64_t addr)
inline

◆ GetMemoryRegions()

std::vector< MemoryRegionInfo > BinaryNinja::MemoryMap::GetMemoryRegions ( )
inline

◆ GetResolvedRanges()

std::vector< ResolvedMemoryRange > BinaryNinja::MemoryMap::GetResolvedRanges ( )
inline

◆ Reset()

void BinaryNinja::MemoryMap::Reset ( )
inline