Ghidra 11.3.2
Ghidra internal decompiler documentation.
Loading...
Searching...
No Matches
ghidra::TermPatternOp Class Referenceabstract

A user defined p-code op that has a dynamically defined procedure. More...

#include <userop.hh>

Inheritance diagram for ghidra::TermPatternOp:
[legend]
Collaboration diagram for ghidra::TermPatternOp:
[legend]

Public Member Functions

 TermPatternOp (const string &nm, Architecture *g, uint4 tp, int4 ind)
 Constructor.
 
virtual int4 getNumVariableTerms (void) const =0
 Get the number of input Varnodes expected.
 
virtual bool unify (Funcdata &data, PcodeOp *op, vector< Varnode * > &bindlist) const =0
 Gather the formal input Varnode objects given the root PcodeOp.
 
virtual uintb execute (const vector< uintb > &input) const =0
 Compute the output value of this operation, given constant inputs.
 
- Public Member Functions inherited from ghidra::UserPcodeOp
 UserPcodeOp (const string &nm, Architecture *g, uint4 tp, int4 ind)
 Construct from name and index.
 
const string & getName (void) const
 Get the low-level name of the p-code op.
 
uint4 getType (void) const
 Get the encoded class type.
 
int4 getIndex (void) const
 Get the constant id of the op.
 
uint4 getDisplay (void) const
 Get display type (0=functional)
 
virtual ~UserPcodeOp (void)
 Destructor.
 
virtual string getOperatorName (const PcodeOp *op) const
 Get the symbol representing this operation in decompiled code.
 
virtual DatatypegetOutputLocal (const PcodeOp *op) const
 Return the output data-type of the user-op if specified.
 
virtual DatatypegetInputLocal (const PcodeOp *op, int4 slot) const
 Return the input data-type to the user-op in the given slot.
 
virtual int4 extractAnnotationSize (const Varnode *vn, const PcodeOp *op)
 Assign a size to an annotation input to this userop.
 
virtual void decode (Decoder &decoder)=0
 Restore the detailed description from a stream element.
 

Additional Inherited Members

- Public Types inherited from ghidra::UserPcodeOp
enum  userop_flags { annotation_assignment = 1 , no_operator = 2 , display_string = 4 }
 Enumeration of different boolean properties that can be assigned to a CALLOTHER. More...
 
enum  userop_type {
  unspecialized = 1 , injected = 2 , volatile_read = 3 , volatile_write = 4 ,
  segment = 5 , jumpassist = 6 , string_data = 7 , datatype = 8
}
 User-op class encoded as an enum. More...
 
- Static Public Attributes inherited from ghidra::UserPcodeOp
static const uint4 BUILTIN_STRINGDATA = 0x10000000
 Built-in id for the InternalStringOp.
 
static const uint4 BUILTIN_VOLATILE_READ = 0x10000001
 Built-in id for VolatileReadOp.
 
static const uint4 BUILTIN_VOLATILE_WRITE = 0x10000002
 Built-in id for VolatileWriteOp.
 
static const uint4 BUILTIN_MEMCPY = 0x10000003
 Built-in id for memcpy.
 
static const uint4 BUILTIN_STRNCPY = 0x10000004
 Built-in id for strcpy.
 
static const uint4 BUILTIN_WCSNCPY = 0x10000005
 Built-in id for wcsncpy.
 
- Protected Attributes inherited from ghidra::UserPcodeOp
string name
 Low-level name of p-code operator.
 
Architectureglb
 Architecture owning the user defined op.
 
uint4 type
 Encoded class type (userop_type)
 
int4 useropindex
 Index passed in the CALLOTHER op.
 
uint4 flags
 Boolean attributes of the CALLOTHER.
 

Detailed Description

A user defined p-code op that has a dynamically defined procedure.

The behavior of this op on constant inputs can be dynamically defined. This class defines a unify() method that picks out the input varnodes to the operation, given the root PcodeOp. The input varnodes would generally just be the input varnodes to the raw CALLOTHER after the constant id, but skipping, reordering, or other tree traversal is possible.

This class also defines an execute() method that computes the output given constant inputs (matching the format determined by unify()).

Member Function Documentation

◆ execute()

virtual uintb ghidra::TermPatternOp::execute ( const vector< uintb > &  input) const
pure virtual

Compute the output value of this operation, given constant inputs.

Parameters
inputis the ordered list of constant inputs
Returns
the resulting value as a constant

Implemented in ghidra::SegmentOp.

◆ getNumVariableTerms()

virtual int4 ghidra::TermPatternOp::getNumVariableTerms ( void  ) const
pure virtual

Get the number of input Varnodes expected.

Implemented in ghidra::SegmentOp.

◆ unify()

virtual bool ghidra::TermPatternOp::unify ( Funcdata data,
PcodeOp op,
vector< Varnode * > &  bindlist 
) const
pure virtual

Gather the formal input Varnode objects given the root PcodeOp.

Parameters
datais the function being analyzed
opis the root operation
bindlistwill hold the ordered list of input Varnodes
Returns
true if the requisite inputs were found

Implemented in ghidra::SegmentOp.


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