Package ghidra.program.model.address
Class GlobalSymbol
- java.lang.Object
-
- ghidra.program.model.address.GlobalSymbol
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckIsValid()Check whether this symbol is still valid (i.e., deleted).booleandelete()Delete the symbol and its associated resources.booleanequals(java.lang.Object obj)AddressgetAddress()Reference[]getAssociatedReferences()longgetID()java.lang.StringgetName()java.lang.StringgetName(boolean includeNamespace)Returns the symbol name, optionally prepended with the namespace path.java.lang.ObjectgetObject()NamespacegetParentNamespace()SymbolgetParentSymbol()Returns namespace symbol of the namespace containing this symboljava.lang.String[]getPath()Gets the full path name for this symbol as an ordered array of strings ending with the symbol name.ProgramgetProgram()ProgramLocationgetProgramLocation()intgetReferenceCount()Reference[]getReferences()Returns all memory references to the address of this symbol.Reference[]getReferences(TaskMonitor monitor)Returns all memory references to the address of this symbol.SourceTypegetSource()This method doesn't apply to the global symbol, since a program always has a global symbol and it can't be renamed.SymbolTypegetSymbolType()Returns the symbol typeinthashCode()booleanhasMultipleReferences()booleanhasReferences()booleanisDescendant(Namespace namespace)Returns true if the given namespace symbol is a descendant of this symbol.booleanisDynamic()booleanisExternal()Returns true if this an external symbol.booleanisExternalEntryPoint()booleanisGlobal()booleanisPinned()This returns false, since the global symbol isn't associated with a specific program memory address.booleanisPrimary()booleanisValidParent(Namespace parent)Returns whether the given parent is valid for this Symbol.voidsetName(java.lang.String newName, SourceType source)Sets the name this symbol.voidsetNameAndNamespace(java.lang.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.booleansetPrimary()Sets 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.
-
-
-
Method Detail
-
checkIsValid
public boolean checkIsValid()
Description copied from interface:SymbolCheck whether this symbol is still valid (i.e., deleted).- Specified by:
checkIsValidin interfaceSymbol- Returns:
- true if valid or false if deleted.
-
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:
Address.isExternalAddress()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getAddress
public Address getAddress()
- Specified by:
getAddressin interfaceSymbol
-
getProgram
public Program getProgram()
- Specified by:
getProgramin interfaceSymbol
-
getName
public java.lang.String getName(boolean includeNamespace)
Description copied from interface:SymbolReturns the symbol name, optionally prepended with the namespace path.
-
getPath
public java.lang.String[] getPath()
Description copied from interface:SymbolGets the full path name for this symbol as an ordered array of strings ending with the symbol name. The global symbol will return an empty array.
-
getParentNamespace
public Namespace getParentNamespace()
- Specified by:
getParentNamespacein interfaceSymbol
-
getParentSymbol
public Symbol getParentSymbol()
Description copied from interface:SymbolReturns namespace symbol of the namespace containing this symbol- Specified by:
getParentSymbolin interfaceSymbol
-
isDescendant
public boolean isDescendant(Namespace namespace)
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
public boolean isValidParent(Namespace parent)
Description copied from interface:SymbolReturns whether the given parent is valid for this Symbol.- Specified by:
isValidParentin interfaceSymbol
-
getSymbolType
public SymbolType getSymbolType()
Description copied from interface:SymbolReturns the symbol type- Specified by:
getSymbolTypein interfaceSymbol
-
getReferenceCount
public int getReferenceCount()
- Specified by:
getReferenceCountin interfaceSymbol
-
hasMultipleReferences
public boolean hasMultipleReferences()
- Specified by:
hasMultipleReferencesin interfaceSymbol
-
hasReferences
public boolean hasReferences()
- Specified by:
hasReferencesin interfaceSymbol
-
getReferences
public Reference[] getReferences()
Description copied from interface:SymbolReturns all memory references to the address of this symbol.- Specified by:
getReferencesin interfaceSymbol- See Also:
Symbol.getReferences(TaskMonitor)
-
getReferences
public Reference[] getReferences(TaskMonitor monitor)
Description copied from interface:SymbolReturns all memory references to the address of this symbol. If you do not have aTaskMonitorinstance, then you can passTaskMonitorAdapter.DUMMY_MONITORor null.- Specified by:
getReferencesin interfaceSymbol- Parameters:
monitor- the monitor that is used to report progress and to cancel this potentially long-running call
-
getAssociatedReferences
public Reference[] getAssociatedReferences()
-
getProgramLocation
public ProgramLocation getProgramLocation()
- Specified by:
getProgramLocationin interfaceSymbol
-
setName
public void setName(java.lang.String newName, SourceType source) throws DuplicateNameException, InvalidInputExceptionDescription 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.
-
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
public void setSource(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. Therefore calling it will throw an UnsupportedOperationException.
-
getSource
public SourceType 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.
-
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
-
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(java.lang.String newName, Namespace newNamespace, SourceType source) throws DuplicateNameException, InvalidInputException, CircularDependencyExceptionDescription 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
-
-