Package ghidra.app.plugin.assembler.sleigh.sem

# 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

  Nested Classes
  Modifier and Type
  Class
  Description
  `static 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`
  `AbstractAssemblyResolutionFactory.AssemblyResolvedErrorBuilder`
  `class`
  `AbstractAssemblyResolutionFactory.DefaultAssemblyResolvedBackfillBuilder`
  `class`
  `AbstractAssemblyResolutionFactory.DefaultAssemblyResolvedPatternBuilder`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final String`
  `CTX`
  `protected static final String`
  `INS`
  `protected static final String`
  `SEP`
  `protected static final RecursiveDescentSolver`
  `SOLVER`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractAssemblyResolutionFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AssemblyResolution`
  `backfill(PatternExpression exp, MaskedLong goal, int inslen, String description)`
  Build a backfill record to attach to a successful resolution result
  `AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedBackfillBuilder<BF>`
  `backfillBuilder(PatternExpression exp, MaskedLong goal, int inslen, String description)`
  `RP`
  `contextOnly(AssemblyPatternBlock ctx, String description)`
  Build a context-only successful resolution result
  `protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP>`
  `contextOnlyBuilder(AssemblyPatternBlock ctx, String description)`
  `AssemblyResolution`
  `error(String error, AssemblyResolution res)`
  Build an error resolution record, based on an intermediate SLEIGH constructor record
  `AbstractAssemblyResolutionFactory<RP,BF>.AssemblyResolvedErrorBuilder`
  `errorBuilder(String error, AssemblyResolution res)`
  `RP`
  `fromPattern(DisjointPattern pat, int minLen, String description, Constructor cons)`
  Build a successful resolution result from a SLEIGH constructor's patterns
  `protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP>`
  `fromPatternBuilder(DisjointPattern pat, int minLen, String description, Constructor cons)`
  `AssemblyResolvedPatterns`
  `fromString(String str, String description, List<AssemblyResolution> children)`
  Build a new successful SLEIGH constructor resolution from a string representation
  `protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP>`
  `fromStringBuilder(String str, String description, List<AssemblyResolution> children)`
  `RP`
  `instrOnly(AssemblyPatternBlock ins, String description)`
  Build an instruction-only successful resolution result
  `protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP>`
  `instrOnlyBuilder(AssemblyPatternBlock ins, String description)`
  `AssemblyResolutionResults`
  `newAssemblyResolutionResults()`
  `abstract AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedBackfillBuilder<BF>`
  `newBackfillBuilder()`
  `AbstractAssemblyResolutionFactory<RP,BF>.AssemblyResolvedErrorBuilder`
  `newErrorBuilder()`
  `abstract AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP>`
  `newPatternsBuilder()`
  `RP`
  `nop(String description)`
  Obtain a new "blank" resolved SLEIGH constructor record
  `RP`
  `nop(String description, List<AssemblyResolution> children, AssemblyResolution right)`
  Obtain a new "blank" resolved SLEIGH constructor record
  `protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP>`
  `nopBuilder(String description)`
  `protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP>`
  `nopBuilder(String description, List<AssemblyResolution> children, AssemblyResolution right)`
  `RP`
  `resolved(AssemblyPatternBlock ins, AssemblyPatternBlock ctx, String description, Constructor cons, List<AssemblyResolution> children, AssemblyResolution right)`
  Build the result of successfully resolving a SLEIGH constructor
  `protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP>`
  `resolvedBuilder(AssemblyPatternBlock ins, AssemblyPatternBlock ctx, String description, Constructor cons, List<AssemblyResolution> children, AssemblyResolution right)`
  `protected AssemblyResolutionResults`
  `results(Set<AssemblyResolution> col)`
  `protected AssemblyResolutionResults`
  `singleton(AssemblyResolution one)`
  Construct an immutable single-entry result set consisting of the one given resolution
  `protected AssemblyResolution`
  `solveOrBackfill(PatternExpression exp, long goal, int bits, Map<String,Long> vals, AssemblyResolvedPatterns cur, String description)`
  Attempt to solve an expression
  `protected AssemblyResolution`
  `solveOrBackfill(PatternExpression exp, long goal, Map<String,Long> vals, AssemblyResolvedPatterns cur, String description)`
  Attempt to solve an expression
  `protected AssemblyResolution`
  `solveOrBackfill(PatternExpression exp, MaskedLong goal, Map<String,Long> vals, AssemblyResolvedPatterns cur, String description)`
  Attempt to solve an expression

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SOLVER

    protected static final RecursiveDescentSolver SOLVER

  - ### INS

    protected static final String INS
    See Also:
      - Constant Field Values

  - ### CTX

    protected static final String CTX
    See Also:
      - Constant Field Values

  - ### SEP

    protected static final String SEP
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### AbstractAssemblyResolutionFactory

    public AbstractAssemblyResolutionFactory()

- ## Method Details

  - ### newPatternsBuilder

    public abstract AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> newPatternsBuilder()

  - ### newBackfillBuilder

    public abstract AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedBackfillBuilder<BF> newBackfillBuilder()

  - ### newErrorBuilder

    public AbstractAssemblyResolutionFactory<RP,BF>.AssemblyResolvedErrorBuilder newErrorBuilder()

  - ### singleton

    protected AssemblyResolutionResults singleton(AssemblyResolution one)
    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

    public AssemblyResolutionResults newAssemblyResolutionResults()

  - ### results

    protected AssemblyResolutionResults results(Set<AssemblyResolution> col)

  - ### 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 solve
      `goal` - the desired value of the expression
      `cur` - the resolved constructor so far
      `description` - 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 expression

    Converts the given goal and bits count to a `MaskedLong` and then solves as before. As a special case, if `bits == 0`, the goal is considered fully-defined (as if `bits == 64`).

    See Also:
      - `solveOrBackfill(PatternExpression, MaskedLong, Map, AssemblyResolvedPatterns, String)`

  - ### solveOrBackfill

    protected AssemblyResolution solveOrBackfill(PatternExpression exp, long goal, Map<String,Long> vals, AssemblyResolvedPatterns cur, String description)
    Attempt to solve an expression

    Converts the given goal to a fully-defined `MaskedLong` and then solves.

    See Also:
      - `solveOrBackfill(PatternExpression, MaskedLong, Map, AssemblyResolvedPatterns, String)`

  - ### errorBuilder

    public AbstractAssemblyResolutionFactory<RP,BF>.AssemblyResolvedErrorBuilder errorBuilder(String error, AssemblyResolution res)

  - ### error

    public AssemblyResolution error(String error, AssemblyResolution res)
    Build an error resolution record, based on an intermediate SLEIGH constructor record
    Parameters:
      `error` - a description of the error
      `res` - 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

    public RP nop(String description)
    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

    public RP nop(String description, List<AssemblyResolution> children, AssemblyResolution right)
    Obtain a new "blank" resolved SLEIGH constructor record
    Parameters:
      `description` - a description of the resolution
      `children` - 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 symbol
      `goal` - the desired value of the expression
      `inslen` - the length of instruction portion expected in the future solution
      `description` - 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 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 block
      `ctx` - the context pattern block
      `description` - a description of the resolution
      `cons` - the constructor, or null
      `children` - the children of this constructor, or null
    Returns:
      the new resolution

  - ### instrOnlyBuilder

    protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> instrOnlyBuilder(AssemblyPatternBlock ins, String description)

  - ### instrOnly

    public RP instrOnly(AssemblyPatternBlock ins, String description)
    Build an instruction-only successful resolution result
    Parameters:
      `ins` - the instruction pattern block
      `description` - a description of the resolution
    Returns:
      the new resolution
    See Also:
      - `resolved(AssemblyPatternBlock, AssemblyPatternBlock, String, Constructor, List, AssemblyResolution)`

  - ### contextOnlyBuilder

    protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> contextOnlyBuilder(AssemblyPatternBlock ctx, String description)

  - ### contextOnly

    public RP contextOnly(AssemblyPatternBlock ctx, String description)
    Build a context-only successful resolution result
    Parameters:
      `ctx` - the context pattern block
      `description` - a description of the resolution
    Returns:
      the new resolution
    See Also:
      - `resolved(AssemblyPatternBlock, AssemblyPatternBlock, String, Constructor, List, AssemblyResolution)`

  - ### fromPatternBuilder

    protected AbstractAssemblyResolutionFactory.AbstractAssemblyResolvedPatternsBuilder<RP> fromPatternBuilder(DisjointPattern pat, int minLen, String description, Constructor cons)

  - ### fromPattern

    public RP fromPattern(DisjointPattern pat, int minLen, String description, Constructor cons)
    Build a successful resolution result from a SLEIGH constructor's patterns
    Parameters:
      `pat` - the constructor's pattern
      `description` - 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 representation

    This was used primarily in testing, to specify expected results.

    Parameters:
      `str` - the string representation: "`ins:[pattern],ctx:[pattern]`"
      `description` - a description of the resolution
      `children` - any children involved in the resolution
    Returns:
      the decoded resolution
    See Also:
      - `NumericUtilities.convertHexStringToMaskedValue(AtomicLong, AtomicLong, String, int, int, String)`