Class AbstractUnaryExpressionSolver<T extends UnaryExpression>
java.lang.Object
ghidra.app.plugin.assembler.sleigh.expr.AbstractExpressionSolver<T>
ghidra.app.plugin.assembler.sleigh.expr.AbstractUnaryExpressionSolver<T>
- Type Parameters:
T
- the type of expression solved (the operator)
- Direct Known Subclasses:
MinusExpressionSolver
,NotExpressionSolver
public abstract class AbstractUnaryExpressionSolver<T extends UnaryExpression>
extends AbstractExpressionSolver<T>
A solver that handles expressions of the form
[OP]A
-
Field Summary
Fields inherited from class ghidra.app.plugin.assembler.sleigh.expr.AbstractExpressionSolver
dbg, solver
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract MaskedLong
compute
(MaskedLong val) Compute the result of applying the operator to the given valuecomputeInverse
(MaskedLong goal) Compute the input value given that the result is knownint
getInstructionLength
(T exp) Determines the length of the subconstructor that would be returned had the expression not depended on an undefined symbol.Attempt to get a constant value for the expressionsolve
(AbstractAssemblyResolutionFactory<?, ?> factory, T exp, MaskedLong goal, Map<String, Long> vals, AssemblyResolvedPatterns cur, Set<SolverHint> hints, String description) Attempt to solve an expression for a given valuevalueForResolution
(T exp, Map<String, Long> vals, AssemblyResolvedPatterns rc) Compute the value of the expression given the (possibly-intermediate) resolutionMethods inherited from class ghidra.app.plugin.assembler.sleigh.expr.AbstractExpressionSolver
register
-
Constructor Details
-
AbstractUnaryExpressionSolver
-
-
Method Details
-
solve
public AssemblyResolution solve(AbstractAssemblyResolutionFactory<?, ?> factory, T exp, MaskedLong goal, Map<String, throws NeedsBackfillExceptionLong> vals, AssemblyResolvedPatterns cur, Set<SolverHint> hints, String description) Description copied from class:AbstractExpressionSolver
Attempt to solve an expression for a given value- Specified by:
solve
in classAbstractExpressionSolver<T extends UnaryExpression>
- Parameters:
exp
- the expression to solvegoal
- the desired value of the expressionvals
- values of defined symbolshints
- describes techniques applied by calling solversdescription
- the description to give to resolved solutions- Returns:
- the resolution
- Throws:
NeedsBackfillException
- if the expression refers to an undefined symbol
-
getValue
public MaskedLong getValue(T exp, Map<String, Long> vals, AssemblyResolvedPatterns cur) throws NeedsBackfillExceptionDescription copied from class:AbstractExpressionSolver
Attempt to get a constant value for the expression- Specified by:
getValue
in classAbstractExpressionSolver<T extends UnaryExpression>
- Parameters:
exp
- the expressionvals
- values of defined symbols- Returns:
- the constant value, or null if it depends on a variable
- Throws:
NeedsBackfillException
- if the expression refers to an undefined symbol
-
computeInverse
Compute the input value given that the result is knownNOTE: Assumes an involution by default
- Parameters:
goal
- the result- Returns:
- the input value solution
-
compute
Compute the result of applying the operator to the given value- Parameters:
val
- the input value- Returns:
- the result
-
getInstructionLength
Description copied from class:AbstractExpressionSolver
Determines the length of the subconstructor that would be returned had the expression not depended on an undefined symbol.This is used by the backfilling process to ensure values are written to the correct offset
- Specified by:
getInstructionLength
in classAbstractExpressionSolver<T extends UnaryExpression>
- Parameters:
exp
- the expression- Returns:
- the length of filled in token field(s).
-
valueForResolution
Description copied from class:AbstractExpressionSolver
Compute the value of the expression given the (possibly-intermediate) resolution- Specified by:
valueForResolution
in classAbstractExpressionSolver<T extends UnaryExpression>
- Parameters:
exp
- the expression to evaluatevals
- values of defined symbolsrc
- the resolution on which to evaluate it- Returns:
- the result
-