Class DWARFExpressionEvaluator
- java.lang.Object
-
- ghidra.app.util.bin.format.dwarf4.expression.DWARFExpressionEvaluator
-
public class DWARFExpressionEvaluator extends java.lang.ObjectEvaluates 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 Constructor Description DWARFExpressionEvaluator(byte pointerSize, boolean isLittleEndian, int dwarfFormat, DWARFRegisterMappings registerMappings)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DWARFExpressionEvaluatorcreate(DebugInfoEntry die)DWARFExpressionResultevaluate(byte[] exprBytes)DWARFExpressionResultevaluate(DWARFExpression _expr)DWARFExpressionResultevaluate(DWARFExpression _expr, long... stackArgs)RegistergetLastRegister()intgetMaxStepCount()intgetRawLastRegister()java.lang.StringgetStackAsString()RegistergetTerminalRegister()Returns theregisterthat holds the contents of the object that theexpressionpoints to.booleanisDeref()booleanisDwarfStackValue()booleanisRegisterLocation()booleanisStackRelative()longpeek()longpop()voidpush(long l)DWARFExpressionreadExpr(byte[] exprBytes)voidsetFrameBase(long fb)voidsetMaxStepCount(int maxStepCount)java.lang.StringtoString()booleanuseUnknownRegister()
-
-
-
Constructor Detail
-
DWARFExpressionEvaluator
public DWARFExpressionEvaluator(byte pointerSize, boolean isLittleEndian, int dwarfFormat, DWARFRegisterMappings registerMappings)
-
-
Method Detail
-
create
public static DWARFExpressionEvaluator create(DebugInfoEntry die)
-
setFrameBase
public void setFrameBase(long fb)
-
push
public void push(long l)
-
peek
public long peek() throws DWARFExpressionException- Throws:
DWARFExpressionException
-
pop
public long pop() throws DWARFExpressionException- Throws:
DWARFExpressionException
-
getTerminalRegister
public Register 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
public DWARFExpression readExpr(byte[] exprBytes) throws DWARFExpressionException
- Throws:
DWARFExpressionException
-
evaluate
public DWARFExpressionResult evaluate(byte[] exprBytes) throws DWARFExpressionException
- 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
public DWARFExpressionResult evaluate(DWARFExpression _expr) throws DWARFExpressionException
- Throws:
DWARFExpressionException
-
getStackAsString
public java.lang.String getStackAsString()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getMaxStepCount
public int getMaxStepCount()
-
setMaxStepCount
public void setMaxStepCount(int maxStepCount)
-
isDwarfStackValue
public boolean isDwarfStackValue()
-
useUnknownRegister
public boolean useUnknownRegister()
-
isRegisterLocation
public boolean isRegisterLocation()
-
getLastRegister
public Register getLastRegister()
-
getRawLastRegister
public int getRawLastRegister()
-
isStackRelative
public boolean isStackRelative()
-
-