#include <raw2trace.h>
Inherits trace_converter_t< raw2trace_t >.
Public Member Functions | |
std::string | handle_custom_data (const char *(*parse_cb)(const char *src, OUT void **data), std::string(*process_cb)(drmodtrack_info_t *info, void *data, void *user_data), void *process_cb_user_data, void(*free_cb)(void *data)) |
std::string | do_module_parsing () |
std::string | do_module_parsing_and_mapping () |
std::string | find_mapped_trace_address (app_pc trace_address, OUT app_pc *mapped_address) |
virtual std::string | do_conversion () |
Friends | |
class | trace_converter_t< raw2trace_t > |
Additional Inherited Members | |
![]() | |
trace_converter_t (void *dcontext_in) | |
std::string | process_offline_entry (void *tls, const offline_entry_t *in_entry, thread_id_t tid, OUT bool *end_of_record, OUT bool *last_bb_handled) |
std::string | read_header (void *tls, OUT trace_header_t *header) |
const std::vector< module_t > & | modvec () const |
void | set_modvec (const std::vector< module_t > *modvec_in) |
![]() | |
void *const | dcontext |
![]() | |
static const uint | WRITE_BUFFER_SIZE |
The raw2trace class converts the raw offline trace format to the format expected by analysis tools. It requires access to the binary files for the libraries and executable that were present during tracing.
|
virtual |
Performs the conversion from raw data to finished trace files. Returns a non-empty error message on failure.
std::string raw2trace_t::do_module_parsing | ( | ) |
Performs the first step of do_conversion() without further action: parses and iterates over the list of modules. This is provided to give the user a method for iterating modules in the presence of the custom field used by drmemtrace that prevents direct use of drmodtrack_offline_read(). On success, calls the process_cb
function passed to handle_custom_data() for every module in the list, and returns an empty string at the end. Returns a non-empty error message on failure.
std::string raw2trace_t::do_module_parsing_and_mapping | ( | ) |
This interface is meant to be used with a final trace rather than a raw trace, using the module log file saved from the raw2trace conversion. This routine first calls do_module_parsing() and then maps each module into the current address space, allowing the user to augment the instruction information in the trace with additional information by decoding the instruction bytes. The routine find_mapped_trace_address() should be used to convert from memref_t.instr.addr to the corresponding mapped address in the current process. Returns a non-empty error message on failure.
std::string raw2trace_t::find_mapped_trace_address | ( | app_pc | trace_address, |
OUT app_pc * | mapped_address | ||
) |
This interface is meant to be used with a final trace rather than a raw trace, using the module log file saved from the raw2trace conversion. When do_module_parsing_and_mapping() has been called, this routine can be used to convert an instruction program counter in a trace into an address in the current process where the instruction bytes for that instruction are mapped, allowing decoding for obtaining further information than is stored in the trace. Returns a non-empty error message on failure.
std::string raw2trace_t::handle_custom_data | ( | const char *(*)(const char *src, OUT void **data) | parse_cb, |
std::string(*)(drmodtrack_info_t *info, void *data, void *user_data) | process_cb, | ||
void * | process_cb_user_data, | ||
void(*)(void *data) | free_cb | ||
) |
Adds handling for custom data fields that were stored with each module via drmemtrace_custom_module_data() during trace generation. When do_conversion() or do_module_parsing() is subsequently called, its parsing of the module data will invoke parse_cb
, which should advance the module data pointer passed in src
and return it as its return value (or nullptr on error), returning the resulting parsed data in data
. The data
pointer will later be passed to both process_cb
, which can update the module path inside info
(and return a non-empty string on error), and free_cb, which can perform cleanup.
A custom callback value process_cb_user_data
can be passed to process_cb
. The same is not provided for the other callbacks as they end up using the drmodtrack_add_custom_data() framework where there is no support for custom callback parameters.
Returns a non-empty error message on failure.