Arion 1.0.2-alpha
A high-performance C++ framework for emulating executable binaries.
 
Loading...
Searching...
No Matches
arion::MemoryRecorder Class Reference

This class is responsible for recording memory accesses to an Arion instance. More...

#include <memory_manager.hpp>

Public Member Functions

 MemoryRecorder (std::weak_ptr< Arion > arion)
 
void clear ()
 
void start ()
 
void stop ()
 
std::vector< std::shared_ptr< ARION_MEM_EDIT > > get_edits ()
 

Static Public Member Functions

static std::unique_ptr< MemoryRecorderinitialize (std::weak_ptr< Arion > arion)
 

Private Member Functions

void add_edit (std::shared_ptr< ARION_MEM_EDIT > edit)
 

Static Private Member Functions

static bool write_mem_hook (std::shared_ptr< Arion > arion, uc_mem_type type, uint64_t addr, int size, int64_t val, void *user_data)
 

Private Attributes

std::weak_ptr< Arionarion
 The Arion instance being recorded.
 
std::vector< std::shared_ptr< ARION_MEM_EDIT > > edits
 Recorded memory accesses.
 
HOOK_ID write_mem_hook_id
 ID of the hook used to record memory writes.
 
bool started = false
 Indicates whether recording is currently active.
 

Detailed Description

This class is responsible for recording memory accesses to an Arion instance.

Constructor & Destructor Documentation

◆ MemoryRecorder()

arion::MemoryRecorder::MemoryRecorder ( std::weak_ptr< Arion arion)
inline

Builder for MemoryRecorder instances.

Parameters
[in]arionThe Arion instance being recorded.

Member Function Documentation

◆ add_edit()

void arion::MemoryRecorder::add_edit ( std::shared_ptr< ARION_MEM_EDIT edit)
private

Records a new memory access.

Parameters
[in]editThe memory access to record.

◆ clear()

void arion::MemoryRecorder::clear ( )

Clears all recorded memory accesses.

◆ get_edits()

std::vector< std::shared_ptr< ARION_MEM_EDIT > > arion::MemoryRecorder::get_edits ( )

Retrieves all recorded memory accesses.

Returns
A vector of ARION_MEM_EDIT instances representing the recorded memory accesses.

◆ initialize()

static std::unique_ptr< MemoryRecorder > arion::MemoryRecorder::initialize ( std::weak_ptr< Arion arion)
static

Instanciates and initializes new MemoryRecorder objects with some parameters.

Parameters
[in]arionThe Arion instance being recorded.
Returns
A new Memory recorder instance.

◆ start()

void arion::MemoryRecorder::start ( )

Starts recording memory accesses.

◆ stop()

void arion::MemoryRecorder::stop ( )

Stops recording memory accesses.

◆ write_mem_hook()

static bool arion::MemoryRecorder::write_mem_hook ( std::shared_ptr< Arion arion,
uc_mem_type  type,
uint64_t  addr,
int  size,
int64_t  val,
void *  user_data 
)
staticprivate

The function called when a memory write occurs to the associated Arion instance.

Parameters
[in]arionArion instance that triggered the hook.
[in]typeType of memory being access.
[in]addrMemory address where the write occurred.
[in]sizeSize of the write in bytes.
[in]valValue written to memory.
[in]user_dataOptional user-defined data passed to the hook.

Member Data Documentation

◆ arion

std::weak_ptr<Arion> arion::MemoryRecorder::arion
private

The Arion instance being recorded.

◆ edits

std::vector<std::shared_ptr<ARION_MEM_EDIT> > arion::MemoryRecorder::edits
private

Recorded memory accesses.

◆ started

bool arion::MemoryRecorder::started = false
private

Indicates whether recording is currently active.

◆ write_mem_hook_id

HOOK_ID arion::MemoryRecorder::write_mem_hook_id
private

ID of the hook used to record memory writes.


The documentation for this class was generated from the following file: