Ghidra Decompiler Analysis Engine
Classes | Public Member Functions | List of all members
SubvariableFlow Class Reference

Class for shrinking big Varnodes carrying smaller logical values. More...

#include <subflow.hh>

Public Member Functions

 SubvariableFlow (Funcdata *f, Varnode *root, uintb mask, bool aggr, bool sext, bool big)
 Constructor. More...
 
bool doTrace (void)
 Trace logical value through data-flow, constructing transform. More...
 
void doReplacement (void)
 Perform the discovered transform, making logical values explicit.
 

Detailed Description

Class for shrinking big Varnodes carrying smaller logical values.

Given a root within the syntax tree and dimensions of a logical variable, this class traces the flow of this logical variable through its containing Varnodes. It then creates a subgraph of this flow, where there is a correspondence between nodes in the subgraph and nodes in the original graph containing the logical variable. When doReplacement is called, this subgraph is duplicated as a new separate piece within the syntax tree. Ops are replaced to reflect the manipulation of of the logical variable, rather than the containing variable. Operations in the original graph which pluck out the logical variable from the containing variable, are replaced with copies from the corresponding node in the new section of the graph, which frequently causes the operations on the original container Varnodes to becomes dead code.

Constructor & Destructor Documentation

◆ SubvariableFlow()

SubvariableFlow::SubvariableFlow ( Funcdata f,
Varnode root,
uintb  mask,
bool  aggr,
bool  sext,
bool  big 
)

Constructor.

Parameters
fis the function to attempt the subvariable transform on
rootis a starting Varnode containing a smaller logical value
maskis a mask where 1 bits indicate the position of the logical value within the root Varnode
aggris true if we should use aggressive (less restrictive) tests during the trace
sextis true if we should assume sign extensions from the logical value into its container
bigis true if we look for subvariable flow for big (8-byte) logical values

Member Function Documentation

◆ doTrace()

bool SubvariableFlow::doTrace ( void  )

Trace logical value through data-flow, constructing transform.

Push the logical value around, setting up explicit transforms as we go that convert them into explicit Varnodes. If at any point, we cannot naturally interpret the flow of the logical value, return false.

Returns
true if a full transform has been constructed that can make logical values into explicit Varnodes

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