Class AssemblyNumericSymbols

java.lang.Object
ghidra.app.plugin.assembler.sleigh.symbol.AssemblyNumericSymbols

public final class AssemblyNumericSymbols extends Object
A context to hold various symbols offered to the assembler, usable where numbers are expected.
  • Field Details

  • Method Details

    • fromLanguage

      public static AssemblyNumericSymbols fromLanguage(Language language)
      Get symbols from a language, when no program is available
      Parameters:
      language - the language
      Returns:
      the symbols
    • fromProgram

      public static AssemblyNumericSymbols fromProgram(Program program)
      Get symbols from a program (and its language)
      Parameters:
      program - the program
      Returns:
      the symbols
    • chooseAll

      public Set<Long> chooseAll(String name)
      Choose any symbol with the given name

      This will order equates first, then program labels, then language labels. For addresses, the value is its addressable word offset.

      Parameters:
      name - the name
      Returns:
      the value, or null
    • chooseBySpace

      public Set<Long> chooseBySpace(String name, AddressSpace space)
      Choose a label with the given name in the given space
      Parameters:
      name - the name
      space - the address space
      Returns:
      the addressable word offset of the found label, or null
    • choose

      public Set<Long> choose(String name, AddressSpace space)
      Choose a symbol with the given name, using the space as a hint

      If a space is not given, or if that space is the constant space, then this will choose from all symbols, via chooseAll(String). If a space is given, and it is not the constant space, then this will choose from symbols in the given space, via chooseBySpace(String, AddressSpace).

      Parameters:
      name - the name
      space - the address space, or null
      Returns:
      the equate value, or label addressable word offset, or null
    • suggestAny

      public Collection<String> suggestAny(String got, int max)
      Suggest up to max symbols having the given prefix
      Parameters:
      got - the prefix
      max - the maximum number of symbols to suggest
      Returns:
      the collection of symbol names
    • suggestBySpace

      public Collection<String> suggestBySpace(String got, AddressSpace space, int max)
      Suggest up to max symbols from the given space having the given prefix
      Parameters:
      got - the prefix
      space - the address space
      max - the maximum number of symbols to suggest
      Returns:
      the collection of symbol names
    • getSuggestions

      public Collection<String> getSuggestions(String got, AddressSpace space, int max)
      Suggest up to max symbols having the given prefix, using space as a hint

      As in chooseAll(String), if space is null or the constant space, then this will suggest from all symbols, via suggestAny(String, int). If space is given, and it is not the constant space, then this will suggest from symbols in the given space, via suggestBySpace(String, AddressSpace, int).

      Parameters:
      got - the prefix
      space - the space, or null
      max - the maximum number of symbols to suggest
      Returns:
      the collection of symbol names