Package ghidra.program.database.symbol
Class FunctionSymbol
java.lang.Object
ghidra.program.database.DatabaseObject
ghidra.program.database.symbol.SymbolDB
ghidra.program.database.symbol.MemorySymbol
ghidra.program.database.symbol.FunctionSymbol
- All Implemented Interfaces:
Symbol
Symbol class for functions.
-
Field Summary
Fields inherited from class ghidra.program.database.symbol.SymbolDB
address, lock, record, symbolMgrFields inherited from class ghidra.program.database.DatabaseObject
key -
Constructor Summary
ConstructorsConstructorDescriptionFunctionSymbol(SymbolManager symbolMgr, DBObjectCache<SymbolDB> cache, Address address, DBRecord record) Construct a new FunctionSymbol -
Method Summary
Modifier and TypeMethodDescriptionbooleandelete()Delete the symbol and its associated resources.protected StringThe code for creating the name content for this symbol.protected NamespaceReturns a program location for this symbol; may be null.intGet the number of References to this symbol or its address.getReferences(TaskMonitor monitor) Returns all memory references to the address of this symbol.Returns this symbol's typebooleanbooleanbooleanisValidParent(Namespace parent) Determines if the given parent is valid for this Symbol.voidsetNameAndNamespace(String newName, Namespace newNamespace, SourceType source) Sets the symbols name and namespace.protected SourceTypevalidateNameSource(String newName, SourceType source) Allow symbol implementations to validate the source when setting the name of this symbolMethods inherited from class ghidra.program.database.symbol.MemorySymbol
getExternalOriginalImportedName, getExternalProgramAddress, isExternal, isExternalEntryPoint, isPinned, moveLowLevel, setExternalOriginalImportedName, setExternalProgramAddress, setPinnedMethods inherited from class ghidra.program.database.symbol.SymbolDB
checkDeleted, doCheckIsPrimary, doSetNameAndNamespace, doSetPrimary, equals, getAddress, getDataTypeId, getID, getName, getName, getParentNamespace, getParentSymbol, getPath, getProgram, getSource, hashCode, isDeleted, isDeleting, isDescendant, isDynamic, isGlobal, refresh, refresh, setAddress, setDataTypeId, setName, setNamespace, setPrimary, setSource, setSourceFlagBits, toString, updateRecordMethods inherited from class ghidra.program.database.DatabaseObject
checkIsValid, checkIsValid, getKey, isDeleted, isInvalid, keyChanged, setDeleted, setInvalid, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ghidra.program.model.symbol.Symbol
getReferences
-
Constructor Details
-
FunctionSymbol
public FunctionSymbol(SymbolManager symbolMgr, DBObjectCache<SymbolDB> cache, Address address, DBRecord record) Construct a new FunctionSymbol- Parameters:
symbolMgr- the symbol manager.cache- symbol object cacheaddress- the address for this symbol.record- the record for this symbol.
-
-
Method Details
-
getSymbolType
Description copied from interface:SymbolReturns this symbol's type- Returns:
- symbol type
-
setNameAndNamespace
public void setNameAndNamespace(String newName, Namespace newNamespace, SourceType source) throws DuplicateNameException, InvalidInputException, CircularDependencyException Description copied from interface:SymbolSets the symbols name and namespace. This is provided to allow the caller to avoid a name conflict by creating an autonomous action.- Specified by:
setNameAndNamespacein interfaceSymbol- Overrides:
setNameAndNamespacein classSymbolDB- Parameters:
newName- new symbol namenewNamespace- new parent namespacesource- 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 nameInvalidInputException- is newNamespace is not a valid parent for this symbolCircularDependencyException- if this symbol is an ancestor of newNamespace
-
delete
public boolean delete()Description copied from interface:SymbolDelete the symbol and its associated resources. Any references symbol associations will be discarded. -
getObject
- Returns:
- object associated with this symbol or null if symbol has been deleted
-
isPrimary
public boolean isPrimary() -
getProgramLocation
Description copied from interface:SymbolReturns a program location for this symbol; may be null. This allows implementations to return a more specific program location than what is typically used by the system.- Returns:
- the location
-
isValidParent
Description copied from interface:SymbolDetermines if the given parent is valid for this Symbol. Specified namespace must belong to the same symbol table as this symbol.- Specified by:
isValidParentin interfaceSymbol- Overrides:
isValidParentin classSymbolDB- Parameters:
parent- prospective parent namespace for this symbol- Returns:
- true if parent is valid
-
doGetName
Description copied from class:SymbolDBThe code for creating the name content for this symbol. This code will be called with the symbol's lock. -
doGetParentNamespace
- Overrides:
doGetParentNamespacein classSymbolDB
-
validateNameSource
Description copied from class:SymbolDBAllow symbol implementations to validate the source when setting the name of this symbol- Overrides:
validateNameSourcein classSymbolDB- Parameters:
newName- the new namesource- the source type- Returns:
- the validated source type
-
getSymbolsDynamicallyRenamedByMyRename
- Overrides:
getSymbolsDynamicallyRenamedByMyRenamein classSymbolDB
-
getReferences
Description copied from interface:SymbolReturns all memory references to the address of this symbol. If you do not have aTaskMonitorinstance, then you can passTaskMonitor.DUMMYornull.- Specified by:
getReferencesin interfaceSymbol- Overrides:
getReferencesin classMemorySymbol- Parameters:
monitor- the monitor that is used to report progress and to cancel this potentially long-running call- Returns:
- all memory references to the address of this symbol.
-
getReferenceCount
public int getReferenceCount()Description copied from interface:SymbolGet the number of References to this symbol or its address.NOTE: this method differ from
Symbol.hasReferences()behavior for memory symbols since this method will returnReferenceManager.getReferenceCountTo(Address)if this is the only symbol at its address.- Specified by:
getReferenceCountin interfaceSymbol- Overrides:
getReferenceCountin classMemorySymbol- Returns:
- the number of References to this symbol or its address.
-
hasReferences
public boolean hasReferences()- Specified by:
hasReferencesin interfaceSymbol- Overrides:
hasReferencesin classMemorySymbol- Returns:
- true if this symbol has at least one reference to it.
Explicit references to other symbols at the same address are not considered
(see
Reference.getSymbolID()which indicates a specific symbol reference).
-