dynamorio::drmemtrace::decode_info_base_t Class Referenceabstract

#include <decode_cache.h>

Inheritance diagram for dynamorio::drmemtrace::decode_info_base_t:
dynamorio::drmemtrace::instr_decode_info_t

Public Member Functions

void set_decode_info (void *dcontext, const dynamorio::drmemtrace::_memref_instr_t &memref_instr, instr_t *instr, app_pc decode_pc)
 
bool is_valid () const
 
std::string get_error_string () const
 

Private Member Functions

virtual std::string set_decode_info_derived (void *dcontext, const dynamorio::drmemtrace::_memref_instr_t &memref_instr, instr_t *instr, app_pc decode_pc)=0
 

Detailed Description

Base class for storing instruction decode info. Users should sub-class this base class and implement set_decode_info_derived() to derive and store the decode info they need.

Member Function Documentation

◆ get_error_string()

std::string dynamorio::drmemtrace::decode_info_base_t::get_error_string ( ) const

Returns the details of the error encountered when decoding the instruction or during the custom logic in set_decode_info_derived().

◆ is_valid()

bool dynamorio::drmemtrace::decode_info_base_t::is_valid ( ) const

Indicates whether set_decode_info() was successfully invoked on the object by a dynamorio::drmemtrace::decode_cache_t using a successfully decoded instruction. is_valid() will be false if the object is default-constructed.

◆ set_decode_info()

void dynamorio::drmemtrace::decode_info_base_t::set_decode_info ( void *  dcontext,
const dynamorio::drmemtrace::_memref_instr_t memref_instr,
instr_t instr,
app_pc  decode_pc 
)

Sets the decode info for the provided instr which was allocated using the provided dcontext for the provided memref_instr, decoded from raw bytes at the provided address in decode_pc (raw bytes address is valid only for this call).

This invokes the set_decode_info_derived() provided by the derived class, and additionally does other required bookkeeping.

set_decode_info_derived() is expected to take ownership of the provided instr if used with a dynamorio::drmemtrace::decode_cache_t object constructed with persist_decoded_instr_ set to true.

The provided instr will be nullptr if the dynamorio::drmemtrace::decode_cache_t was constructed with include_decoded_instr_ set to false, which is useful when the user needs only the decode_pc to perform the actual decoding themselves.

◆ set_decode_info_derived()

virtual std::string dynamorio::drmemtrace::decode_info_base_t::set_decode_info_derived ( void *  dcontext,
const dynamorio::drmemtrace::_memref_instr_t memref_instr,
instr_t instr,
app_pc  decode_pc 
)
privatepure virtual

Sets the decoding info fields as required by the derived class, based on the provided instr_t which was allocated using the provided opaque dcontext for the provided memref_instr, decoded from raw bytes at the provided address in decode_pc (raw bytes address is valid only for this call). Derived classes must implement this virtual function. Note that this cannot be invoked directly as it is private, but only through set_decode_info() which does other required bookkeeping.

This is meant for use with dynamorio::drmemtrace::decode_cache_t, which will invoke set_decode_info() for each new decoded instruction.

The responsibility for invoking instr_destroy() on the provided instr lies with this dynamorio::drmemtrace::decode_info_base_t object, unless the dynamorio::drmemtrace::decode_cache_t was constructed with persist_decoded_instr_ set to false, in which case no heap allocation takes place.

The provided instr will be nullptr if the dynamorio::drmemtrace::decode_cache_t was constructed with include_decoded_instr_ set to false.

Returns an empty string if successful, or the error description.

Implemented in dynamorio::drmemtrace::instr_decode_info_t.


The documentation for this class was generated from the following file:
  • /home/runner/work/dynamorio/dynamorio/build_release-64/clients/include/drmemtrace/decode_cache.h