--- title: "trace_converter_t< T > Class Template Reference" layout: default permalink: /classtrace__converter__t.html ---
DynamoRIO
Protected Member Functions | Protected Attributes | Static Protected Attributes
trace_converter_t< T > Class Template Reference

#include <raw2trace.h>

Protected Member Functions

 trace_converter_t (void *dcontext)
 
 ~trace_converter_t ()
 
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)
 

Protected Attributes

void *const dcontext_
 
bool passed_dcontext_ = false
 

Static Protected Attributes

static const uint WRITE_BUFFER_SIZE = 64
 

Detailed Description

template<typename T>
class trace_converter_t< T >

trace_converter_t is a reusable component that encapsulates raw trace conversion.

Conversion happens from a data source abstracted by the type parameter T. We make no assumption about how thread buffers are organized. We do assume the internal composition of thread buffers is "as written" by the thread. For example, all thread buffers belonging to different threads may be in a separate files; or buffers may be co-located in one large file, or spread accross multiple, mixed-thread files.

trace_converter_t expects to be instantiated with its type template T which should provide the following APIs. These pass through an opaque pointer which provides per-traced-thread-local data to the converter:

Constructor & Destructor Documentation

◆ trace_converter_t()

template<typename T >
trace_converter_t< T >::trace_converter_t ( void *  dcontext)
inlineprotected

Construct a new trace_converter_t object. If a nullptr dcontext is passed, creates a new DR context va dr_standalone_init().

◆ ~trace_converter_t()

template<typename T >
trace_converter_t< T >::~trace_converter_t ( )
inlineprotected

Destroys this trace_converter_t object. If a nullptr dcontext_in was passed to the constructor, calls dr_standalone_exit().

Member Function Documentation

◆ modvec_()

template<typename T >
const std::vector<module_t>& trace_converter_t< T >::modvec_ ( ) const
inlineprotected

Get the module map.

◆ process_offline_entry()

template<typename T >
std::string trace_converter_t< T >::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 
)
inlineprotected

Convert starting from in_entry, and reading more entries as required. Sets end_of_record to true if processing hit the end of a record. set_modvec_() must have been called by the implementation before calling this API.

◆ read_header()

template<typename T >
std::string trace_converter_t< T >::read_header ( void *  tls,
OUT trace_header_t header 
)
inlineprotected

Read the header of a thread, by calling T's get_next_entry() successively to populate the header values. The timestamp field is populated only for legacy traces.

◆ set_modvec_()

template<typename T >
void trace_converter_t< T >::set_modvec_ ( const std::vector< module_t > *  modvec)
inlineprotected

Set the module map. Must be called before process_offline_entry() is called.

Field Documentation

◆ dcontext_

template<typename T >
void* const trace_converter_t< T >::dcontext_
protected

The pointer to the DR context.

◆ passed_dcontext_

template<typename T >
bool trace_converter_t< T >::passed_dcontext_ = false
protected

Whether a non-nullptr dcontext was passed to the constructor.

◆ WRITE_BUFFER_SIZE

template<typename T >
const uint trace_converter_t< T >::WRITE_BUFFER_SIZE = 64
staticprotected

The trace_entry_t buffer returned by get_write_buffer() is assumed to be at least WRITE_BUFFER_SIZE large.


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