Class DWARFExpressionEvaluator
java.lang.Object
ghidra.app.util.bin.format.dwarf.expression.DWARFExpressionEvaluator
Evaluates a subset of DWARF expression opcodes.
Limitations:
Can not access memory during evaluation of expressions.
Some opcodes must be the last operation in the expression (deref, regX)
Can only specify offset from register for framebase and stack relative
Result can be a numeric value (ie. static address) or a register 'name' or a stack based offset.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionevaluate(byte[] exprBytes) evaluate(DWARFExpression _expr) evaluate(DWARFExpression _expr, long... stackArgs) intintReturns theregisterthat holds the contents of the object that theexpressionpoints to.booleanisDeref()booleanbooleanbooleanlongpeek()longpop()voidpush(long l) readExpr(byte[] exprBytes) voidsetFrameBase(long fb) voidsetMaxStepCount(int maxStepCount) toString()boolean
-
Constructor Details
-
DWARFExpressionEvaluator
-
-
Method Details
-
getDWARFCompilationUnit
-
setFrameBase
public void setFrameBase(long fb) -
push
public void push(long l) -
peek
- Throws:
DWARFExpressionException
-
pop
- Throws:
DWARFExpressionException
-
getTerminalRegister
Returns theregisterthat holds the contents of the object that theexpressionpoints to.Note, you should check
isDeref()to see if the register is just a pointer to the object instead of the object itself.- Returns:
-
isDeref
public boolean isDeref() -
readExpr
- Throws:
DWARFExpressionException
-
evaluate
- Throws:
DWARFExpressionException
-
evaluate
public DWARFExpressionResult evaluate(DWARFExpression _expr, long... stackArgs) throws DWARFExpressionException - Parameters:
_expr-stackArgs- - pushed 0..N, so stackArgs[0] will be deepest, stackArgs[N] will be topmost.- Returns:
- Throws:
DWARFExpressionException
-
evaluate
- Throws:
DWARFExpressionException
-
getStackAsString
-
toString
-
getMaxStepCount
public int getMaxStepCount() -
setMaxStepCount
public void setMaxStepCount(int maxStepCount) -
isDwarfStackValue
public boolean isDwarfStackValue() -
useUnknownRegister
public boolean useUnknownRegister() -
isRegisterLocation
public boolean isRegisterLocation() -
getLastRegister
-
getRawLastRegister
public int getRawLastRegister() -
isStackRelative
public boolean isStackRelative()
-