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 boolean
checkIsValid()
Check whether this symbol is still valid (i.e., deleted).boolean
delete()
Delete the symbol and its associated resources.boolean
equals(java.lang.Object obj)
Address
getAddress()
Reference[]
getAssociatedReferences()
long
getID()
java.lang.String
getName()
java.lang.String
getName(boolean includeNamespace)
Returns the symbol name, optionally prepended with the namespace path.java.lang.Object
getObject()
Namespace
getParentNamespace()
Symbol
getParentSymbol()
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.Program
getProgram()
ProgramLocation
getProgramLocation()
int
getReferenceCount()
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.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.SymbolType
getSymbolType()
Returns the symbol typeint
hashCode()
boolean
hasMultipleReferences()
boolean
hasReferences()
boolean
isDescendant(Namespace namespace)
Returns true if the given namespace symbol is a descendant of this symbol.boolean
isDynamic()
boolean
isExternal()
Returns true if this an external symbol.boolean
isExternalEntryPoint()
boolean
isGlobal()
boolean
isPinned()
This returns false, since the global symbol isn't associated with a specific program memory address.boolean
isPrimary()
boolean
isValidParent(Namespace parent)
Returns whether the given parent is valid for this Symbol.void
setName(java.lang.String newName, SourceType source)
Sets the name this symbol.void
setNameAndNamespace(java.lang.String newName, Namespace newNamespace, SourceType source)
Sets the symbols name and namespace.void
setNamespace(Namespace newNamespace)
Sets the symbols namespacevoid
setPinned(boolean pinned)
This method doesn't apply to the global symbol, since it isn't associated with a specific program memory address.boolean
setPrimary()
Sets this symbol to be primary.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.
-
-
-
Method Detail
-
checkIsValid
public boolean checkIsValid()
Description copied from interface:Symbol
Check whether this symbol is still valid (i.e., deleted).- Specified by:
checkIsValid
in interfaceSymbol
- Returns:
- true if valid or false if deleted.
-
isExternal
public boolean isExternal()
Description copied from interface:Symbol
Returns true if this an external symbol.- Specified by:
isExternal
in interfaceSymbol
- Returns:
- true if this an external symbol.
- See Also:
Address.isExternalAddress()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getAddress
public Address getAddress()
- Specified by:
getAddress
in interfaceSymbol
-
getProgram
public Program getProgram()
- Specified by:
getProgram
in interfaceSymbol
-
getName
public java.lang.String getName(boolean includeNamespace)
Description copied from interface:Symbol
Returns the symbol name, optionally prepended with the namespace path.
-
getPath
public java.lang.String[] getPath()
Description copied from interface:Symbol
Gets 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:
getParentNamespace
in interfaceSymbol
-
getParentSymbol
public Symbol getParentSymbol()
Description copied from interface:Symbol
Returns namespace symbol of the namespace containing this symbol- Specified by:
getParentSymbol
in interfaceSymbol
-
isDescendant
public boolean isDescendant(Namespace namespace)
Description copied from interface:Symbol
Returns true if the given namespace symbol is a descendant of this symbol.- Specified by:
isDescendant
in 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:Symbol
Returns whether the given parent is valid for this Symbol.- Specified by:
isValidParent
in interfaceSymbol
-
getSymbolType
public SymbolType getSymbolType()
Description copied from interface:Symbol
Returns the symbol type- Specified by:
getSymbolType
in interfaceSymbol
-
getReferenceCount
public int getReferenceCount()
- Specified by:
getReferenceCount
in interfaceSymbol
-
hasMultipleReferences
public boolean hasMultipleReferences()
- Specified by:
hasMultipleReferences
in interfaceSymbol
-
hasReferences
public boolean hasReferences()
- Specified by:
hasReferences
in interfaceSymbol
-
getReferences
public Reference[] getReferences()
Description copied from interface:Symbol
Returns all memory references to the address of this symbol.- Specified by:
getReferences
in interfaceSymbol
- See Also:
Symbol.getReferences(TaskMonitor)
-
getReferences
public Reference[] getReferences(TaskMonitor monitor)
Description copied from interface:Symbol
Returns all memory references to the address of this symbol. If you do not have aTaskMonitor
instance, then you can passTaskMonitorAdapter.DUMMY_MONITOR
or null.- Specified by:
getReferences
in 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:
getProgramLocation
in interfaceSymbol
-
setName
public void setName(java.lang.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 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:Symbol
Delete 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:Symbol
Sets 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:
setPrimary
in interfaceSymbol
- Returns:
- returns true if the symbol was not primary and now it is, otherwise false
-
isExternalEntryPoint
public boolean isExternalEntryPoint()
- Specified by:
isExternalEntryPoint
in interfaceSymbol
-
setNamespace
public void setNamespace(Namespace newNamespace) throws DuplicateNameException, InvalidInputException, CircularDependencyException
Description copied from interface:Symbol
Sets the symbols namespace- Specified by:
setNamespace
in 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, 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 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
-
-