Class AbstractAssemblyResolutionFactory<RP extends AssemblyResolvedPatterns,BF extends AssemblyResolvedBackfill>
java.lang.Object
ghidra.app.plugin.assembler.sleigh.sem.AbstractAssemblyResolutionFactory<RP,BF>
- Direct Known Subclasses:
DefaultAssemblyResolutionFactory
public abstract class AbstractAssemblyResolutionFactory<RP extends AssemblyResolvedPatterns,BF extends AssemblyResolvedBackfill>
extends Object
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
AbstractAssemblyResolutionFactory.AbstractAssemblyResolutionBuilder<B extends AbstractAssemblyResolutionFactory.AbstractAssemblyResolutionBuilder<B,
T>, T extends AssemblyResolution> static class
AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedBackfillBuilder<BF extends AssemblyResolvedBackfill>
static class
AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP extends AssemblyResolvedPatterns>
class
class
class
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbackfill
(PatternExpression exp, MaskedLong goal, int inslen, String description) Build a backfill record to attach to a successful resolution resultbackfillBuilder
(PatternExpression exp, MaskedLong goal, int inslen, String description) contextOnly
(AssemblyPatternBlock ctx, String description) Build a context-only successful resolution resultcontextOnlyBuilder
(AssemblyPatternBlock ctx, String description) error
(String error, AssemblyResolution res) Build an error resolution record, based on an intermediate SLEIGH constructor recorderrorBuilder
(String error, AssemblyResolution res) fromPattern
(DisjointPattern pat, int minLen, String description, Constructor cons) Build a successful resolution result from a SLEIGH constructor's patternsfromPatternBuilder
(DisjointPattern pat, int minLen, String description, Constructor cons) fromString
(String str, String description, List<AssemblyResolution> children) Build a new successful SLEIGH constructor resolution from a string representationfromStringBuilder
(String str, String description, List<AssemblyResolution> children) instrOnly
(AssemblyPatternBlock ins, String description) Build an instruction-only successful resolution resultinstrOnlyBuilder
(AssemblyPatternBlock ins, String description) Obtain a new "blank" resolved SLEIGH constructor recordnop
(String description, List<AssemblyResolution> children, AssemblyResolution right) Obtain a new "blank" resolved SLEIGH constructor recordnopBuilder
(String description) nopBuilder
(String description, List<AssemblyResolution> children, AssemblyResolution right) resolved
(AssemblyPatternBlock ins, AssemblyPatternBlock ctx, String description, Constructor cons, List<AssemblyResolution> children, AssemblyResolution right) Build the result of successfully resolving a SLEIGH constructorresolvedBuilder
(AssemblyPatternBlock ins, AssemblyPatternBlock ctx, String description, Constructor cons, List<AssemblyResolution> children, AssemblyResolution right) protected AssemblyResolutionResults
results
(Set<AssemblyResolution> col) protected AssemblyResolutionResults
Construct an immutable single-entry result set consisting of the one given resolutionprotected AssemblyResolution
solveOrBackfill
(PatternExpression exp, long goal, int bits, Map<String, Long> vals, AssemblyResolvedPatterns cur, String description) Attempt to solve an expressionprotected AssemblyResolution
solveOrBackfill
(PatternExpression exp, long goal, Map<String, Long> vals, AssemblyResolvedPatterns cur, String description) Attempt to solve an expressionprotected AssemblyResolution
solveOrBackfill
(PatternExpression exp, MaskedLong goal, Map<String, Long> vals, AssemblyResolvedPatterns cur, String description) Attempt to solve an expression
-
Field Details
-
SOLVER
-
INS
- See Also:
-
CTX
- See Also:
-
SEP
- See Also:
-
-
Constructor Details
-
AbstractAssemblyResolutionFactory
public AbstractAssemblyResolutionFactory()
-
-
Method Details
-
newPatternsBuilder
public abstract AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> newPatternsBuilder() -
newBackfillBuilder
public abstract AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedBackfillBuilder<BF> newBackfillBuilder() -
newErrorBuilder
-
singleton
Construct an immutable single-entry result set consisting of the one given resolution- Parameters:
one
- the single resolution entry- Returns:
- the new resolution set
-
newAssemblyResolutionResults
-
results
-
solveOrBackfill
protected AssemblyResolution solveOrBackfill(PatternExpression exp, MaskedLong goal, Map<String, Long> vals, AssemblyResolvedPatterns cur, String description) Attempt to solve an expression- Parameters:
exp
- the expression to solvegoal
- the desired value of the expressioncur
- the resolved constructor so fardescription
- a description of the result- Returns:
- the encoded solution, or a backfill record
-
solveOrBackfill
protected AssemblyResolution solveOrBackfill(PatternExpression exp, long goal, int bits, Map<String, Long> vals, AssemblyResolvedPatterns cur, String description) Attempt to solve an expressionConverts the given goal and bits count to a
MaskedLong
and then solves as before. As a special case, ifbits == 0
, the goal is considered fully-defined (as ifbits == 64
).- See Also:
-
solveOrBackfill
protected AssemblyResolution solveOrBackfill(PatternExpression exp, long goal, Map<String, Long> vals, AssemblyResolvedPatterns cur, String description) Attempt to solve an expressionConverts the given goal to a fully-defined
MaskedLong
and then solves.- See Also:
-
errorBuilder
public AbstractAssemblyResolutionFactory<RP,BF>.AssemblyResolvedErrorBuilder errorBuilder(String error, AssemblyResolution res) -
error
Build an error resolution record, based on an intermediate SLEIGH constructor record- Parameters:
error
- a description of the errorres
- the constructor record that was being populated when the error occurred- Returns:
- the new error resolution
-
nopBuilder
protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> nopBuilder(String description) -
nop
Obtain a new "blank" resolved SLEIGH constructor record- Parameters:
description
- a description of the resolution- Returns:
- the new resolution
-
nopBuilder
protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> nopBuilder(String description, List<AssemblyResolution> children, AssemblyResolution right) -
nop
Obtain a new "blank" resolved SLEIGH constructor record- Parameters:
description
- a description of the resolutionchildren
- any children that will be involved in populating this record- Returns:
- the new resolution
-
backfillBuilder
public AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedBackfillBuilder<BF> backfillBuilder(PatternExpression exp, MaskedLong goal, int inslen, String description) -
backfill
public AssemblyResolution backfill(PatternExpression exp, MaskedLong goal, int inslen, String description) Build a backfill record to attach to a successful resolution result- Parameters:
exp
- the expression depending on a missing symbolgoal
- the desired value of the expressioninslen
- the length of instruction portion expected in the future solutiondescription
- a description of the backfill record- Returns:
- the new record
-
resolvedBuilder
protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> resolvedBuilder(AssemblyPatternBlock ins, AssemblyPatternBlock ctx, String description, Constructor cons, List<AssemblyResolution> children, AssemblyResolution right) -
resolved
public RP resolved(AssemblyPatternBlock ins, AssemblyPatternBlock ctx, String description, Constructor cons, List<AssemblyResolution> children, AssemblyResolution right) Build the result of successfully resolving a SLEIGH constructorNOTE: This is not used strictly for resolved SLEIGH constructors. It may also be used to store intermediates, e.g., encoded operands, during constructor resolution.
- Parameters:
ins
- the instruction pattern blockctx
- the context pattern blockdescription
- a description of the resolutioncons
- the constructor, or nullchildren
- the children of this constructor, or null- Returns:
- the new resolution
-
instrOnlyBuilder
protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> instrOnlyBuilder(AssemblyPatternBlock ins, String description) -
instrOnly
Build an instruction-only successful resolution result- Parameters:
ins
- the instruction pattern blockdescription
- a description of the resolution- Returns:
- the new resolution
- See Also:
-
contextOnlyBuilder
protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> contextOnlyBuilder(AssemblyPatternBlock ctx, String description) -
contextOnly
Build a context-only successful resolution result- Parameters:
ctx
- the context pattern blockdescription
- a description of the resolution- Returns:
- the new resolution
- See Also:
-
fromPatternBuilder
protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> fromPatternBuilder(DisjointPattern pat, int minLen, String description, Constructor cons) -
fromPattern
Build a successful resolution result from a SLEIGH constructor's patterns- Parameters:
pat
- the constructor's patterndescription
- a description of the resolution- Returns:
- the new resolution
-
fromStringBuilder
protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> fromStringBuilder(String str, String description, List<AssemblyResolution> children) -
fromString
public AssemblyResolvedPatterns fromString(String str, String description, List<AssemblyResolution> children) Build a new successful SLEIGH constructor resolution from a string representationThis was used primarily in testing, to specify expected results.
- Parameters:
str
- the string representation: "ins:[pattern],ctx:[pattern]
"description
- a description of the resolutionchildren
- any children involved in the resolution- Returns:
- the decoded resolution
- See Also:
-