Class AssemblyResolution
- java.lang.Object
-
- ghidra.app.plugin.assembler.sleigh.sem.AssemblyResolution
-
- All Implemented Interfaces:
java.lang.Comparable<AssemblyResolution>
- Direct Known Subclasses:
AssemblyResolvedBackfill,AssemblyResolvedConstructor,AssemblyResolvedError
public abstract class AssemblyResolution extends java.lang.Object implements java.lang.Comparable<AssemblyResolution>
The (often intermediate) result of assembly These may represent a successful construction (AssemblyResolvedConstructor, a future field (AssemblyResolvedBackfill), or an error (AssemblyResolvedError). This class also provides the static factory methods for constructing any of its subclasses.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<? extends AssemblyResolution>childrenprotected java.lang.Stringdescription
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static AssemblyResolvedBackfillbackfill(PatternExpression exp, MaskedLong goal, java.util.Map<java.lang.Integer,java.lang.Object> res, int inslen, java.lang.String description)Build a backfill record to attach to a successful resolution resultprotected java.lang.StringchildrenToString(java.lang.String indent)Get the child portion oftoString()If a subclass has another, possible additional, notion of children that it would like to include intoString(), it must override this method.intcompareTo(AssemblyResolution that)protected abstract intcomputeHash()static AssemblyResolvedConstructorcontextOnly(AssemblyPatternBlock ctx, java.lang.String description, java.util.List<AssemblyResolution> children)Build a context-only successful resolution resultstatic AssemblyResolutionerror(java.lang.String error, AssemblyResolvedConstructor res)Build an error resolution record, based on an intermediate SLEIGH constructor recordstatic AssemblyResolvedErrorerror(java.lang.String error, java.lang.String description, java.util.List<? extends AssemblyResolution> children)Build an error resolution recordstatic AssemblyResolvedConstructorfromPattern(DisjointPattern pat, int minLen, java.lang.String description)Build a successful resolution result from a SLEIGH constructor's patternsbooleanhasChildren()Check if this record has children If a subclass has another, possibly additional, notion of children that it would like to include intoString(), it must override this method to return true when such children are present.inthashCode()static AssemblyResolvedConstructorinstrOnly(AssemblyPatternBlock ins, java.lang.String description, java.util.List<AssemblyResolution> children)Build an instruction-only successful resolution resultabstract booleanisBackfill()Check if this record describes a backfillabstract booleanisError()Check if this record describes an errorprotected abstract java.lang.StringlineToString()Display the resolution result in one line (omitting child details)static AssemblyResolvedConstructornop(java.lang.String description, java.util.List<? extends AssemblyResolution> sel)Obtain a new "blank" resolved SLEIGH constructor recordstatic AssemblyResolvedConstructorresolved(AssemblyPatternBlock ins, AssemblyPatternBlock ctx, java.lang.String description, java.util.List<? extends AssemblyResolution> sel)Build the result of successfully resolving a SLEIGH constructor NOTE: This is not used strictly for resolved SLEIGH constructors.java.lang.StringtoString()Describe this record including indented children, grandchildren, etc., each on its own linejava.lang.StringtoString(java.lang.String indent)Used only by parents: get a multi-line description of this record, indented
-
-
-
Field Detail
-
description
protected final java.lang.String description
-
children
protected final java.util.List<? extends AssemblyResolution> children
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
computeHash
protected abstract int computeHash()
-
resolved
public static AssemblyResolvedConstructor resolved(AssemblyPatternBlock ins, AssemblyPatternBlock ctx, java.lang.String description, java.util.List<? extends AssemblyResolution> sel)
Build the result of successfully resolving a SLEIGH constructor NOTE: 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 resolutionsel- the children selected to resolve this constructor, or null- Returns:
- the new resolution
-
instrOnly
public static AssemblyResolvedConstructor instrOnly(AssemblyPatternBlock ins, java.lang.String description, java.util.List<AssemblyResolution> children)
Build an instruction-only successful resolution result- Parameters:
ins- the instruction pattern blockdescription- a description of the resolutionchildren- the children selected to resolve this constructor, or null- Returns:
- the new resolution
- See Also:
resolved(AssemblyPatternBlock, AssemblyPatternBlock, String, List)
-
contextOnly
public static AssemblyResolvedConstructor contextOnly(AssemblyPatternBlock ctx, java.lang.String description, java.util.List<AssemblyResolution> children)
Build a context-only successful resolution result- Parameters:
ctx- the context pattern blockdescription- a description of the resolutionchildren- the children selected to resolve this constructor, or null- Returns:
- the new resolution
- See Also:
resolved(AssemblyPatternBlock, AssemblyPatternBlock, String, List)
-
fromPattern
public static AssemblyResolvedConstructor fromPattern(DisjointPattern pat, int minLen, java.lang.String description)
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
-
backfill
public static AssemblyResolvedBackfill backfill(PatternExpression exp, MaskedLong goal, java.util.Map<java.lang.Integer,java.lang.Object> res, int inslen, java.lang.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 expressionres- the resolution result for child constructorsinslen- the length of instruction portion expected in the future solutiondescription- a description of the backfill record- Returns:
- the new record
-
nop
public static AssemblyResolvedConstructor nop(java.lang.String description, java.util.List<? extends AssemblyResolution> sel)
Obtain a new "blank" resolved SLEIGH constructor record- Parameters:
description- a description of the resolutionsel- any children that will be involved in populating this record- Returns:
- the new resolution
-
error
public static AssemblyResolvedError error(java.lang.String error, java.lang.String description, java.util.List<? extends AssemblyResolution> children)
Build an error resolution record- Parameters:
error- a description of the errordescription- a description of what the resolver was doing when the error ocurredchildren- any children involved in generating the error- Returns:
- the new resolution
-
error
public static AssemblyResolution error(java.lang.String error, AssemblyResolvedConstructor res)
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 ocurred- Returns:
- the new error resolution
-
isError
public abstract boolean isError()
Check if this record describes an error- Returns:
- true if the record is an error
-
isBackfill
public abstract boolean isBackfill()
Check if this record describes a backfill- Returns:
- true if the record is a backfill
-
lineToString
protected abstract java.lang.String lineToString()
Display the resolution result in one line (omitting child details)- Returns:
- the display description
-
childrenToString
protected java.lang.String childrenToString(java.lang.String indent)
Get the child portion oftoString()If a subclass has another, possible additional, notion of children that it would like to include intoString(), it must override this method.- Parameters:
indent- the current indentation- Returns:
- the indented description for each child on its own line
- See Also:
hasChildren()
-
toString
public java.lang.String toString(java.lang.String indent)
Used only by parents: get a multi-line description of this record, indented- Parameters:
indent- the current indentation- Returns:
- the indented description
-
toString
public java.lang.String toString()
Describe this record including indented children, grandchildren, etc., each on its own line- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(AssemblyResolution that)
- Specified by:
compareToin interfacejava.lang.Comparable<AssemblyResolution>
-
hasChildren
public boolean hasChildren()
Check if this record has children If a subclass has another, possibly additional, notion of children that it would like to include intoString(), it must override this method to return true when such children are present.- Returns:
- true if this record has children
- See Also:
childrenToString(String)
-
-