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

A class that solves for stack-pointer changes across unknown sub-functions. More...

Public Member Functions

void solve (void)
 Solve the system of equations.
 
void build (const Funcdata &data, AddrSpace *id, int4 spcbase)
 Build the system of equations. More...
 
int4 getNumVariables (void) const
 Get the number of variables in the system.
 
VarnodegetVariable (int4 i) const
 Get the i-th Varnode variable.
 
int4 getCompanion (int4 i) const
 Get the i-th variable's companion index.
 
int4 getSolution (int4 i) const
 Get the i-th variable's solution.
 

Private Member Functions

void duplicate (void)
 Duplicate each equation, multiplying by -1.
 
void propagate (int4 varnum, int4 val)
 Propagate solution for one variable to other variables. More...
 

Private Attributes

vector< StackEqneqs
 Known equations based on operations that explicitly change the stack-pointer.
 
vector< StackEqnguess
 Guessed equations for underdetermined systems.
 
vector< Varnode * > vnlist
 The indexed set of variables, one for each reference to the stack-pointer.
 
vector< int4 > companion
 Index of companion input for variable produced by CPUI_INDIRECT.
 
Address spacebase
 Starting address of the stack-pointer.
 
vector< int4 > soln
 Collected solutions (corresponding to array of variables)
 
int4 missedvariables
 Number of variables for which we are missing an equation.
 

Detailed Description

A class that solves for stack-pointer changes across unknown sub-functions.

Member Function Documentation

◆ build()

void ghidra::StackSolver::build ( const Funcdata data,
AddrSpace id,
int4  spcbase 
)

◆ propagate()

void ghidra::StackSolver::propagate ( int4  varnum,
int4  val 
)
private

Propagate solution for one variable to other variables.

Given a solution for one variable, look for equations containing the variable and attempt to solve for the other variable. Continue propagating new solutions to other equations to find even more solutions. Populate the soln array with the solutions.

Parameters
varnumis the index of the initial variable
valis the solution for the variable

References ghidra::StackEqn::compare(), ghidra::StackEqn::var1, and ghidra::StackEqn::var2.


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