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
Modifier and TypeMethodDescriptionvoid
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.Gets the "display name" of this equate.Gets a more accurate representation of the equate value.Gets the universal id from this equate if the equate was based off of an enum.getName()
Get the actual name of this equate.int
Get the number of references to this equate.Get the references for this equate.getReferences
(Address refAddr) Get references for this equate attached to a specific addresslong
getValue()
Get the value of this equate.boolean
Checks if equate is based off an enum's universal id.boolean
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
(String newName) Changes the name associated with the equate.toString()
Get the name of this equate.
-
Method Details
-
getName
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
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
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
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
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
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
Get references for this equate attached to a specific address- Parameters:
refAddr
- is the address- Returns:
- the list of EquateReferences
-
removeReference
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
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
String toString()Get the name of this equate.
-