Package ghidra.program.database.symbol
Class CodeSymbol
- java.lang.Object
-
- ghidra.program.database.DatabaseObject
-
- ghidra.program.database.symbol.SymbolDB
-
- ghidra.program.database.symbol.CodeSymbol
-
-
Constructor Summary
Constructors Constructor Description CodeSymbol(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, Record record)Constructs a new CodeSymbol
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandelete()Delete the symbol and its associated resources.booleandelete(boolean keepReferences)java.lang.StringgetName()java.lang.ObjectgetObject()ProgramLocationgetProgramLocation()SymbolTypegetSymbolType()Returns the symbol typebooleanisExternal()Returns true if this an external symbol.booleanisPinned()Returns true if the symbol is pinned to its current address.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.voidsetPinned(boolean pinned)Sets whether or not this symbol is pinned to its associated address.booleansetPrimary()Sets this symbol to be primary.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, equals, getAddress, getID, getName, getParentNamespace, getParentSymbol, getPath, getProgram, getReferenceCount, getReferences, getReferences, getSource, getSymbolData1, getSymbolData2, getSymbolData3, getSymbolsDynamicallyRenamedByMyRename, hashCode, hasMultipleReferences, hasReferences, isDeleting, isDescendant, isDynamic, isExternalEntryPoint, isGlobal, move, refresh, removeAllReferencesTo, setAddress, setName, setNameAndNamespace, setNamespace, setSource, setSymbolData1, setSymbolData2, setSymbolData3, toString
-
Methods inherited from class ghidra.program.database.DatabaseObject
checkDeleted, checkIsValid, checkIsValid, getKey, isDeleted, isInvalid, keyChanged, setInvalid, 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
-
CodeSymbol
public CodeSymbol(SymbolManager mgr, DBObjectCache<SymbolDB> cache, Address addr, Record record)
Constructs a new CodeSymbol- Parameters:
mgr- the symbol managercache- symbol object cacheaddr- the address associated with the symbolrecord- the record for this symbol
-
CodeSymbol
public CodeSymbol(SymbolManager mgr, DBObjectCache<SymbolDB> cache, Address addr, long key)
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 Detail
-
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.
-
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()
-
delete
public boolean delete()
Description copied from interface:SymbolDelete the symbol and its associated resources.
-
delete
public boolean delete(boolean keepReferences)
-
isPinned
public boolean isPinned()
Description copied from interface:SymbolReturns 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:SymbolSets 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
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()
-
setPrimary
public boolean setPrimary()
Description copied from interface:SymbolSets 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:
setPrimaryin interfaceSymbol- Overrides:
setPrimaryin classSymbolDB- Returns:
- returns true if the symbol was not primary and now it is, otherwise false
- See Also:
Symbol.setPrimary()
-
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()
- Specified by:
getNamein interfaceSymbol- Overrides:
getNamein classSymbolDB- See Also:
Symbol.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
-
-