decompiler  1.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ghidra::PcodeEmitCache Class Reference

P-code emitter that dumps its raw Varnodes and PcodeOps to an in memory cache. More...

#include <emulate.hh>

Inheritance diagram for ghidra::PcodeEmitCache:
ghidra::PcodeEmit

Public Member Functions

 PcodeEmitCache (vector< PcodeOpRaw *> &ocache, vector< VarnodeData *> &vcache, const vector< OpBehavior *> &in, uintb uniqReserve)
 Constructor. More...
 
virtual void dump (const Address &addr, OpCode opc, VarnodeData *outvar, VarnodeData *vars, int4 isize)
 The main pcode emit method. More...
 
- Public Member Functions inherited from ghidra::PcodeEmit
virtual ~PcodeEmit (void)
 Virtual destructor.
 
void decodeOp (const Address &addr, Decoder &decoder)
 Emit pcode directly from an <op> element. More...
 

Private Member Functions

VarnodeDatacreateVarnode (const VarnodeData *var)
 Clone and cache a raw VarnodeData. More...
 

Private Attributes

vector< PcodeOpRaw * > & opcache
 The cache of current p-code ops.
 
vector< VarnodeData * > & varcache
 The cache of current varnodes.
 
const vector< OpBehavior * > & inst
 Array of behaviors for translating OpCode.
 
uintm uniq
 Starting offset for defining temporaries in unique space.
 

Detailed Description

P-code emitter that dumps its raw Varnodes and PcodeOps to an in memory cache.

This is used for emulation when full Varnode and PcodeOp objects aren't needed

Constructor & Destructor Documentation

◆ PcodeEmitCache()

ghidra::PcodeEmitCache::PcodeEmitCache ( vector< PcodeOpRaw *> &  ocache,
vector< VarnodeData *> &  vcache,
const vector< OpBehavior *> &  in,
uintb  uniqReserve 
)

Constructor.

Provide the emitter with the containers that will hold the cached p-code ops and varnodes.

Parameters
ocacheis the container for cached PcodeOpRaw
vcacheis the container for cached VarnodeData
inis the map of OpBehavior
uniqReserveis the starting offset for temporaries in the unique space

References uniq.

Member Function Documentation

◆ createVarnode()

VarnodeData * ghidra::PcodeEmitCache::createVarnode ( const VarnodeData var)
private

Clone and cache a raw VarnodeData.

Create an internal copy of the VarnodeData and cache it.

Parameters
varis the incoming VarnodeData being dumped
Returns
the cloned VarnodeData

References varcache.

Referenced by dump().

◆ dump()

void ghidra::PcodeEmitCache::dump ( const Address addr,
OpCode  opc,
VarnodeData outvar,
VarnodeData vars,
int4  isize 
)
virtual

The main pcode emit method.

A single pcode instruction is returned to the application via this method. Particular applications override it to tailor how the operations are used.

Parameters
addris the Address of the machine instruction
opcis the opcode of the particular pcode instruction
outvarif not null is a pointer to data about the output varnode
varsis a pointer to an array of VarnodeData for each input varnode
isizeis the number of input varnodes

Implements ghidra::PcodeEmit.

References ghidra::PcodeOpRaw::addInput(), createVarnode(), inst, opcache, ghidra::PcodeOpRaw::setBehavior(), ghidra::PcodeOpRaw::setOutput(), ghidra::PcodeOpRaw::setSeqNum(), and uniq.


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