Package ghidra.program.model.symbol
Interface Equate
-
- All Known Implementing Classes:
EquateDB
public interface Equate
An Equate associates a string with a scalar value in the program, and contains a list of addresses and operand positions that refer to this equate.
-
-
Method Summary
All Methods Instance Methods Abstract 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 opndPosition)
Add a reference (at the given operand position) to this equate.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.java.util.List<EquateReference>
getReferences(Address refAddr)
Get references for this equate attached to a specific addresslong
getValue()
Get the value of this equate.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.void
removeReference(long dynamicHash, Address refAddr)
Remove the reference at the given addressvoid
removeReference(Address refAddr, int opndPosition)
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.
-
-
-
Method Detail
-
getName
java.lang.String getName()
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.- Returns:
- The actual name of this equate.
-
getDisplayName
java.lang.String getDisplayName()
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.- Returns:
- The "display name" of this equate.
-
getValue
long getValue()
Get the value of this equate.
-
getDisplayValue
java.lang.String getDisplayValue()
Gets a more accurate representation of the equate value. Used for rendering as close to the listing as possible.- Returns:
- A more accurate representation of the equate value.
-
getReferenceCount
int getReferenceCount()
Get the number of references to this equate.
-
addReference
void addReference(Address refAddr, int opndPosition)
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.- Parameters:
refAddr
- the address where the equate is used.opndPosition
- the operand index where the equate is used.
-
addReference
void addReference(long dynamicHash, Address refAddr)
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.- Parameters:
dynamicHash
- constant varnode dynamic hash valuerefAddr
- the address where the equate is used.
-
renameEquate
void renameEquate(java.lang.String newName) throws DuplicateNameException, InvalidInputException
Changes the name associated with the equate.- 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
-
getReferences
EquateReference[] getReferences()
Get the references for this equate.- Returns:
- a array of EquateReferences.
-
getReferences
java.util.List<EquateReference> getReferences(Address refAddr)
Get references for this equate attached to a specific address- Parameters:
refAddr
- is the address- Returns:
- the list of EquateReferences
-
removeReference
void removeReference(Address refAddr, int opndPosition)
Remove the reference at the given operand position.- Parameters:
refAddr
- the address that was using this equateopndPosition
- the operand index of the operand that was using this eqate.
-
removeReference
void removeReference(long dynamicHash, Address refAddr)
Remove the reference at the given address- Parameters:
dynamicHash
- the hash of the referencerefAddr
- the reference's address
-
isValidUUID
boolean isValidUUID()
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.- Returns:
- true if the equate is based off an enum that still exists.
-
isEnumBased
boolean isEnumBased()
Checks if equate is based off an enum's universal id.- Returns:
-
getEnumUUID
UniversalID getEnumUUID()
Gets the universal id from this equate if the equate was based off of an enum.- Returns:
- The universal id for this equate.
-
toString
java.lang.String toString()
Get the name of this equate.- Overrides:
toString
in classjava.lang.Object
- See Also:
getName()
-
-