Package ghidra.program.model.address
Class GlobalSymbol
java.lang.Object
ghidra.program.model.address.GlobalSymbol
- All Implemented Interfaces:
Symbol
The global symbol implementation class
-
Method Summary
Modifier and TypeMethodDescriptionbooleandelete()Delete the symbol and its associated resources.booleanlonggetID()getName()getName(boolean includeNamespace) Returns the symbol name, optionally prepended with the namespace path.Return the parent namespace for this symbol.Returns namespace symbol of the namespace containing this symbolString[]getPath()Gets the full path name for this symbol as an ordered array of strings ending with the symbol name.Get the program associated with this symbolintReturns all memory references to the address of this symbol.getReferences(TaskMonitor monitor) Returns all memory references to the address of this symbol.This method doesn't apply to the global symbol, since a program always has a global symbol and it can't be renamed.Returns this symbol's typeinthashCode()booleanbooleanbooleanDetermine if this symbol object has been deleted.booleanisDescendant(Namespace namespace) Returns true if the given namespace symbol is a descendant of this symbol.booleanbooleanReturns true if this an external symbol.booleanbooleanisGlobal()booleanisPinned()This returns false, since the global symbol isn't associated with a specific program memory address.booleanbooleanisValidParent(Namespace parent) Determines if the given parent is valid for this Symbol.voidsetName(String newName, SourceType source) Sets the name this symbol.voidsetNameAndNamespace(String newName, Namespace newNamespace, SourceType source) Sets the symbols name and namespace.voidsetNamespace(Namespace newNamespace) Sets the symbols namespacevoidsetPinned(boolean pinned) This method doesn't apply to the global symbol, since it isn't associated with a specific program memory address.booleanSets this symbol to be primary.voidsetSource(SourceType source) This method doesn't apply to the global symbol, since a program always has a global symbol and it can't be renamed.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.program.model.symbol.Symbol
getProgramLocation
-
Method Details
-
isDeleted
public boolean isDeleted()Description copied from interface:SymbolDetermine if this symbol object has been deleted. NOTE: the symbol could be deleted at anytime due to asynchronous activity. -
isExternal
public boolean isExternal()Description copied from interface:SymbolReturns true if this an external symbol.- Specified by:
isExternalin interfaceSymbol- Returns:
- true if this an external symbol.
- See Also:
-
hashCode
public int hashCode() -
equals
-
getAddress
- Specified by:
getAddressin interfaceSymbol- Returns:
- the address for the symbol.
-
getProgram
Description copied from interface:SymbolGet the program associated with this symbol- Specified by:
getProgramin interfaceSymbol- Returns:
- the program associated with this symbol.
-
getName
-
getName
Description copied from interface:SymbolReturns the symbol name, optionally prepended with the namespace path. -
getPath
Description copied from interface:SymbolGets the full path name for this symbol as an ordered array of strings ending with the symbol name. -
getParentNamespace
Description copied from interface:SymbolReturn the parent namespace for this symbol.- Specified by:
getParentNamespacein interfaceSymbol- Returns:
- the namespace that contains this symbol.
-
getParentSymbol
Description copied from interface:SymbolReturns namespace symbol of the namespace containing this symbol- Specified by:
getParentSymbolin interfaceSymbol- Returns:
- parent namespace symbol
-
isDescendant
Description copied from interface:SymbolReturns true if the given namespace symbol is a descendant of this symbol.- Specified by:
isDescendantin interfaceSymbol- Parameters:
namespace- to test as descendant symbol of this Symbol- Returns:
- true if this symbol is an ancestor of the given namespace symbol
-
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- Parameters:
parent- prospective parent namespace for this symbol- Returns:
- true if parent is valid
-
getSymbolType
Description copied from interface:SymbolReturns this symbol's type- Specified by:
getSymbolTypein interfaceSymbol- Returns:
- symbol type
-
getReferenceCount
public int getReferenceCount()- Specified by:
getReferenceCountin interfaceSymbol- Returns:
- the number of References to this symbol.
-
hasMultipleReferences
public boolean hasMultipleReferences()- Specified by:
hasMultipleReferencesin interfaceSymbol- Returns:
- true if this symbol has more than one reference to it.
-
hasReferences
public boolean hasReferences()- Specified by:
hasReferencesin interfaceSymbol- Returns:
- true if this symbol has at least one reference to it.
-
getReferences
Description copied from interface:SymbolReturns all memory references to the address of this symbol.- Specified by:
getReferencesin interfaceSymbol- Returns:
- all memory references to the address of this symbol
- See Also:
-
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- 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.
-
getAssociatedReferences
-
setName
public void setName(String newName, SourceType source) throws DuplicateNameException, InvalidInputException Description copied from interface:SymbolSets the name this symbol. If this symbol is dynamic, then the name is set and the symbol is no longer dynamic.- Specified by:
setNamein interfaceSymbol- 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 already exists as the name of another symbol or alias.InvalidInputException- if alias contains blank characters, is zero length, or is null
-
delete
public boolean delete()Description copied from interface:SymbolDelete the symbol and its associated resources. Any references symbol associations will be discarded. -
isPinned
public boolean isPinned()This returns false, since the global symbol isn't associated with a specific program memory address. -
setPinned
public void setPinned(boolean pinned) This method doesn't apply to the global symbol, since it isn't associated with a specific program memory address. Therefore calling it will have no effect. -
setSource
This method doesn't apply to the global symbol, since a program always has a global symbol and it can't be renamed. Therefore calling it will throw an UnsupportedOperationException.- Specified by:
setSourcein interfaceSymbol- Parameters:
source- the source of this symbol: Symbol.DEFAULT, Symbol.IMPORTED, Symbol.ANALYSIS, or Symbol.USER_DEFINED.- Throws:
UnsupportedOperationException- whenever called.
-
getSource
This method doesn't apply to the global symbol, since a program always has a global symbol and it can't be renamed. Therefore calling it will throw an UnsupportedOperationException. return source the source of this symbol: default, imported, analysis, or user defined.- Specified by:
getSourcein interfaceSymbol- Returns:
- the source of this symbol
- Throws:
UnsupportedOperationException- whenever called.
-
isDynamic
public boolean isDynamic() -
isPrimary
public boolean isPrimary() -
setPrimary
public boolean setPrimary()Description copied from interface:SymbolSets this symbol to be primary. All other symbols at the same address will be set to !primary. Only applies to non-function symbols.- Specified by:
setPrimaryin interfaceSymbol- Returns:
- returns true if the symbol was not primary and now it is, otherwise false
-
isExternalEntryPoint
public boolean isExternalEntryPoint()- Specified by:
isExternalEntryPointin interfaceSymbol- Returns:
- true if the symbol is at an address set as a external entry point.
-
getID
public long getID() -
getObject
-
setNamespace
public void setNamespace(Namespace newNamespace) throws DuplicateNameException, InvalidInputException, CircularDependencyException Description copied from interface:SymbolSets the symbols namespace- Specified by:
setNamespacein interfaceSymbol- Parameters:
newNamespace- new parent namespace- 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
-
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- 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
-
isGlobal
public boolean isGlobal()
-