Package ghidra.program.database.symbol
Class VariableSymbolDB
java.lang.Object
ghidra.program.database.DatabaseObject
ghidra.program.database.symbol.SymbolDB
ghidra.program.database.symbol.VariableSymbolDB
- All Implemented Interfaces:
Symbol
- Direct Known Subclasses:
GlobalVariableSymbolDB
Symbol class for function variables.
Symbol Data Usage:
String stringData - variable comment
-
Field Summary
Fields inherited from class ghidra.program.database.DatabaseObject
key
-
Constructor Summary
ConstructorDescriptionVariableSymbolDB
(SymbolManager symbolMgr, DBObjectCache<SymbolDB> cache, SymbolType type, VariableStorageManagerDB variableMgr, Address address, DBRecord record) Constructs a new VariableSymbol -
Method Summary
Modifier and TypeMethodDescriptionboolean
delete()
Delete the symbol and its associated resources.protected String
The code for creating the name content for this symbol.boolean
int
int
int
getReferences
(TaskMonitor monitor) Returns all memory references to the address of this symbol.Returns this symbol's typeboolean
boolean
boolean
Returns true if this an external symbol.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
setFirstUseOffset
(int firstUseOffset) void
Invalidate this object.void
setOrdinal
(int ordinal) void
setStorageAndDataType
(VariableStorage newStorage, DataType dt) Change the storage address and data-type associated with this variable symbol.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, getAddress, getDataTypeId, getID, getName, getName, getParentNamespace, getParentSymbol, getPath, getProgram, getReferences, getSource, getSymbolsDynamicallyRenamedByMyRename, getSymbolStringData, getVariableOffset, hashCode, isDeleted, isDeleting, isDescendant, isDynamic, isExternalEntryPoint, isGlobal, isPinned, moveLowLevel, refresh, setAddress, setDataTypeId, setName, setNameAndNamespace, setNamespace, setPinned, setPrimary, setSource, setSymbolStringData, setVariableOffset, toString
Methods inherited from class ghidra.program.database.DatabaseObject
checkIsValid, checkIsValid, getKey, isDeleted, isInvalid, keyChanged, setDeleted, validate
-
Constructor Details
-
VariableSymbolDB
public VariableSymbolDB(SymbolManager symbolMgr, DBObjectCache<SymbolDB> cache, SymbolType type, VariableStorageManagerDB variableMgr, Address address, DBRecord record) Constructs a new VariableSymbol- Parameters:
symbolMgr
- the symbol managercache
- symbol object cachetype
- the symbol type.variableMgr
- variable storage manageraddress
- the address of the symbol (stack address)record
- the record for the symbol
-
-
Method Details
-
setInvalid
public void setInvalid()Description copied from class:DatabaseObject
Invalidate this object. This does not necessarily mean that this object can never be used again. If the object can refresh itself, it may still be useable.- Overrides:
setInvalid
in classDatabaseObject
-
getVariableStorage
-
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.
-
equals
-
delete
public boolean delete()Description copied from interface:Symbol
Delete 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
- See Also:
-
isPrimary
public boolean isPrimary() -
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:
-
getFunction
-
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
-
getDataType
-
setStorageAndDataType
Change the storage address and data-type associated with this variable symbol.- Parameters:
newStorage
-dt
- data-type
-
getFirstUseOffset
public int getFirstUseOffset() -
setFirstUseOffset
public void setFirstUseOffset(int firstUseOffset) -
getOrdinal
public int getOrdinal() -
setOrdinal
public void setOrdinal(int ordinal) -
getReferenceCount
public int getReferenceCount()- Specified by:
getReferenceCount
in interfaceSymbol
- Overrides:
getReferenceCount
in classSymbolDB
- Returns:
- the number of References to this symbol.
-
getReferences
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 passTaskMonitor.DUMMY
ornull
.- Specified by:
getReferences
in interfaceSymbol
- Overrides:
getReferences
in classSymbolDB
- 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.
-
hasMultipleReferences
public boolean hasMultipleReferences()- Specified by:
hasMultipleReferences
in interfaceSymbol
- Overrides:
hasMultipleReferences
in classSymbolDB
- Returns:
- true if this symbol has more than one reference to it.
-
hasReferences
public boolean hasReferences()- Specified by:
hasReferences
in interfaceSymbol
- Overrides:
hasReferences
in classSymbolDB
- Returns:
- true if this symbol has at least one reference to it.
-