decompiler  1.0.0
Public Member Functions | Private Attributes | List of all members
InjectPayloadGhidra Class Reference

An injection payload that uses a Ghidra client to generate the p-code ops. More...

#include <inject_ghidra.hh>

Inheritance diagram for InjectPayloadGhidra:
InjectPayload InjectCallfixupGhidra InjectCallotherGhidra

Public Member Functions

 InjectPayloadGhidra (const string &src, const string &nm, int4 tp)
 Constructor.
 
virtual void inject (InjectContext &context, PcodeEmit &emit) const
 
virtual void restoreXml (const Element *el)
 Restore this payload from an XML stream. More...
 
virtual void printTemplate (ostream &s) const
 Print the p-code ops of the injection to a stream (for debugging)
 
virtual string getSource (void) const
 Return a string describing the source of the injection (.cspec, prototype model, etc.)
 
- Public Member Functions inherited from InjectPayload
 InjectPayload (const string &nm, int4 tp)
 Construct for use with restoreXml.
 
int4 getParamShift (void) const
 Get the number of parameters shifted.
 
bool isDynamic (void) const
 Return true if p-code in the injection is generated dynamically.
 
int4 sizeInput (void) const
 Return the number of input parameters.
 
int4 sizeOutput (void) const
 Return the number of output parameters.
 
InjectParametergetInput (int4 i)
 Get the i-th input parameter.
 
InjectParametergetOutput (int4 i)
 Get the i-th output parameter.
 
virtual ~InjectPayload (void)
 Destructor.
 
string getName (void) const
 Return the name of the injection.
 
int4 getType (void) const
 Return the type of injection (CALLFIXUP_TYPE, CALLOTHERFIXUP_TYPE, etc.)
 

Private Attributes

string source
 Source description to associate with the payload.
 

Additional Inherited Members

- Public Types inherited from InjectPayload
enum  { CALLFIXUP_TYPE = 1, CALLOTHERFIXUP_TYPE = 2, CALLMECHANISM_TYPE = 3, EXECUTABLEPCODE_TYPE = 4 }
 
- Protected Member Functions inherited from InjectPayload
void orderParameters (void)
 Assign an index to parameters. More...
 
- Static Protected Member Functions inherited from InjectPayload
static void readParameter (const Element *el, string &name, uint4 &size)
 Read in an <input> or <output> XML tag describing an injection parameter. More...
 
- Protected Attributes inherited from InjectPayload
string name
 Formal name of the payload.
 
int4 type
 Type of this payload: CALLFIXUP_TYPE, CALLOTHERFIXUP_TYPE, etc.
 
bool dynamic
 True if the injection is generated dynamically.
 
int4 paramshift
 Number of parameters shifted in the original call.
 
vector< InjectParameterinputlist
 List of input parameters to this payload.
 
vector< InjectParameteroutput
 List of output parameters.
 

Detailed Description

An injection payload that uses a Ghidra client to generate the p-code ops.

This acts as a placeholder for the actual details of the payload. When the inject() method is invoked, the context is wrapped as XML and sent to the Ghidra client, which returns the actual p-code to inject.

Member Function Documentation

◆ inject()

void InjectPayloadGhidra::inject ( InjectContext context,
PcodeEmit emit 
) const
virtual

Perform the injection of this payload into data-flow.

P-code operations representing this payload are copied into the controlling analysis context. The provided PcodeEmit object dictates exactly where the PcodeOp and Varnode objects are inserted and to what container. An InjectContext object specifies how placeholder elements become concrete Varnodes in the appropriate context.

Parameters
contextis the provided InjectConject object
emitis the provovided PcodeEmit object

Implements InjectPayload.

References ArchitectureGhidra::getPcodeInject(), InjectContext::glb, InjectPayload::name, and InjectPayload::type.

◆ restoreXml()

virtual void InjectPayloadGhidra::restoreXml ( const Element el)
inlinevirtual

Restore this payload from an XML stream.

The base class version of this method restores from a <pcode> tag. Derived classes may restore from a parent tag and then invoke the base class method.

Parameters
elis the XML element

Reimplemented from InjectPayload.

Reimplemented in InjectCallotherGhidra, and InjectCallfixupGhidra.


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