decompiler
1.0.0
|
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. | |
Varnode * | getVariable (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< StackEqn > | eqs |
Known equations based on operations that explicitly change the stack-pointer. | |
vector< StackEqn > | guess |
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. | |
A class that solves for stack-pointer changes across unknown sub-functions.
Build the system of equations.
Collect references to the stack-pointer as variables, and examine their defining PcodeOps to determine equations and coefficient.
data | is the function being analyzed |
id | is the stack address space |
spcbase | is the index, relative to the stack space, of the stack pointer |
References Funcdata::beginLoc(), PcodeOp::code(), companion, Varnode::comparePointers(), CPUI_COPY, CPUI_INDIRECT, CPUI_INT_ADD, CPUI_INT_AND, CPUI_MULTIEQUAL, Funcdata::endLoc(), eqs, ProtoModel::extrapop_unknown, Varnode::getAddr(), Funcdata::getCallSpecs(), Varnode::getDef(), PcodeOp::getIn(), Varnode::getOffset(), PcodeOp::getOpFromConst(), Varnode::getSpace(), AddrSpace::getSpacebase(), AddrSpace::getType(), guess, IPTR_IOP, Varnode::isConstant(), missedvariables, PcodeOp::numInput(), StackEqn::rhs, spacebase, StackEqn::var1, StackEqn::var2, and vnlist.
Referenced by ActionStackPtrFlow::analyzeExtraPop().
|
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.
varnum | is the index of the initial variable |
val | is the solution for the variable |
References StackEqn::compare(), eqs, soln, and StackEqn::var1.
Referenced by solve().