Class VariableSymbolDB
java.lang.Object
ghidra.program.database.DbObject
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
-
Method Summary
Modifier and TypeMethodDescriptionbooleandelete()Delete the symbol and its associated resources.protected StringThe code for creating the name content for this symbol.booleanintintReturns a program location for this symbol; may be null.intGet the number of References to this symbol or its address.getReferences(TaskMonitor monitor) Returns all memory references to the address of this symbol.Returns variable symbol comment.Returns this symbol's typeprotected intgets the generic symbol data 2 data.booleanbooleanReturns true if this an external symbol.booleanbooleanisValidParent(Namespace parent) Determines if the given parent is valid for this Symbol.protected booleanTells the object to refresh its state from the database using the specified record if provided.voidsetFirstUseOffset(int firstUseOffset) voidInvalidate this object.voidsetOrdinal(int ordinal) voidsetStorageAndDataType(VariableStorage newStorage, DataType dt) Change the storage address and data-type associated with this variable symbol.voidsetSymbolComment(String comment) Update variable symbol comment (no change event is issued)voidsetVariableOffset(int offset) Sets the symbol's variable offset.protected SourceTypevalidateNameSource(String newName, SourceType source) Allow symbol implementations to validate the source when setting the name of this symbolMethods inherited from class SymbolDB
checkDeleted, doCheckIsPrimary, doGetParentNamespace, doSetNameAndNamespace, doSetPrimary, getAddress, getDataTypeId, getID, getName, getName, getParentNamespace, getParentSymbol, getPath, getProgram, getSource, getSymbolsDynamicallyRenamedByMyRename, hashCode, isDeleted, isDeleting, isDescendant, isDynamic, isGlobal, setAddress, setDataTypeId, setName, setNameAndNamespace, setNamespace, setPrimary, setSource, setSourceFlagBits, toString, updateRecordMethods inherited from class DbObject
getKey, isDeleted, isValid, keyChanged, needsRefreshing, refreshIfNeeded, setDeleted, setValid, validateMethods inherited from interface Symbol
getReferences, isExternalEntryPoint, isPinned, setPinned
-
Method Details
-
setInvalid
public void setInvalid()Description copied from class:DbObjectInvalidate 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 usable.- Overrides:
setInvalidin classDbObject
-
getVariableStorage
-
getSymbolType
-
refresh
Description copied from class:DbObjectTells the object to refresh its state from the database using the specified record if provided. The record may be null and the object is generally expected to be able to retrieve its own record from the database as needed. Is is mostly passed as a parameter for efficiency to keep an object from having to look up its record when the client already has the record in hand such as when it is iterating over records.This method generally should not be called directly as it provides no recursion protection. Instead, most clients should call
DbObject.refreshIfNeeded()instead which WILL provide recursion protection. If clients must call this method, they either need to provided their own recursion protection or be absolutely certain that recursive calls won't occur.- Overrides:
refreshin 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
-
getObject
- Returns:
- object associated with this symbol or null if symbol has been deleted
-
isPrimary
-
isExternal
public boolean isExternal()Description copied from interface:SymbolReturns true if this an external symbol.- Returns:
- true if this an external symbol.
- See Also:
-
getFunction
-
getProgramLocation
Description copied from interface:SymbolReturns a program location for this symbol; may be null. This allows implementations to return a more specific program location than what is typically used by the system.- Returns:
- the location
-
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- Overrides:
isValidParentin classSymbolDB- Parameters:
parent- prospective parent namespace for this symbol- Returns:
- true if parent is valid
-
doGetName
-
validateNameSource
Description copied from class:SymbolDBAllow symbol implementations to validate the source when setting the name of this symbol- Overrides:
validateNameSourcein 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- the new storagedt- 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()Description copied from interface:SymbolGet the number of References to this symbol or its address.NOTE: this method differ from
Symbol.hasReferences()behavior for memory symbols since this method will returnReferenceManager.getReferenceCountTo(Address)if this is the only symbol at its address.- Returns:
- the number of References to this symbol or its address.
-
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.- 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.
-
hasReferences
public boolean hasReferences()- Returns:
- true if this symbol has at least one reference to it.
Explicit references to other symbols at the same address are not considered
(see
Reference.getSymbolID()which indicates a specific symbol reference).
-
getVariableOffset
protected int getVariableOffset()gets the generic symbol data 2 data.- Returns:
- the symbol data
-
setVariableOffset
public void setVariableOffset(int offset) Sets the symbol's variable offset. For parameters, this is the ordinal, for locals, it is the first use offset- Parameters:
offset- the value to set as the symbols variable offset.
-
getSymbolComment
-
setSymbolComment
Update variable symbol comment (no change event is issued)- Parameters:
comment- variable comment
-