Package ghidra.program.database.symbol
Class CodeSymbol
java.lang.Object
ghidra.program.database.DatabaseObject
ghidra.program.database.symbol.SymbolDB
ghidra.program.database.symbol.CodeSymbol
- All Implemented Interfaces:
Symbol
Symbols that represent "labels"
Symbol data usage:
EXTERNAL:
String stringData - external memory address/label
-
Field Summary
Fields inherited from class ghidra.program.database.DatabaseObject
key
-
Constructor Summary
ConstructorDescriptionCodeSymbol
(SymbolManager mgr, DBObjectCache<SymbolDB> cache, Address addr, long key) Constructs a new CodeSymbol for a default/dynamic label.CodeSymbol
(SymbolManager mgr, DBObjectCache<SymbolDB> cache, Address addr, DBRecord record) Constructs a new CodeSymbol -
Method Summary
Modifier and TypeMethodDescriptionboolean
delete()
Delete the symbol and its associated resources.boolean
delete
(boolean keepReferences) Delete code/label symbolprotected String
The code for creating the name content for this symbol.Returns this symbol's typeboolean
Returns true if this an external symbol.boolean
isPinned()
Returns true if the symbol is pinned to its current address.boolean
boolean
isValidParent
(Namespace parent) Determines if the given parent is valid for this Symbol.protected boolean
Tells the object to refresh its state from the database using the specified record if not null.void
setPinned
(boolean pinned) Sets whether or not this symbol is pinned to its associated address.boolean
Sets this symbol to be primary.protected SourceType
validateNameSource
(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.SymbolDB
checkDeleted, doCheckIsPrimary, doGetParentNamespace, doIsPinned, doSetNameAndNamespace, doSetPinned, doSetPrimary, equals, getAddress, getDataTypeId, getID, getName, getName, getParentNamespace, getParentSymbol, getPath, getProgram, getReferenceCount, getReferences, getReferences, getSource, getSymbolsDynamicallyRenamedByMyRename, getSymbolStringData, getVariableOffset, hashCode, hasMultipleReferences, hasReferences, isDeleted, isDeleting, isDescendant, isDynamic, isExternalEntryPoint, isGlobal, moveLowLevel, refresh, setAddress, setDataTypeId, setName, setNameAndNamespace, setNamespace, setSource, setSymbolStringData, setVariableOffset, toString
Methods inherited from class ghidra.program.database.DatabaseObject
checkIsValid, checkIsValid, getKey, isDeleted, isInvalid, keyChanged, setDeleted, setInvalid, validate
-
Constructor Details
-
CodeSymbol
Constructs a new CodeSymbol- Parameters:
mgr
- the symbol managercache
- symbol object cacheaddr
- the address associated with the symbolrecord
- the record for this symbol
-
CodeSymbol
Constructs a new CodeSymbol for a default/dynamic label.- Parameters:
mgr
- the symbol managercache
- symbol object cacheaddr
- the address associated with the symbolkey
- this must be the absolute encoding of addr
-
-
Method Details
-
getSymbolType
Description copied from interface:Symbol
Returns this symbol's type- Returns:
- symbol type
- See Also:
-
refresh
Description copied from class:DatabaseObject
Tells the object to refresh its state from the database using the specified record if not null. NOTE: The default implementation ignores the record and invokes refresh(). Implementations of this method must take care if multiple database tables are used since the record supplied could correspond to another object. In some cases it may be best not to override this method or ignore the record provided.- Overrides:
refresh
in classSymbolDB
- Parameters:
rec
- valid record associated with object's key (optional, may be null to force record lookup or other refresh technique)- Returns:
- true if the object was able to refresh itself. Return false if record is null and object was deleted. Objects that extend this class must implement a refresh method. If an object can never refresh itself, then it should always return false.
-
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:
-
delete
public boolean delete()Description copied from interface:Symbol
Delete the symbol and its associated resources. Any references symbol associations will be discarded. -
delete
public boolean delete(boolean keepReferences) Delete code/label symbol- Parameters:
keepReferences
- if false all references to this symbols address will be removed, otherwise associated references will simply be disassociated following symbol removal (seeSymbolManager.doRemoveSymbol(SymbolDB)
.- Returns:
- true if symbol successfully removed
-
isPinned
public boolean isPinned()Description copied from interface:Symbol
Returns true if the symbol is pinned to its current address. If it is pinned, then moving or removing the memory associated with that address will not affect this symbol. -
setPinned
public void setPinned(boolean pinned) Description copied from interface:Symbol
Sets whether or not this symbol is pinned to its associated address.
If the symbol is pinned then moving or removing the memory associated with its address will not cause this symbol to be removed and will not cause its address to change. If the symbol is not pinned, then removing the memory at its address will also remove this symbol.
Likewise, moving a memory block containing a symbol that is not anchored will change the address for that symbol to keep it associated with the same byte in the memory block.
-
getObject
- Returns:
- object associated with this symbol or null if symbol has been deleted
- See Also:
-
isPrimary
public boolean isPrimary() -
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
- Overrides:
setPrimary
in classSymbolDB
- Returns:
- returns true if the symbol was not primary and now it is, otherwise false
- See Also:
-
getProgramLocation
- Returns:
- a program location corresponding to this symbol
- See Also:
-
isValidParent
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 interfaceSymbol
- Overrides:
isValidParent
in classSymbolDB
- Parameters:
parent
- prospective parent namespace for this symbol- Returns:
- true if parent is valid
- See Also:
-
doGetName
Description copied from class:SymbolDB
The code for creating the name content for this symbol. This code will be called with the symbol's lock. -
validateNameSource
Description copied from class:SymbolDB
Allow symbol implementations to validate the source when setting the name of this symbol- Overrides:
validateNameSource
in classSymbolDB
- Parameters:
newName
- the new namesource
- the source type- Returns:
- the validated source type
-