Package ghidra.program.database.symbol
Class EquateDB
- java.lang.Object
-
- ghidra.program.database.DatabaseObject
-
- ghidra.program.database.symbol.EquateDB
-
- All Implemented Interfaces:
Equate
public class EquateDB extends DatabaseObject implements Equate
Database object for an Equate.
-
-
Field Summary
-
Fields inherited from class ghidra.program.database.DatabaseObject
key
-
-
Constructor Summary
Constructors Constructor Description EquateDB(EquateManager equateMgr, DBObjectCache<EquateDB> cache, Record record)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReference(long dynamicHash, Address refAddr)
Add a reference (at the given dynamic hash position) to this equate.void
addReference(Address refAddr, int opIndex)
Add a reference (at the given operand position) to this equate.boolean
equals(java.lang.Object obj)
java.lang.String
getDisplayName()
Gets the "display name" of this equate.java.lang.String
getDisplayValue()
Gets a more accurate representation of the equate value.UniversalID
getEnumUUID()
Gets the universal id from this equate if the equate was based off of an enum.java.lang.String
getName()
Get the actual name of this equate.int
getReferenceCount()
Get the number of references to this equate.EquateReference[]
getReferences()
Get the references for this equate.long
getValue()
Get the value of this equate.int
hashCode()
boolean
isEnumBased()
Checks if equate is based off an enum's universal id.boolean
isValidUUID()
Checks if equate is based off an enum's universal id and checks if the enum still exists.protected boolean
refresh()
Tells the object to refresh its state from the database.void
removeReference(long dynamicHash, Address refAddr)
Remove the reference at the given operand position.void
removeReference(Address refAddr, int opIndex)
Remove the reference at the given operand position.void
renameEquate(java.lang.String newName)
Changes the name associated with the equate.java.lang.String
toString()
Get the name of this equate.-
Methods inherited from class ghidra.program.database.DatabaseObject
checkDeleted, checkIsValid, checkIsValid, getKey, isDeleted, isInvalid, keyChanged, refresh, setInvalid, validate
-
-
-
-
Constructor Detail
-
EquateDB
public EquateDB(EquateManager equateMgr, DBObjectCache<EquateDB> cache, Record record)
Constructor- Parameters:
equateMgr
- the equate managercache
- EquateDB cacherecord
- the record for this equate.
-
-
Method Detail
-
refresh
protected boolean refresh()
Description copied from class:DatabaseObject
Tells the object to refresh its state from the database.- Specified by:
refresh
in classDatabaseObject
- Returns:
- true if the object was able to refresh itself. Return false if the 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.
-
addReference
public void addReference(Address refAddr, int opIndex)
Description copied from interface:Equate
Add a reference (at the given operand position) to this equate. If a reference already exists for the instruction at this address, then the old reference will be removed before the new reference is added.- Specified by:
addReference
in interfaceEquate
- Parameters:
refAddr
- the address where the equate is used.opIndex
- the operand index where the equate is used.- See Also:
Equate.addReference(ghidra.program.model.address.Address, int)
-
addReference
public void addReference(long dynamicHash, Address refAddr)
Description copied from interface:Equate
Add a reference (at the given dynamic hash position) to this equate. If a reference already exists for the instruction at this address, then the old reference will be removed before the new reference is added.- Specified by:
addReference
in interfaceEquate
- Parameters:
dynamicHash
- constant varnode dynamic hash valuerefAddr
- the address where the equate is used.- See Also:
Equate.addReference(long, ghidra.program.model.address.Address)
-
getName
public java.lang.String getName()
Description copied from interface:Equate
Get the actual name of this equate. Note that this name may be different than the "display name," which is what the user will see.- Specified by:
getName
in interfaceEquate
- Returns:
- The actual name of this equate.
- See Also:
Equate.getName()
-
getDisplayName
public java.lang.String getDisplayName()
Description copied from interface:Equate
Gets the "display name" of this equate. Note that the display name may be different than the equate's actual name if the equate is based off a data type id.- Specified by:
getDisplayName
in interfaceEquate
- Returns:
- The "display name" of this equate.
-
getEnumUUID
public UniversalID getEnumUUID()
Description copied from interface:Equate
Gets the universal id from this equate if the equate was based off of an enum.- Specified by:
getEnumUUID
in interfaceEquate
- Returns:
- The universal id for this equate.
-
getReferenceCount
public int getReferenceCount()
Description copied from interface:Equate
Get the number of references to this equate.- Specified by:
getReferenceCount
in interfaceEquate
- See Also:
Equate.getReferenceCount()
-
getReferences
public EquateReference[] getReferences()
Description copied from interface:Equate
Get the references for this equate.- Specified by:
getReferences
in interfaceEquate
- Returns:
- a array of EquateReferences.
- See Also:
Equate.getReferences()
-
getValue
public long getValue()
Description copied from interface:Equate
Get the value of this equate.- Specified by:
getValue
in interfaceEquate
- See Also:
Equate.getValue()
-
getDisplayValue
public java.lang.String getDisplayValue()
Description copied from interface:Equate
Gets a more accurate representation of the equate value. Used for rendering as close to the listing as possible.- Specified by:
getDisplayValue
in interfaceEquate
- Returns:
- A more accurate representation of the equate value.
- See Also:
Equate.getDisplayValue()
-
removeReference
public void removeReference(Address refAddr, int opIndex)
Description copied from interface:Equate
Remove the reference at the given operand position.- Specified by:
removeReference
in interfaceEquate
- Parameters:
refAddr
- the address that was using this equateopIndex
- the operand index of the operand that was using this eqate.- See Also:
Equate.removeReference(ghidra.program.model.address.Address, int)
-
removeReference
public void removeReference(long dynamicHash, Address refAddr)
Description copied from interface:Equate
Remove the reference at the given operand position.- Specified by:
removeReference
in interfaceEquate
refAddr
- the address that was using this equate- See Also:
Equate.removeReference(long, ghidra.program.model.address.Address)
-
renameEquate
public void renameEquate(java.lang.String newName) throws DuplicateNameException, InvalidInputException
Description copied from interface:Equate
Changes the name associated with the equate.- Specified by:
renameEquate
in interfaceEquate
- Parameters:
newName
- the new name for this equate.- Throws:
DuplicateNameException
- thrown if newName is already used by another equate.InvalidInputException
- if newName contains blank characters, is zero length, or is null- See Also:
Equate.renameEquate(java.lang.String)
-
isValidUUID
public boolean isValidUUID()
Description copied from interface:Equate
Checks if equate is based off an enum's universal id and checks if the enum still exists. The equate is still valid if the equate is not based off an enum.- Specified by:
isValidUUID
in interfaceEquate
- Returns:
- true if the equate is based off an enum that still exists.
-
isEnumBased
public boolean isEnumBased()
Description copied from interface:Equate
Checks if equate is based off an enum's universal id.- Specified by:
isEnumBased
in interfaceEquate
- Returns:
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(Object)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
-