Package ghidra.program.database.symbol

# Class LibrarySymbol

java.lang.Object
ghidra.program.database.DatabaseObject
ghidra.program.database.symbol.SymbolDB
ghidra.program.database.symbol.LibrarySymbol

All Implemented Interfaces:
  `Symbol`

public class LibrarySymbol extends SymbolDB
Class for library symbols. Symbol data usage: String stringData - associated program project file path

- ## Field Summary

  ### Fields inherited from class ghidra.program.database.symbol.SymbolDB

  `address, lock, record, symbolMgr`

  ### Fields inherited from class ghidra.program.database.DatabaseObject

  `key`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LibrarySymbol(SymbolManager symbolMgr, DBObjectCache<SymbolDB> cache, DBRecord record)`
  Constructs a new Library Symbol

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getExternalLibraryPath()`
  Returns the library program path within the project (may be null).
  `Library`
  `getObject()`
  `SymbolType`
  `getSymbolType()`
  Returns this symbol's type
  `boolean`
  `isExternal()`
  Returns true if this an external symbol.
  `boolean`
  `isPrimary()`
  `boolean`
  `isValidParent(Namespace parent)`
  Determines if the given parent is valid for this Symbol.
  `void`
  `setExternalLibraryPath(String libraryPath)`
  Set the library program path within the project.
  `void`
  `setName(String newName, SourceType source)`
  Sets the name this symbol.
  `void`
  `setNameAndNamespace(String newName, Namespace newNamespace, SourceType source)`
  Sets the symbols name and namespace.

  ### Methods inherited from class ghidra.program.database.symbol.SymbolDB

  `checkDeleted, delete, doCheckIsPrimary, doGetName, doGetParentNamespace, doSetNameAndNamespace, doSetPrimary, equals, getAddress, getDataTypeId, getID, getName, getName, getParentNamespace, getParentSymbol, getPath, getProgram, getSource, getSymbolsDynamicallyRenamedByMyRename, hashCode, isDeleted, isDeleting, isDescendant, isDynamic, isGlobal, refresh, refresh, setAddress, setDataTypeId, setNamespace, setPrimary, setSource, setSourceFlagBits, toString, updateRecord, validateNameSource`

  ### Methods inherited from class ghidra.program.database.DatabaseObject

  `checkIsValid, checkIsValid, getKey, isDeleted, isInvalid, keyChanged, setDeleted, setInvalid, validate`

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

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface ghidra.program.model.symbol.Symbol

  `getProgramLocation, getReferenceCount, getReferences, getReferences, hasReferences, isExternalEntryPoint, isPinned, setPinned`

- ## Constructor Details

  - ### LibrarySymbol

    public LibrarySymbol(SymbolManager symbolMgr, DBObjectCache<SymbolDB> cache, DBRecord record)
    Constructs a new Library Symbol
    Parameters:
      `symbolMgr` - the symbol manager
      `cache` - symbol object cache
      `record` - the record for this symbol

- ## Method Details

  - ### setName

    public void setName(String newName, SourceType source) throws DuplicateNameException, InvalidInputException
    Description copied from interface: `Symbol`
    Sets the name this symbol. If this symbol is dynamic, then the name is set and the symbol is no longer dynamic.
    Specified by:
      `setName` in interface `Symbol`
    Overrides:
      `setName` in class `SymbolDB`
    Parameters:
      `newName` - the new name for this symbol.
      `source` - the source of this symbol
      Some symbol types, such as function symbols, can set the source to Symbol.DEFAULT.
    Throws:
      `DuplicateNameException` - if name conflicts with another symbol.
      `InvalidInputException` - if an invalid or null name specified (see `SymbolUtilities.validateName(java.lang.String)`).

  - ### setNameAndNamespace

    public void setNameAndNamespace(String newName, Namespace newNamespace, SourceType source) throws DuplicateNameException, InvalidInputException, CircularDependencyException
    Description copied from interface: `Symbol`
    Sets the symbols name and namespace. This is provided to allow the caller to avoid a name conflict by creating an autonomous action.
    Specified by:
      `setNameAndNamespace` in interface `Symbol`
    Overrides:
      `setNameAndNamespace` in class `SymbolDB`
    Parameters:
      `newName` - new symbol name
      `newNamespace` - new parent namespace
      `source` - the source of this symbol
      Some symbol types, such as function symbols, can set the source to Symbol.DEFAULT.
    Throws:
      `DuplicateNameException` - if newNamespace already contains a symbol with this symbol's name
      `InvalidInputException` - is newNamespace is not a valid parent for this symbol
      `CircularDependencyException` - if this symbol is an ancestor of newNamespace

  - ### getSymbolType

    public SymbolType getSymbolType()
    Description copied from interface: `Symbol`
    Returns this symbol's type
    Returns:
      symbol type

  - ### isExternal

    public boolean isExternal()
    Description copied from interface: `Symbol`
    Returns true if this an external symbol.
    Returns:
      true if this an external symbol.
    See Also:
      - `Address.isExternalAddress()`

  - ### getObject

    public Library getObject()
    Returns:
      object associated with this symbol or null if symbol has been deleted

  - ### isPrimary

    public boolean isPrimary()
    Specified by:
      `isPrimary` in interface `Symbol`
    Specified by:
      `isPrimary` in class `SymbolDB`
    Returns:
      true if this symbol is primary

  - ### isValidParent

    public boolean isValidParent(Namespace parent)
    Description copied from interface: `Symbol`
    Determines if the given parent is valid for this Symbol. Specified namespace must belong to the same symbol table as this symbol.
    Specified by:
      `isValidParent` in interface `Symbol`
    Overrides:
      `isValidParent` in class `SymbolDB`
    Parameters:
      `parent` - prospective parent namespace for this symbol
    Returns:
      true if parent is valid

  - ### getExternalLibraryPath

    public String getExternalLibraryPath()
    Returns the library program path within the project (may be null).
    Returns:
      the library program path within the project (may be null)

  - ### setExternalLibraryPath

    public void setExternalLibraryPath(String libraryPath)
    Set the library program path within the project.
    Parameters:
      `libraryPath` - library program path or null to clear