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
-
Method Summary
Modifier and TypeMethodDescriptionevaluate
(byte[] exprBytes) evaluate
(DWARFExpression _expr) evaluate
(DWARFExpression _expr, long... stackArgs) int
int
Returns theregister
that holds the contents of the object that theexpression
points to.boolean
isDeref()
boolean
boolean
boolean
long
peek()
long
pop()
void
push
(long l) readExpr
(byte[] exprBytes) void
setFrameBase
(long fb) void
setMaxStepCount
(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 theregister
that holds the contents of the object that theexpression
points 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()
-