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

This class is used to analyze data held in a trace file with various methods. More...

#include <code_trace_analysis.hpp>

Public Member Functions

 CodeTraceAnalyzer (std::string trace_path)
 
void reach_address (ADDR addr)
 
void reach_offset (std::string name, uint32_t off)
 
void loop_on_every_hit (ANALYZER_HIT_CALLBACK callback, bool reset_cursor=true)
 
void loop_on_every_mod_hit (ANALYZER_HIT_CALLBACK callback, std::string name, bool reset_cursor=true)
 
void search_hit_address (ANALYZER_HIT_CALLBACK callback, ADDR addr, bool reset_cursor=true)
 
void search_hit_address_range (ANALYZER_HIT_CALLBACK callback, ADDR start_addr, ADDR end_addr, bool reset_cursor=true)
 
void search_hit_offset (ANALYZER_HIT_CALLBACK callback, std::string name, uint32_t off, bool reset_cursor=true)
 
void search_hit_offset_range (ANALYZER_HIT_CALLBACK callback, std::string name, ADDR start_off, ADDR end_off, bool reset_cursor=true)
 
template<typename T >
void search_reg_val (ANALYZER_HIT_CALLBACK callback, REG reg, T val)
 

Private Attributes

CodeTraceReader reader
 The CodeTraceReader used to parse the trace file.
 

Detailed Description

This class is used to analyze data held in a trace file with various methods.

Constructor & Destructor Documentation

◆ CodeTraceAnalyzer()

arion::CodeTraceAnalyzer::CodeTraceAnalyzer ( std::string  trace_path)

Builder for CodeTraceAnalyzer instances.

Parameters
[in]trace_pathPath to the trace file.

Member Function Documentation

◆ loop_on_every_hit()

void arion::CodeTraceAnalyzer::loop_on_every_hit ( ANALYZER_HIT_CALLBACK  callback,
bool  reset_cursor = true 
)

Calls the given callback on every hit contained in the trace file.

Parameters
[in]callbackThe callback to be called for each hit.
[in]reset_cursorWhether the cursor of the underlying reader should be reset to the top of the trace file.

◆ loop_on_every_mod_hit()

void arion::CodeTraceAnalyzer::loop_on_every_mod_hit ( ANALYZER_HIT_CALLBACK  callback,
std::string  name,
bool  reset_cursor = true 
)

Calls the given callback on every hit contained in a given module from the trace file.

Parameters
[in]callbackThe callback to be called for each module hit.
[in]nameName of the module to process.
[in]reset_cursorWhether the cursor of the underlying reader should be reset to the top of the trace file.

◆ reach_address()

void arion::CodeTraceAnalyzer::reach_address ( ADDR  addr)

Tells the underlying reader to advance until it reaches a given PC address in a hit.

Parameters
[in]addrThe address to reach.
Returns
The hit containing the given PC address.

◆ reach_offset()

void arion::CodeTraceAnalyzer::reach_offset ( std::string  name,
uint32_t  off 
)

Tells the underlying reader to advance until it reaches a given PC offset from a module start in a hit.

Parameters
[in]mod_idID of the module to compute offset from.
[in]offThe offset to reach.
Returns
The hit containing the given PC offset.

◆ search_hit_address()

void arion::CodeTraceAnalyzer::search_hit_address ( ANALYZER_HIT_CALLBACK  callback,
ADDR  addr,
bool  reset_cursor = true 
)

Calls the callback when a hit contains the given PC address.

Parameters
[in]callbackThe callback to be called when the PC address is reached.
[in]addrThe address to be reached.
[in]reset_cursorWhether the cursor of the underlying reader should be reset to the top of the trace file.

◆ search_hit_address_range()

void arion::CodeTraceAnalyzer::search_hit_address_range ( ANALYZER_HIT_CALLBACK  callback,
ADDR  start_addr,
ADDR  end_addr,
bool  reset_cursor = true 
)

Calls the callback when a hit PC address is contained in the specified bounds.

Parameters
[in]callbackThe callback to be called when the PC address is in the specified bounds.
[in]start_addrStart address of the code range to be reached.
[in]end_addrEnd address of the code area to be reached.
[in]reset_cursorWhether the cursor of the underlying reader should be reset to the top of the trace file.

◆ search_hit_offset()

void arion::CodeTraceAnalyzer::search_hit_offset ( ANALYZER_HIT_CALLBACK  callback,
std::string  name,
uint32_t  off,
bool  reset_cursor = true 
)

Calls the callback when a hit PC address is a given module offset.

Parameters
[in]callbackThe callback to be called when the module offset is reached.
[in]nameName of the module to compute the offset from.
[in]offOffset of the module to be reached.
[in]reset_cursorWhether the cursor of the underlying reader should be reset to the top of the trace file.

◆ search_hit_offset_range()

void arion::CodeTraceAnalyzer::search_hit_offset_range ( ANALYZER_HIT_CALLBACK  callback,
std::string  name,
ADDR  start_off,
ADDR  end_off,
bool  reset_cursor = true 
)

Calls the callback when a hit PC address is at a given module range.

Parameters
[in]callbackThe callback to be called when the module range is reached.
[in]nameName of the module to compute the range from.
[in]start_offStart offset of the module range to be reached.
[in]end_offEnd offset of the module range to be reached.
[in]reset_cursorWhether the cursor of the underlying reader should be reset to the top of the trace file.

◆ search_reg_val()

template<typename T >
void arion::CodeTraceAnalyzer::search_reg_val ( ANALYZER_HIT_CALLBACK  callback,
REG  reg,
val 
)
inline

Calls the callback when a hit contains a given register value. Only makes sense for files generated with TRACE_MODE::CTXT.

Template Parameters
TA RVAL type large enough to store the register value.
Parameters
[in]callbackThe callback to be called when the register value is reached.
[in]regThe context register which is being monitored.
[in]valThe register value to be reached.

Member Data Documentation

◆ reader

CodeTraceReader arion::CodeTraceAnalyzer::reader
private

The CodeTraceReader used to parse the trace file.


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