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
public class VariableSymbolDB extends SymbolDB
Symbol class for function variables. Symbol Data Usage: long data1 - data type ID int data2 - first-use-offset / ordinal String data3 - variable comment
-
-
Constructor Summary
Constructors Constructor Description VariableSymbolDB(SymbolManager symbolMgr, DBObjectCache<SymbolDB> cache, SymbolType type, VariableStorageManagerDB variableMgr, Address address, Record record)Constructs a new VariableSymbol
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandelete()Delete the symbol and its associated resources.booleanequals(java.lang.Object obj)DataTypegetDataType()intgetFirstUseOffset()FunctionDBgetFunction()java.lang.StringgetName()java.lang.ObjectgetObject()intgetOrdinal()ProgramLocationgetProgramLocation()intgetReferenceCount()Reference[]getReferences(TaskMonitor monitor)Returns all memory references to the address of this symbol.SymbolTypegetSymbolType()Returns the symbol typeVariableStoragegetVariableStorage()booleanhasMultipleReferences()booleanhasReferences()booleanisExternal()Returns true if this an external symbol.booleanisPrimary()booleanisValidParent(Namespace parent)Returns whether the given parent is valid for this Symbol.protected booleanrefresh(Record rec)Tells the object to refresh its state from the database using the specified record if not null.voidsetFirstUseOffset(int firstUseOffset)voidsetInvalid()Invalidate this object.voidsetOrdinal(int ordinal)voidsetStorageAndDataType(VariableStorage newStorage, DataType dt)Change the storage address and data-type associated with this variable symbol.protected SourceTypevalidateNameSource(java.lang.String newName, SourceType source)Allow symbol implementations to validate the source when setting the name of this symbol.-
Methods inherited from class ghidra.program.database.symbol.SymbolDB
doIsPinned, doSetPinned, getAddress, getID, getName, getParentNamespace, getParentSymbol, getPath, getProgram, getReferences, getSource, getSymbolData1, getSymbolData2, getSymbolData3, getSymbolsDynamicallyRenamedByMyRename, hashCode, isDeleting, isDescendant, isDynamic, isExternalEntryPoint, isGlobal, isPinned, move, refresh, removeAllReferencesTo, setAddress, setName, setNameAndNamespace, setNamespace, setPinned, setPrimary, setSource, setSymbolData1, setSymbolData2, setSymbolData3, toString
-
Methods inherited from class ghidra.program.database.DatabaseObject
checkDeleted, checkIsValid, checkIsValid, getKey, isDeleted, isInvalid, keyChanged, validate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ghidra.program.model.symbol.Symbol
checkIsValid
-
-
-
-
Constructor Detail
-
VariableSymbolDB
public VariableSymbolDB(SymbolManager symbolMgr, DBObjectCache<SymbolDB> cache, SymbolType type, VariableStorageManagerDB variableMgr, Address address, Record record)
Constructs a new VariableSymbol- Parameters:
symbolMgr- the symbol managercache- symbol object cachetype- the symbol type.address- the address of the symbol (stack address)record- the record for the symbol
-
-
Method Detail
-
setInvalid
public void setInvalid()
Description copied from class:DatabaseObjectInvalidate 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:
setInvalidin classDatabaseObject
-
getVariableStorage
public VariableStorage getVariableStorage()
-
getSymbolType
public SymbolType getSymbolType()
Description copied from interface:SymbolReturns the symbol type- See Also:
Symbol.getSymbolType()
-
refresh
protected boolean refresh(Record rec)
Description copied from class:DatabaseObjectTells 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:
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
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classSymbolDB- See Also:
SymbolDB.equals(java.lang.Object)
-
delete
public boolean delete()
Description copied from interface:SymbolDelete the symbol and its associated resources.- Specified by:
deletein interfaceSymbol- Overrides:
deletein classSymbolDB- See Also:
Symbol.delete()
-
getObject
public java.lang.Object getObject()
- See Also:
Symbol.getObject()
-
isPrimary
public boolean isPrimary()
- Specified by:
isPrimaryin interfaceSymbol- Specified by:
isPrimaryin classSymbolDB- See Also:
Symbol.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:
Address.isExternalAddress()
-
getFunction
public FunctionDB getFunction()
-
getProgramLocation
public ProgramLocation getProgramLocation()
- See Also:
Symbol.getProgramLocation()
-
isValidParent
public boolean isValidParent(Namespace parent)
Description copied from interface:SymbolReturns whether the given parent is valid for this Symbol.- Specified by:
isValidParentin interfaceSymbol- Specified by:
isValidParentin classSymbolDB- See Also:
Symbol.isValidParent(ghidra.program.model.symbol.Namespace)
-
getName
public java.lang.String getName()
-
validateNameSource
protected SourceType validateNameSource(java.lang.String newName, SourceType source)
Description copied from class:SymbolDBAllow symbol implementations to validate the source when setting the name of this symbol.- Overrides:
validateNameSourcein classSymbolDB
-
getDataType
public DataType getDataType()
-
setStorageAndDataType
public void setStorageAndDataType(VariableStorage newStorage, DataType dt)
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:
getReferenceCountin interfaceSymbol- Overrides:
getReferenceCountin classSymbolDB
-
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- Overrides:
getReferencesin classSymbolDB- Parameters:
monitor- the monitor that is used to report progress and to cancel this potentially long-running call
-
hasMultipleReferences
public boolean hasMultipleReferences()
- Specified by:
hasMultipleReferencesin interfaceSymbol- Overrides:
hasMultipleReferencesin classSymbolDB
-
hasReferences
public boolean hasReferences()
- Specified by:
hasReferencesin interfaceSymbol- Overrides:
hasReferencesin classSymbolDB
-
-