Class SymbolManager

java.lang.Object
ghidra.program.database.symbol.SymbolManager
All Implemented Interfaces:
ManagerDB, SymbolTable

public class SymbolManager extends Object implements SymbolTable, ManagerDB
  • Constructor Details

  • Method Details

    • findVariableStorageAddress

      public Address findVariableStorageAddress(VariableStorage storage) throws IOException
      Find previously defined variable storage address
      Parameters:
      storage - variable storage
      Returns:
      previously defined variable storage address or null if not found
      Throws:
      IOException - if there is database exception
    • setProgram

      public void setProgram(ProgramDB program)
      Description copied from interface: ManagerDB
      Callback from program used to indicate all manager have been created. When this method is invoked, all managers have been instantiated but may not be fully initialized.
      Specified by:
      setProgram in interface ManagerDB
      Parameters:
      program - the program is set when all the initializations have been completed.
    • programReady

      public void programReady(int openMode, int currentRevision, TaskMonitor monitor) throws IOException, CancelledException
      Description copied from interface: ManagerDB
      Callback from program made to each manager after the program has completed initialization. This method may be used by managers to perform additional upgrading which may have been deferred.
      Specified by:
      programReady in interface ManagerDB
      Parameters:
      openMode - the mode that the program is being opened.
      currentRevision - current program revision. If openMode is UPGRADE, this value reflects the pre-upgrade value.
      monitor - the task monitor to use in any upgrade operations.
      Throws:
      IOException - if a database io error occurs.
      CancelledException - if the user cancelled the operation via the task monitor.
    • migrateFromOldVariableStorageManager

      public void migrateFromOldVariableStorageManager(TaskMonitor monitor) throws CancelledException
      No more sharing the same variable address for multiple variable symbols. Must split these up. Only reference to variable addresses should be the symbol address - reference refer to physical/stack addresses, and symbolIDs.
      Parameters:
      monitor - the task monitor
      Throws:
      CancelledException - if the operation is cancelled
    • getNumSymbols

      public int getNumSymbols()
      Description copied from interface: SymbolTable
      Returns the total number of symbols in the table.
      Specified by:
      getNumSymbols in interface SymbolTable
      Returns:
      total number of symbols
    • removeSymbolSpecial

      public boolean removeSymbolSpecial(Symbol sym)
      Description copied from interface: SymbolTable
      Removes the specified symbol from the symbol table. If removing any non-function symbol the behavior will be the same as invoking Symbol.delete() on the symbol. Use of this method for non-function symbols is discouraged.

      WARNING! If removing a function symbol the behavior differs from directly invoking Symbol.delete() on the function symbol.

      When removing a function symbol this method has the following behavior:

      • If the function is a default symbol (e.g., FUN_12345678) this method has no affect and will return null
      • otherwise if another label exists at the function entry point, that label will be removed and the function will be renamed with that labels name
      • If no other labels exist at the function entry, the function will be renamed to the default function name
      Any reference bound to a symbol removed will loose that symbol specific binding.
      Specified by:
      removeSymbolSpecial in interface SymbolTable
      Parameters:
      sym - the symbol to be removed.
      Returns:
      false, if removal of the symbol fails
    • hasSymbol

      public boolean hasSymbol(Address addr)
      Description copied from interface: SymbolTable
      Return true if there exists a symbol at the given address.
      Specified by:
      hasSymbol in interface SymbolTable
      Parameters:
      addr - address to check for an existing symbol
      Returns:
      true if any symbol exists
    • getSymbol

      public Symbol getSymbol(long symbolID)
      Description copied from interface: SymbolTable
      Get the symbol for the given symbol ID.
      Specified by:
      getSymbol in interface SymbolTable
      Parameters:
      symbolID - the id of the symbol to be retrieved.
      Returns:
      null if there is no symbol with the given ID.
    • getSymbolsAsIterator

      public SymbolIterator getSymbolsAsIterator(Address addr)
      Description copied from interface: SymbolTable
      Returns a symbol iterator over all the symbols at the given address. Use this instead of SymbolTable.getSymbols(Address) when you do not need to get all symbols, but rather are searching for a particular symbol. This method prevents all symbols at the given address from being loaded up front.
      Specified by:
      getSymbolsAsIterator in interface SymbolTable
      Parameters:
      addr - the address at which to retrieve all symbols
      Returns:
      an iterator over all the symbols at the given address
      See Also:
    • getSymbols

      public Symbol[] getSymbols(Address addr)
      Description copied from interface: SymbolTable
      Returns all the symbols at the given address. When addr is a memory address the primary symbol will be returned in array slot 0. WARNING! Use of this method with a Variable address is highly discouraged since a single Variable address could be used multiple times by many functions. Note that unless all the symbols are needed at once, you should consider using the SymbolTable.getSymbolsAsIterator(Address) method instead.
      Specified by:
      getSymbols in interface SymbolTable
      Parameters:
      addr - the address at which to retrieve all symbols.
      Returns:
      a zero-length array when no symbols are defined at address.
      See Also:
    • getUserSymbols

      public Symbol[] getUserSymbols(Address addr)
      Description copied from interface: SymbolTable
      Returns an array of all user defined symbols at the given address
      Specified by:
      getUserSymbols in interface SymbolTable
      Parameters:
      addr - the address at which to retrieve all user defined symbols.
      Returns:
      all symbols at specified address
    • getSymbol

      public Symbol getSymbol(String name, Address address, Namespace namespace)
      Description copied from interface: SymbolTable
      Get the symbol with the given name, address, and namespace.

      Note that for a symbol to be uniquely specified, all these parameters are required. Any method that queries for symbols using just one or two of these parameters will return a list of symbols. This method will not return a default thunk (i.e., thunk function symbol with default source type) since it mirrors the name and parent namespace of the function it thunks.

      Specified by:
      getSymbol in interface SymbolTable
      Parameters:
      name - the name of the symbol to retrieve
      address - the address of the symbol to retrieve
      namespace - the namespace of the symbol to retrieve. May be null which indicates global namespace.
      Returns:
      the symbol which matches the specified criteria or null if not found
      See Also:
    • getGlobalSymbol

      public Symbol getGlobalSymbol(String name, Address addr)
      Description copied from interface: SymbolTable
      Get the global symbol with the given name and address. Note that this results in a single Symbol because of an additional restriction that allows only one symbol with a given name at the same address and namespace (in this case the global namespace).

      This is just a convenience method for SymbolTable.getSymbol(String, Address, Namespace) where the namespace is the global namespace.

      NOTE: This method will not return a default thunk (i.e., thunk function symbol with default source type) since it mirrors the name and parent namespace of the function it thunks.

      Specified by:
      getGlobalSymbol in interface SymbolTable
      Parameters:
      name - the name of the symbol to retrieve
      addr - the address of the symbol to retrieve
      Returns:
      the symbol which matches the specified criteria in the global namespace or null if not found
      See Also:
    • getGlobalSymbols

      public List<Symbol> getGlobalSymbols(String name)
      Description copied from interface: SymbolTable
      Returns a list of all global symbols with the given name.

      NOTE: This method will not return default thunks (i.e., thunk function symbol with default source type).

      Specified by:
      getGlobalSymbols in interface SymbolTable
      Parameters:
      name - the name of the symbols to retrieve.
      Returns:
      a list of all global symbols with the given name.
    • getLibrarySymbol

      public Symbol getLibrarySymbol(String name)
      Description copied from interface: SymbolTable
      Returns the library symbol with the given name.
      Specified by:
      getLibrarySymbol in interface SymbolTable
      Parameters:
      name - the name of the library symbol to retrieve.
      Returns:
      the library symbol with the given name.
    • getSymbols

      public List<Symbol> getSymbols(String name, Namespace namespace)
      Description copied from interface: SymbolTable
      Returns a list of all symbols with the given name in the given namespace.

      NOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol with default source type).

      Specified by:
      getSymbols in interface SymbolTable
      Parameters:
      name - the name of the symbols to retrieve.
      namespace - the namespace to search for symbols.
      Returns:
      all symbols which satisfy specified criteria
    • getNamespace

      public Namespace getNamespace(String name, Namespace namespace)
      Description copied from interface: SymbolTable
      Returns the namespace with the given name in the given parent namespace. The namespace returned can be either a generic namespace or a class or library. It does not include functions.
      Specified by:
      getNamespace in interface SymbolTable
      Parameters:
      name - the name of the namespace to be retrieved.
      namespace - the parent namespace of the namespace to be retrieved.
      Returns:
      the namespace with the given name in the given parent namespace.
    • getSymbols

      public SymbolIterator getSymbols(Namespace namespace)
      Description copied from interface: SymbolTable
      Returns an iterator over all the symbols in the given namespace

      NOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol with default source type).

      Specified by:
      getSymbols in interface SymbolTable
      Parameters:
      namespace - the namespace to search for symbols.
      Returns:
      symbol iterator
    • getSymbols

      public SymbolIterator getSymbols(long namespaceID)
      Description copied from interface: SymbolTable
      Returns an iterator over all the symbols in the given namespace

      NOTE: This method will not return a default thunk (i.e., thunk function symbol with default source type).

      Specified by:
      getSymbols in interface SymbolTable
      Parameters:
      namespaceID - the namespace ID to search for symbols.
      Returns:
      symbol iterator
    • getSymbols

      public SymbolIterator getSymbols(String name)
      Description copied from interface: SymbolTable
      Returns all the symbols with the given name.

      NOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol with default source type). It will also not work for default local variables and parameters.

      Specified by:
      getSymbols in interface SymbolTable
      Parameters:
      name - the name of symbols to search for.
      Returns:
      array of symbols with the given name
    • getPrimarySymbol

      public Symbol getPrimarySymbol(Address addr)
      Description copied from interface: SymbolTable
      Returns the primary symbol at the specified address. This method will always return null if the address specified is neither a Memory address nor an External address.
      Specified by:
      getPrimarySymbol in interface SymbolTable
      Parameters:
      addr - the address at which to retrieve the primary symbol
      Returns:
      symbol, or null if no symbol at that address
    • getSymbol

      public Symbol getSymbol(Reference ref)
      Description copied from interface: SymbolTable
      Returns the symbol that this reference is associated with.
      Specified by:
      getSymbol in interface SymbolTable
      Parameters:
      ref - the reference to find the associated symbol for.
      Returns:
      referenced symbol
    • getMaxSymbolAddress

      public Address getMaxSymbolAddress(AddressSpace space)
      Returns the maximum symbol address within the specified address space.
      Parameters:
      space - address space
      Returns:
      maximum symbol address within space or null if none are found.
    • getNextExternalSymbolAddress

      public Address getNextExternalSymbolAddress()
      Returns the next available external symbol address
      Returns:
      the address
    • getPrimarySymbolIterator

      public SymbolIterator getPrimarySymbolIterator(Address startAddr, boolean forward)
      Description copied from interface: SymbolTable
      Get iterator over only primary symbols starting at the specified startAddr
      Specified by:
      getPrimarySymbolIterator in interface SymbolTable
      Parameters:
      startAddr - the address at which to begin the iteration.
      forward - true means the iterator is in the forward direction
      Returns:
      symbol iterator
    • getPrimarySymbolIterator

      public SymbolIterator getPrimarySymbolIterator(AddressSetView set, boolean forward)
      Description copied from interface: SymbolTable
      Get an iterator over symbols at addresses in the given addressSet
      Specified by:
      getPrimarySymbolIterator in interface SymbolTable
      Parameters:
      set - the set of address over which to iterate symbols (required).
      forward - true means the iterator is in the forward direction
      Returns:
      symbol iterator
    • getSymbols

      public SymbolIterator getSymbols(AddressSetView set, SymbolType type, boolean forward)
      Description copied from interface: SymbolTable
      Returns all the symbols of the given type within the given address set.
      Specified by:
      getSymbols in interface SymbolTable
      Parameters:
      set - the address set in which to look for symbols of the given type (required).
      type - the SymbolType to look for.
      forward - the direction within the addressSet to search
      Returns:
      symbol iterator
    • getPrimarySymbolIterator

      public SymbolIterator getPrimarySymbolIterator(boolean forward)
      Description copied from interface: SymbolTable
      Get iterator over all primary symbols.
      Specified by:
      getPrimarySymbolIterator in interface SymbolTable
      Parameters:
      forward - true means the iterator is in the forward direction
      Returns:
      symbol iterator
    • getSymbolIterator

      public SymbolIterator getSymbolIterator(Address startAddr, boolean forward)
      Description copied from interface: SymbolTable
      Get iterator over all symbols starting at the specified startAddr
      Specified by:
      getSymbolIterator in interface SymbolTable
      Parameters:
      startAddr - the address at which to begin the iteration.
      forward - true means the iterator is in the forward direction
      Returns:
      symbol iterator
    • getSymbolIterator

      public SymbolIterator getSymbolIterator()
      Description copied from interface: SymbolTable
      Get iterator over all label symbols. Labels are defined on memory locations.
      Specified by:
      getSymbolIterator in interface SymbolTable
      Returns:
      symbol iterator
    • getAllSymbols

      public SymbolIterator getAllSymbols(boolean includeDynamicSymbols)
      Description copied from interface: SymbolTable
      Returns an iterator over all symbols, including Dynamic symbols if includeDynamicSymbols is true.
      Specified by:
      getAllSymbols in interface SymbolTable
      Parameters:
      includeDynamicSymbols - if true, the iterator will include dynamicSymbols
      Returns:
      symbol iterator
    • getSymbolIterator

      public SymbolIterator getSymbolIterator(boolean forward)
      Description copied from interface: SymbolTable
      Returns an iterator over all symbols.
      Specified by:
      getSymbolIterator in interface SymbolTable
      Parameters:
      forward - true means the iterator is in the forward direction
      Returns:
      symbol iterator
    • getSymbolIterator

      public SymbolIterator getSymbolIterator(String searchStr, boolean caseSensitive)
      Description copied from interface: SymbolTable
      Returns a an iterator over all symbols that match the given search string.

      NOTE: The iterator is in the forward direction only and will not return default thunk functions. The resulting iterator will not return default thunks (i.e., thunk function symbol with default source type).

      Specified by:
      getSymbolIterator in interface SymbolTable
      Parameters:
      searchStr - the string to search for (may contain * to match any sequence or ? to match a single char)
      caseSensitive - flag to determine if the search is case sensitive or not.
      Returns:
      symbol iterator
    • addExternalEntryPoint

      public void addExternalEntryPoint(Address addr)
      Description copied from interface: SymbolTable
      Sets the given address to be an external entry point.
      Specified by:
      addExternalEntryPoint in interface SymbolTable
      Parameters:
      addr - the address to set as an external entry point.
    • getExternalEntryPointIterator

      public AddressIterator getExternalEntryPointIterator()
      Description copied from interface: SymbolTable
      Get forward/back iterator over addresses that are entry points.
      Specified by:
      getExternalEntryPointIterator in interface SymbolTable
      Returns:
      entry-point address iterator
    • isExternalEntryPoint

      public boolean isExternalEntryPoint(Address addr)
      Description copied from interface: SymbolTable
      Returns true if the given address has been set as an external entry point.
      Specified by:
      isExternalEntryPoint in interface SymbolTable
      Parameters:
      addr - address to test for external entry point.
      Returns:
      true if specified address has been marked as an entry point, else false
    • removeExternalEntryPoint

      public void removeExternalEntryPoint(Address addr)
      Description copied from interface: SymbolTable
      Removes the given address as an external entry point.
      Specified by:
      removeExternalEntryPoint in interface SymbolTable
      Parameters:
      addr - the address to remove as an external entry point.
    • hasLabelHistory

      public boolean hasLabelHistory(Address addr)
      Description copied from interface: SymbolTable
      Return true if there is a history of label changes at the given address.
      Specified by:
      hasLabelHistory in interface SymbolTable
      Parameters:
      addr - the address to check for symbol history.
      Returns:
      true if label history exists for specified address, else false
    • getLabelHistory

      public Iterator<LabelHistory> getLabelHistory()
      Description copied from interface: SymbolTable
      Get an iterator over all the label history objects.
      Specified by:
      getLabelHistory in interface SymbolTable
      Returns:
      label history iterator
    • getLabelHistory

      public LabelHistory[] getLabelHistory(Address addr)
      Description copied from interface: SymbolTable
      Get the label history objects for the given address. The history object records changes made to labels at some address.
      Specified by:
      getLabelHistory in interface SymbolTable
      Parameters:
      addr - address of the label change
      Returns:
      array of history objects
    • invalidateCache

      public void invalidateCache(boolean all)
      Description copied from interface: ManagerDB
      Clears all data caches.
      Specified by:
      invalidateCache in interface ManagerDB
      Parameters:
      all - if false, some managers may not need to update their cache if they can tell that its not necessary. If this flag is true, then all managers should clear their cache no matter what.
    • moveSymbolsAt

      public void moveSymbolsAt(Address oldAddr, Address newAddr)
      Move symbol. Only symbol address is changed. References must be moved separately.
      Parameters:
      oldAddr - the old symbol address
      newAddr - the new symbol address
    • getDynamicSymbolID

      public long getDynamicSymbolID(Address addr)
      Description copied from interface: SymbolTable
      Get the unique symbol ID for a dynamic symbol associated with the specified addr. The generation of this symbol ID does not reflect the presence of a dynamic symbol at the specified addr. This symbol ID should not be permanently stored since the encoding may change between software releases.
      Specified by:
      getDynamicSymbolID in interface SymbolTable
      Parameters:
      addr - dynamic symbol address
      Returns:
      unique symbol ID
    • namespaceRemoved

      public void namespaceRemoved(long namespaceID)
      Called by the NamespaceManager when a namespace is removed; remove all symbols that have the given namespace ID.
      Parameters:
      namespaceID - ID of namespace being removed
    • getNamespace

      public Namespace getNamespace(Address addr)
      Description copied from interface: SymbolTable
      Returns the lowest level Namespace within which the specified address is contained.
      Specified by:
      getNamespace in interface SymbolTable
      Parameters:
      addr - the address for which to finds its enclosing namespace.
      Returns:
      namespace which contains specified address
    • getClassNamespaces

      public Iterator<GhidraClass> getClassNamespaces()
      Description copied from interface: SymbolTable
      Returns all Class Namespaces defined within the program in an arbitrary ordering.
      Specified by:
      getClassNamespaces in interface SymbolTable
      Returns:
      iterator of GhidraClass
    • getDefinedSymbols

      public SymbolIterator getDefinedSymbols()
      Description copied from interface: SymbolTable
      Returns an iterator over all defined symbols in no particular order.
      Specified by:
      getDefinedSymbols in interface SymbolTable
      Returns:
      symbol iterator
    • getExternalSymbol

      public Symbol getExternalSymbol(String name)
      Description copied from interface: SymbolTable
      Returns the external symbol with the given name.
      Specified by:
      getExternalSymbol in interface SymbolTable
      Parameters:
      name - the name of the symbol to be retrieved.
      Returns:
      symbol, or null if no external symbol has that name
    • getExternalSymbols

      public SymbolIterator getExternalSymbols(String name)
      Description copied from interface: SymbolTable
      Returns all the external symbols with the given name.
      Specified by:
      getExternalSymbols in interface SymbolTable
      Parameters:
      name - the name of symbols to search for.
      Returns:
      array of external symbols with the given name
    • getExternalSymbols

      public SymbolIterator getExternalSymbols()
      Description copied from interface: SymbolTable
      Returns an iterator over all defined external symbols in no particular order.
      Specified by:
      getExternalSymbols in interface SymbolTable
      Returns:
      symbol iterator
    • getChildren

      public SymbolIterator getChildren(Symbol parentSymbol)
      Description copied from interface: SymbolTable
      Returns an iterator over all symbols that have the given symbol as its parent.

      NOTE: The resulting iterator will not return default thunks (i.e., thunk function symbol with default source type).

      Specified by:
      getChildren in interface SymbolTable
      Parameters:
      parentSymbol - the parent symbol
      Returns:
      symbol iterator
    • setLanguage

      public void setLanguage(LanguageTranslator translator, TaskMonitor monitor) throws CancelledException
      Throws:
      CancelledException
    • replaceDataTypes

      public void replaceDataTypes(long oldDataTypeID, long newDataTypeID)
    • moveAddressRange

      public void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) throws CancelledException
      Description copied from interface: ManagerDB
      Move all objects within an address range to a new location.
      Specified by:
      moveAddressRange in interface ManagerDB
      Parameters:
      fromAddr - the first address of the range to be moved.
      toAddr - the address where to the range is to be moved.
      length - the number of addresses to move.
      monitor - the task monitor to use in any upgrade operations.
      Throws:
      CancelledException - if the user cancelled the operation via the task monitor.
    • deleteAddressRange

      public void deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor) throws CancelledException
      Description copied from interface: ManagerDB
      Delete all objects which have been applied to the address range startAddr to endAddr and update the database accordingly.
      Specified by:
      deleteAddressRange in interface ManagerDB
      Parameters:
      startAddr - the first address in the range.
      endAddr - the last address in the range.
      monitor - the task monitor to use in any upgrade operations.
      Throws:
      CancelledException - if the user cancelled the operation via the task monitor.
    • imageBaseChanged

      public void imageBaseChanged(Address oldBase, Address newBase)
    • createVariableSymbol

      public VariableSymbolDB createVariableSymbol(String name, FunctionDB function, SymbolType type, int firstUseOffsetOrOrdinal, VariableStorage storage, SourceType source) throws DuplicateNameException, InvalidInputException
      Creates variable symbols. Note this is not a method defined in the Symbol Table interface. It is intended to be used by Ghidra program internals.
      Parameters:
      name - the name of the variable
      function - the function that contains the variable.
      type - the type of the variable (can only be PARAMETER or LOCAL_VAR)
      firstUseOffsetOrOrdinal - the offset in the function where the variable is first used.
      storage - the VariableStorage (stack, registers, etc.)
      source - the symbol source type (user defined, analysis, etc.)
      Returns:
      the new VariableSymbol that was created.
      Throws:
      DuplicateNameException - if there is another variable in this function with that name.
      InvalidInputException - if the name contains illegal characters (space for example)
    • createClass

      public GhidraClass createClass(Namespace parent, String name, SourceType source) throws DuplicateNameException, InvalidInputException
      Description copied from interface: SymbolTable
      Create a class namespace in the given parent namespace.
      Specified by:
      createClass in interface SymbolTable
      Parameters:
      parent - parent namespace (may be null for global namespace)
      name - name of the namespace
      source - the source of this class namespace's symbol
      Returns:
      new class namespace
      Throws:
      DuplicateNameException - thrown if another non function or label symbol exists with the given name
      InvalidInputException - throw if the name has invalid characters or is null
    • createExternalLibrary

      public Library createExternalLibrary(String name, SourceType source) throws DuplicateNameException, InvalidInputException
      Description copied from interface: SymbolTable
      Creates a Library namespace with the given name.
      Specified by:
      createExternalLibrary in interface SymbolTable
      Parameters:
      name - the name of the new Library namespace
      source - the source of this external library's symbol
      Returns:
      the new Library namespace.
      Throws:
      DuplicateNameException - thrown if another non function or label symbol exists with the given name
      InvalidInputException - if the name is invalid.
    • createNameSpace

      public Namespace createNameSpace(Namespace parent, String name, SourceType source) throws DuplicateNameException, InvalidInputException
      Description copied from interface: SymbolTable
      Creates a new namespace.
      Specified by:
      createNameSpace in interface SymbolTable
      Parameters:
      parent - the parent namespace for the new namespace (may be null for global namespace)
      name - the name of the new namespace
      source - the source of this namespace's symbol
      Returns:
      the new Namespace object.
      Throws:
      DuplicateNameException - thrown if another non function or label symbol exists with the given name
      InvalidInputException - if the name is invalid.
    • convertNamespaceToClass

      public GhidraClass convertNamespaceToClass(Namespace namespace)
      Description copied from interface: SymbolTable
      Converts the given namespace to a class namespace
      Specified by:
      convertNamespaceToClass in interface SymbolTable
      Parameters:
      namespace - the namespace to convert
      Returns:
      the new class
    • getOrCreateNameSpace

      public Namespace getOrCreateNameSpace(Namespace parent, String name, SourceType source) throws DuplicateNameException, InvalidInputException
      Description copied from interface: SymbolTable
      Gets an existing namespace with the given name in the given parent. If no namespace exists, then one will be created.
      Specified by:
      getOrCreateNameSpace in interface SymbolTable
      Parameters:
      parent - the parent namespace
      name - the namespace name
      source - the source type for the namespace if one is created
      Returns:
      the namespace
      Throws:
      DuplicateNameException - thrown if another non function or label symbol exists with the given name
      InvalidInputException - if the name is invalid
    • createLibrarySymbol

      public SymbolDB createLibrarySymbol(String name, String pathname, SourceType source) throws DuplicateNameException, InvalidInputException
      Create a Library symbol with the specified name and optional pathname
      Parameters:
      name - library name
      pathname - project file path (may be null)
      source - symbol source
      Returns:
      library symbol
      Throws:
      DuplicateNameException - if library name conflicts with another symbol
      InvalidInputException
    • createLabel

      public Symbol createLabel(Address addr, String name, SourceType source) throws InvalidInputException
      Description copied from interface: SymbolTable
      Create a label symbol with the given name associated to the given Address. The symbol will be global and be of type SymbolType.CODE. Label Symbols do not have to have unique names. If this is the first symbol defined for the address it becomes the primary.
      Specified by:
      createLabel in interface SymbolTable
      Parameters:
      addr - the address at which to create a symbol
      name - the name of the symbol.
      source - the source of this symbol
      Some symbol types, such as function symbols, can set the source to Symbol.DEFAULT.
      Returns:
      new code or function symbol
      Throws:
      InvalidInputException - thrown if names contains white space, is zero length, or is null for non-default source.
    • createLabel

      public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source) throws InvalidInputException
      Description copied from interface: SymbolTable
      Create a label symbol with the given name associated to the given Address and namespace. The symbol will be of type SymbolType.CODE. If this is the first symbol defined for the address it becomes the primary symbol. If a symbol with that name already exists at the address, it will be returned instead with its namespace changed to the new namespace unless the new symbol is in the global space, in which case the namespace will remain as is.
      Specified by:
      createLabel in interface SymbolTable
      Parameters:
      addr - the address at which to create a symbol
      name - the name of the symbol.
      namespace - the namespace of the symbol.
      source - the source of this symbol
      Some symbol types, such as function symbols, can set the source to Symbol.DEFAULT.
      Returns:
      new code or function symbol
      Throws:
      InvalidInputException - thrown if names contains white space, is zero length, or is null for non-default source. Also thrown if invalid parentNamespace is specified.
    • createCodeSymbol

      public Symbol createCodeSymbol(Address addr, String name, Namespace namespace, SourceType source, String stringData) throws InvalidInputException
      Internal method for creating label symbols. If identical memory symbol already exists it will be returned.
      Parameters:
      addr - the address for the new symbol (memory or external)
      name - the name of the new symbol
      namespace - the namespace for the new symbol (null may be specified for global namespace)
      source - the SourceType of the new symbol
      stringData - special use depending on the symbol type and whether or not it is external
      Returns:
      the new symbol
      Throws:
      InvalidInputException - if the name contains illegal characters (i.e. space)
    • createFunctionSymbol

      public Symbol createFunctionSymbol(Address addr, String name, Namespace namespace, SourceType source, String stringData) throws InvalidInputException
      Internal method for creating function symbols
      Parameters:
      addr - the address for the new symbol
      name - the name of the new symbol
      namespace - the namespace for the new symbol (null may be specified for global namespace)
      source - the SourceType of the new symbol
      stringData - special use depending on the symbol type and whether or not it is external.
      Returns:
      the new symbol
      Throws:
      InvalidInputException - if the name contains illegal characters (i.e. space)
    • getClassSymbol

      public Symbol getClassSymbol(String name, Namespace namespace)
      Description copied from interface: SymbolTable
      Returns the class symbol with the given name in the given namespace.
      Specified by:
      getClassSymbol in interface SymbolTable
      Parameters:
      name - the name of the class.
      namespace - the namespace to search for the class.
      Returns:
      the class symbol with the given name in the given namespace.
    • getParameterSymbol

      public Symbol getParameterSymbol(String name, Namespace namespace)
      Description copied from interface: SymbolTable
      Returns the parameter symbol with the given name in the given namespace.
      Specified by:
      getParameterSymbol in interface SymbolTable
      Parameters:
      name - the name of the parameter.
      namespace - the namespace (function) to search for the class.
      Returns:
      the parameter symbol with the given name in the given namespace.
    • getLocalVariableSymbol

      public Symbol getLocalVariableSymbol(String name, Namespace namespace)
      Description copied from interface: SymbolTable
      Returns the local variable symbol with the given name in the given namespace.
      Specified by:
      getLocalVariableSymbol in interface SymbolTable
      Parameters:
      name - the name of the local variable.
      namespace - the namespace (function) to search for the class.
      Returns:
      the local variable symbol with the given name in the given namespace.
    • getNamespaceSymbol

      public Symbol getNamespaceSymbol(String name, Namespace namespace)
      Description copied from interface: SymbolTable
      Returns a generic namespace symbol with the given name in the given namespace.
      Specified by:
      getNamespaceSymbol in interface SymbolTable
      Parameters:
      name - the name of the namespace symbol to retrieve.
      namespace - the namespace containing the symbol to retrieve.
      Returns:
      a generic namespace symbol with the given name in the given namespace.
    • getLabelOrFunctionSymbols

      public List<Symbol> getLabelOrFunctionSymbols(String name, Namespace namespace)
      Description copied from interface: SymbolTable
      Returns all the label or function symbols that have the given name in the given namespace.

      NOTE: This method will not return a default thunk (i.e., thunk function symbol with default source type) since it mirrors the name and parent namespace of the function it thunks.

      Specified by:
      getLabelOrFunctionSymbols in interface SymbolTable
      Parameters:
      name - the name of the symbols to search for.
      namespace - the namespace to search. If null, then the global namespace is assumed.
      Returns:
      a list of all the label or function symbols with the given name in the given namespace.
    • getVariableSymbol

      public Symbol getVariableSymbol(String name, Function function)
      Description copied from interface: SymbolTable
      Returns a symbol that is either a parameter or local variable. There can be only one because these symbol types have a unique name requirement.
      Specified by:
      getVariableSymbol in interface SymbolTable
      Parameters:
      name - the name of the variable.
      function - the function to search.
      Returns:
      a parameter or local variable symbol with the given name.