This class is used to read and parse an execution trace generated by an arion::CodeTracer instance.
More...
#include <code_trace_analysis.hpp>
|
| std::string | trace_path |
| | Path to the trace file.
|
| |
| std::ifstream | trace_f |
| | Stream instance for the trace file.
|
| |
| size_t | trace_f_sz |
| | Size in bytes of the trace file.
|
| |
| float | version |
| | Version of the trace file.
|
| |
| TRACE_MODE | mode |
| | The TRACE_MODE used to generate the trace file.
|
| |
| size_t | total_hits |
| | Amount of hits (e.g : instructions, basic blocks...) in the trace file.
|
| |
| std::vector< REG > | ctxt_regs |
| | List of registers making up the context for TRACE_MODE::CTXT traces.
|
| |
| off_t | secs_table_off |
| | Offset in bytes to the sections table of the trace file.
|
| |
| off_t | mod_sec_off |
| | Offset in bytes to the modules section of the trace file.
|
| |
| off_t | regs_sec_off |
| | Offset in bytes to the registers section of the trace file.
|
| |
| off_t | data_sec_off |
| | Offset in bytes to the data section of the trace file.
|
| |
| off_t | hit_i |
| | Current hit index.
|
| |
| std::map< uint16_t, std::unique_ptr< TRACE_MODULE > > | modules |
| | Map of modules in the trace file, given their id.
|
| |
This class is used to read and parse an execution trace generated by an arion::CodeTracer instance.
◆ CodeTraceReader()
| arion::CodeTraceReader::CodeTraceReader |
( |
std::string |
trace_path | ) |
|
Builder for CodeTraceReader instances.
- Parameters
-
| [in] | trace_path | Path to the trace file. |
◆ curr_hit()
| std::unique_ptr< CODE_HIT > arion::CodeTraceReader::curr_hit |
( |
| ) |
|
Retrieves the current hit being parsed.
- Returns
- The current hit being parsed.
◆ find_module_from_hash()
| std::unique_ptr< TRACE_MODULE > arion::CodeTraceReader::find_module_from_hash |
( |
std::string |
hash | ) |
|
Retrieves a TRACE_MODULE given its hash.
- Parameters
-
| [in] | hash | Hash of the module to be retrieved. |
- Returns
- The TRACE_MODULE instance.
◆ find_module_from_name()
| std::unique_ptr< TRACE_MODULE > arion::CodeTraceReader::find_module_from_name |
( |
std::string |
name | ) |
|
Retrieves a TRACE_MODULE given its name.
- Parameters
-
| [in] | name | Name of the module to be retrieved. |
- Returns
- The TRACE_MODULE instance.
◆ get_hit_index()
| off_t arion::CodeTraceReader::get_hit_index |
( |
| ) |
|
Retrieves the current hit index.
- Returns
- The current hit index.
◆ get_mode()
Retrieves the TRACE_MODE used to generate the trace file.
- Returns
- The TRACE_MODE used to generate the trace file.
◆ get_module()
| std::unique_ptr< TRACE_MODULE > arion::CodeTraceReader::get_module |
( |
uint16_t |
mod_id | ) |
|
Retrieves a TRACE_MODULE given its ID.
- Parameters
-
| [in] | mod_id | ID of the module to be retrieved. |
- Returns
- The TRACE_MODULE instance.
◆ has_reg()
| bool arion::CodeTraceReader::has_reg |
( |
REG |
reg | ) |
|
Checks whether the trace file contains the given context register. Only makes sense for files generated with TRACE_MODE::CTXT.
- Parameters
-
| [in] | reg | The register to be checked. |
- Returns
- True if the trace file contains the given context register.
◆ next_hit()
| std::unique_ptr< CODE_HIT > arion::CodeTraceReader::next_hit |
( |
| ) |
|
Retrieves the next hit to be parsed.
- Returns
- The next hit to be parsed.
◆ next_mod_hit()
| std::unique_ptr< CODE_HIT > arion::CodeTraceReader::next_mod_hit |
( |
uint16_t |
mod_id | ) |
|
Retrieves the next hit in the given module to be parsed.
- Parameters
-
| [in] | mod_id | ID of the module to find next hit from. |
- Returns
- The next hit in the given module to be parsed.
◆ prepare_file()
| void arion::CodeTraceReader::prepare_file |
( |
| ) |
|
|
private |
Prepares the parser to read the data section containing all the hits.
◆ reach_addr()
| std::unique_ptr< CODE_HIT > arion::CodeTraceReader::reach_addr |
( |
ADDR |
addr | ) |
|
Tells the reader to advance until it reaches a given PC address in a hit.
- Parameters
-
| [in] | addr | The address to reach. |
- Returns
- The hit containing the given PC address.
◆ reach_off()
| std::unique_ptr< CODE_HIT > arion::CodeTraceReader::reach_off |
( |
uint16_t |
mod_id, |
|
|
uint32_t |
off |
|
) |
| |
Tells the reader to advance until it reaches a given PC offset from a module start in a hit.
- Parameters
-
| [in] | mod_id | ID of the module to compute offset from. |
| [in] | off | The offset to reach. |
- Returns
- The hit containing the given PC offset.
◆ read_header()
| void arion::CodeTraceReader::read_header |
( |
| ) |
|
|
private |
Reads and parses the header section of the trace file.
◆ read_modules_section()
| void arion::CodeTraceReader::read_modules_section |
( |
| ) |
|
|
private |
Reads and parses the modules section of the trace file.
◆ read_regs_section()
| void arion::CodeTraceReader::read_regs_section |
( |
| ) |
|
|
private |
Reads and parses the registers section of the trace file.
◆ read_sections_table()
| void arion::CodeTraceReader::read_sections_table |
( |
| ) |
|
|
private |
Reads and parses the sections table of the trace file.
◆ reset_hit_cursor()
| void arion::CodeTraceReader::reset_hit_cursor |
( |
| ) |
|
Resets the reading cursor in the input trace file.
◆ set_hit_index()
| void arion::CodeTraceReader::set_hit_index |
( |
off_t |
hit_i | ) |
|
Sets the current hit index to a new value.
- Parameters
-
| [in] | hit_i | The new hit index. |
◆ ctxt_regs
| std::vector<REG> arion::CodeTraceReader::ctxt_regs |
|
private |
◆ data_sec_off
| off_t arion::CodeTraceReader::data_sec_off |
|
private |
Offset in bytes to the data section of the trace file.
◆ hit_i
| off_t arion::CodeTraceReader::hit_i |
|
private |
◆ mod_sec_off
| off_t arion::CodeTraceReader::mod_sec_off |
|
private |
Offset in bytes to the modules section of the trace file.
◆ mode
The TRACE_MODE used to generate the trace file.
◆ modules
| std::map<uint16_t, std::unique_ptr<TRACE_MODULE> > arion::CodeTraceReader::modules |
|
private |
Map of modules in the trace file, given their id.
◆ regs_sec_off
| off_t arion::CodeTraceReader::regs_sec_off |
|
private |
Offset in bytes to the registers section of the trace file.
◆ secs_table_off
| off_t arion::CodeTraceReader::secs_table_off |
|
private |
Offset in bytes to the sections table of the trace file.
◆ total_hits
| size_t arion::CodeTraceReader::total_hits |
|
private |
Amount of hits (e.g : instructions, basic blocks...) in the trace file.
◆ trace_f
| std::ifstream arion::CodeTraceReader::trace_f |
|
private |
Stream instance for the trace file.
◆ trace_f_sz
| size_t arion::CodeTraceReader::trace_f_sz |
|
private |
Size in bytes of the trace file.
◆ trace_path
| std::string arion::CodeTraceReader::trace_path |
|
private |
◆ version
| float arion::CodeTraceReader::version |
|
private |
Version of the trace file.
The documentation for this class was generated from the following file: