Package ghidra.program.model.symbol
Class RefType
java.lang.Object
ghidra.program.model.symbol.RefType
- Direct Known Subclasses:
DataRefType,FlowType
RefType defines reference types used to specify the nature of a directional
relationship between a source-location and a destination-location where a "location"
may correspond to a Address, CodeUnit, CodeBlock or other
code related objects. Reference types are generally identified as either
data (see DataRefType) or flow
(see FlowType).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FlowType__CALL_OVERRIDE_UNCONDITIONALis used with a memoryReferenceto override the destination of an instructionPcodeOp.CALLorPcodeOp.CALLINDpcode operation.static final FlowTypeCALL_TERMINATORcorresponds to an unconditional callFlowTypefollowed by a terminal without fall-through (e.g., unconditional return from a function).static final FlowTypeCALLOTHER_OVERRIDE_CALLis used to change aPcodeOp.CALLOTHERpcode operation to aPcodeOp.CALLoperation.static final FlowTypeCALLOTHER_OVERRIDE_CALLis used to change aPcodeOp.CALLOTHERpcode operation to aPcodeOp.BRANCHoperation.static final FlowTypeCOMPUTED_CALLcorresponds to a computed callFlowTypewith fall-through.static final FlowTypeCOMPUTED_CALL_TERMINATORcorresponds to an unconditional callFlowTypefollowed by a terminal without fall-through (e.g., unconditional return from a function).static final FlowTypeCOMPUTED_JUMPcorresponds to a computed jump/branchFlowType.static final FlowTypeCONDITIONAL_CALLcorresponds to a conditional callFlowTypewith fall-through.static final FlowTypeCONDITIONAL_CALL_TERMINATORcorresponds to a conditional callFlowTypefollowed by a terminal without fall-through (e.g., unconditional return from a function).static final FlowTypeCONDITIONAL_COMPUTED_CALLcorresponds to a conditional computed callFlowTypewith fall-through.static final FlowTypeCONDITIONAL_COMPUTED_JUMPcorresponds to a conditional computed jump/branchFlowType.static final FlowTypeCONDITIONAL_JUMPcorresponds to a conditional jump/branchFlowType.static final FlowTypeTERMINATORcorresponds to a terminalFlowType(e.g., conditional return from a function).static final RefTypeDATAtype identifies a generic reference from either an instruction, when the read/write data access is unknown, or from pointer data when it refers to data or it's unknown if it refers to code.static final RefTypeDeprecated.use of this type is discouraged and may be eliminated in a future release.static final RefTypeEXTERNAL_REFtype is used internally to identify external entry point locations using a from address ofAddress.NO_ADDRESS.static final FlowTypeFALL_THROUGHcorresponds to an instruction fall-through override where modeling requires a fall-through instruction to convey a branch around otherCodeUnits.static final FlowTypestatic final FlowTypeINDIRECTIONcorresponds to a flowReferenceplaced on a pointer data location that is utilized indirectly by a computed jump/branch or call instruction.static final FlowTypestatic final FlowTypeJUMP_OVERRIDE_UNCONDITIONALis used with a memoryReferenceto override the destination of an instructionPcodeOp.BRANCHorPcodeOp.CBRANCHpcode operation.static final FlowTypeJUMP_TERMINATORcorresponds to a conditional jump/branchFlowTypefollowed by a terminal without fall-through (e.g., unconditional return from a function).static final RefTypePARAMtype is used to identify data (constant or pointer) that is passed to a function.static final RefTypeREADtype identifies an instruction reference to a data location that is directly read.static final RefTypeREAD_INDtype identifies an instruction reference to a data location that is indirectly read using a stored pointer or computed value.static final RefTypeREAD_WRITEtype identifies an instruction reference to a data location that is both directly read and written.static final RefTypeREAD_WRITE_INDtype identifies an instruction reference to a data location that is both indirectly read and written using a stored pointer or computed value.static final FlowTypeTERMINATORcorresponds to a terminalFlowType(e.g., return from a function).static final RefTypestatic final FlowTypeUNCONDITIONAL_CALLcorresponds to an unconditional callFlowTypewith fall-through.static final FlowTypeUNCONDITIONAL_JUMPcorresponds to an unconditional jump/branchFlowType.static final RefTypeWRITEtype identifies an instruction reference to a data location that is directly written.static final RefTypeWRITE_INDtype identifies an instruction reference to a data location that is indirectly written using a stored pointer or computed value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns an easy to read display string for this ref type.getName()Returns name of ref-typebytegetValue()Get the int value for this RefType objectbooleanReturns true if this flow type can fall throughinthashCode()booleanisCall()Returns true if the flow is callbooleanReturns true if the flow is a computed call or compute jumpbooleanReturns true if the flow is a conditional call or jumpbooleanisData()Returns true if the reference is to datafinal booleanReturn true if this flow type is one that does not cause a break in control flowbooleanisFlow()Returns true if the reference is an instruction flow referencebooleanReturns true if the reference is indirectbooleanisJump()Returns true if the flow is jumpbooleanTrue if this is an override referencebooleanisRead()Returns true if the reference is a readbooleanReturns true if this instruction terminatesbooleanReturns true if the flow is an unconditional call or jumpbooleanisWrite()Returns true if the reference is a writetoString()
-
Field Details
-
INVALID
-
FLOW
-
FALL_THROUGH
FALL_THROUGHcorresponds to an instruction fall-through override where modeling requires a fall-through instruction to convey a branch around otherCodeUnits. While this may be freely used to describe the flow-type of a code-block or its relationship to another code-block, its use with aReferenceis reserved for internal use to reflect anInstructionfall-through-override or length-override condition. -
UNCONDITIONAL_JUMP
UNCONDITIONAL_JUMPcorresponds to an unconditional jump/branchFlowType. This may be used to describe the flow-type of an instruction or code-block, orReferenceto another instruction or code-block. -
CONDITIONAL_JUMP
CONDITIONAL_JUMPcorresponds to a conditional jump/branchFlowType. This may be used to describe the flow-type of an instruction or code-block, orReferenceto another instruction or code-block. -
UNCONDITIONAL_CALL
UNCONDITIONAL_CALLcorresponds to an unconditional callFlowTypewith fall-through. This may be used to describe the flow-type of an instruction or code-block, or callReferenceto another instruction or code-block. -
CONDITIONAL_CALL
CONDITIONAL_CALLcorresponds to a conditional callFlowTypewith fall-through. This may be used to describe the flow-type of an instruction or code-block, or callReferenceto another instruction or code-block. -
TERMINATOR
TERMINATORcorresponds to a terminalFlowType(e.g., return from a function). This may be used to describe the flow-type of an instruction or code-block but should generally not be used with aReference. -
COMPUTED_JUMP
COMPUTED_JUMPcorresponds to a computed jump/branchFlowType. This may be used to describe the flow-type of an instruction or code-block, orReferenceto another instruction or code-block. -
CONDITIONAL_TERMINATOR
TERMINATORcorresponds to a terminalFlowType(e.g., conditional return from a function). This may be used to describe the flow-type of an instruction or code-block but should generally not be used with aReference. -
COMPUTED_CALL
COMPUTED_CALLcorresponds to a computed callFlowTypewith fall-through. This may be used to describe the flow-type of an instruction or code-block, or callReferenceto another instruction or code-block. -
CALL_TERMINATOR
CALL_TERMINATORcorresponds to an unconditional callFlowTypefollowed by a terminal without fall-through (e.g., unconditional return from a function). This may be used to describe the flow-type of an instruction or code-block but should generally not be used with aReference. A correspondingReferenceshould generally specify__UNCONDITIONAL_CALL. -
COMPUTED_CALL_TERMINATOR
COMPUTED_CALL_TERMINATORcorresponds to an unconditional callFlowTypefollowed by a terminal without fall-through (e.g., unconditional return from a function). This may be used to describe the flow-type of an instruction or code-block but should generally not be used with aReference. A correspondingReferenceshould generally specifyCOMPUTED_CALL. -
CONDITIONAL_CALL_TERMINATOR
CONDITIONAL_CALL_TERMINATORcorresponds to a conditional callFlowTypefollowed by a terminal without fall-through (e.g., unconditional return from a function). This may be used to describe the flow-type of an instruction or code-block but should generally not be used with aReference. A correspondingReferenceshould generally specifyCONDITIONAL_CALL. -
CONDITIONAL_COMPUTED_CALL
CONDITIONAL_COMPUTED_CALLcorresponds to a conditional computed callFlowTypewith fall-through. This may be used to describe the flow-type of an instruction or code-block, or callReferenceto another instruction or code-block. -
CONDITIONAL_COMPUTED_JUMP
CONDITIONAL_COMPUTED_JUMPcorresponds to a conditional computed jump/branchFlowType. This may be used to describe the flow-type of an instruction or code-block, orReferenceto another instruction or code-block. -
JUMP_TERMINATOR
JUMP_TERMINATORcorresponds to a conditional jump/branchFlowTypefollowed by a terminal without fall-through (e.g., unconditional return from a function). This may be used to describe the flow-type of an instruction or code-block but should generally not be used with aReference. A correspondingReferenceshould generally specifyCONDITIONAL_JUMP. -
INDIRECTION
INDIRECTIONcorresponds to a flowReferenceplaced on a pointer data location that is utilized indirectly by a computed jump/branch or call instruction. -
CALL_OVERRIDE_UNCONDITIONAL
__CALL_OVERRIDE_UNCONDITIONALis used with a memoryReferenceto override the destination of an instructionPcodeOp.CALLorPcodeOp.CALLINDpcode operation.PcodeOp.CALLINDoperations are changed toPcodeOp.CALLoperations. The new call target is the "to" address of theReference. The override only takes effect when theReferenceis primary, and only when there is exactly one__CALL_OVERRIDE_UNCONDITIONALReferenceat the "from" address of the reference. -
JUMP_OVERRIDE_UNCONDITIONAL
JUMP_OVERRIDE_UNCONDITIONALis used with a memoryReferenceto override the destination of an instructionPcodeOp.BRANCHorPcodeOp.CBRANCHpcode operation.PcodeOp.CBRANCHoperations are changed toPcodeOp.BRANCHoperations. The new jump target is the "to" address of theReference. The override only takes effect when theReferenceis primary, and only when there is exactly oneJUMP_OVERRIDE_UNCONDITIONALreference at the "from" address of the reference. -
CALLOTHER_OVERRIDE_CALL
CALLOTHER_OVERRIDE_CALLis used to change aPcodeOp.CALLOTHERpcode operation to aPcodeOp.CALLoperation. The new call target is the "to" address of theReference. Any inputs to the originalPcodeOp.CALLOTHERare discarded; the newPcodeOp.CALLmay have inputs assigned to it during decompilation. The override only takes effect when theReferenceis primary, and only when there is exactly oneCALLOTHER_OVERRIDE_CALLreference at the "from" address of the reference. Only the firstPcodeOp.CALLOTHERoperation at the "from" address of the reference is changed. Applying this override to instances of aPcodeOp.CALLOTHERthat have an output is not recommended and can adversely affect decompilation (e.g., the decompiler may throw an exception). Note that this reference override takes precedence overCALLOTHER_OVERRIDE_JUMPreferences. -
CALLOTHER_OVERRIDE_JUMP
CALLOTHER_OVERRIDE_CALLis used to change aPcodeOp.CALLOTHERpcode operation to aPcodeOp.BRANCHoperation. The new jump target is the "to" address of theReference. The override only takes effect when theReferenceis primary, and only when there is exactly oneCALLOTHER_OVERRIDE_CALLreference at the "from" address of the reference. Only the firstPcodeOp.CALLOTHERoperation at the "from" address of the reference is changed. Applying this override to an instance of aPcodeOp.CALLOTHERwith output is not recommended (seeCALLOTHER_OVERRIDE_CALL). -
THUNK
-
DATA
DATAtype identifies a generic reference from either an instruction, when the read/write data access is unknown, or from pointer data when it refers to data or it's unknown if it refers to code. A pointer that is known to refer to code should generally have aINDIRECTIONtype if used for by a computed jump/branch or call. -
PARAM
PARAMtype is used to identify data (constant or pointer) that is passed to a function. -
DATA_IND
Deprecated.use of this type is discouraged and may be eliminated in a future release. The typeDATAshould generally be used in place of this type. -
READ
READtype identifies an instruction reference to a data location that is directly read. -
WRITE
WRITEtype identifies an instruction reference to a data location that is directly written. -
READ_WRITE
READ_WRITEtype identifies an instruction reference to a data location that is both directly read and written. -
READ_IND
READ_INDtype identifies an instruction reference to a data location that is indirectly read using a stored pointer or computed value. -
WRITE_IND
WRITE_INDtype identifies an instruction reference to a data location that is indirectly written using a stored pointer or computed value. -
READ_WRITE_IND
READ_WRITE_INDtype identifies an instruction reference to a data location that is both indirectly read and written using a stored pointer or computed value. -
EXTERNAL_REF
EXTERNAL_REFtype is used internally to identify external entry point locations using a from address ofAddress.NO_ADDRESS.NOTE: The use of this type for references to external library data or functions is deprecated and should not be used for that purpose.
-
-
Constructor Details
-
RefType
-
-
Method Details
-
getDisplayString
Returns an easy to read display string for this ref type.- Returns:
- the string
-
getValue
public byte getValue()Get the int value for this RefType object- Returns:
- the value
-
getName
Returns name of ref-type- Returns:
- the name
-
equals
-
hashCode
public int hashCode() -
toString
-
isData
public boolean isData()Returns true if the reference is to data- Returns:
- true if the reference is to data
-
isRead
public boolean isRead()Returns true if the reference is a read- Returns:
- true if the reference is a read
-
isWrite
public boolean isWrite()Returns true if the reference is a write- Returns:
- true if the reference is a write
-
isFlow
public boolean isFlow()Returns true if the reference is an instruction flow reference- Returns:
- true if the reference is an instruction flow reference
-
isIndirect
public boolean isIndirect()Returns true if the reference is indirect- Returns:
- true if the reference is indirect
-
isFallthrough
public final boolean isFallthrough()Return true if this flow type is one that does not cause a break in control flow- Returns:
- if this flow type is one that does not cause a break in control flow
-
hasFallthrough
public boolean hasFallthrough()Returns true if this flow type can fall through- Returns:
- true if can fall through
-
isCall
public boolean isCall()Returns true if the flow is call- Returns:
- true if is a call
-
isJump
public boolean isJump()Returns true if the flow is jump- Returns:
- true if is a jump
-
isUnConditional
public boolean isUnConditional()Returns true if the flow is an unconditional call or jump- Returns:
- true if unconditional
-
isConditional
public boolean isConditional()Returns true if the flow is a conditional call or jump- Returns:
- true if is conditional
-
isComputed
public boolean isComputed()Returns true if the flow is a computed call or compute jump- Returns:
- true if is computed
-
isTerminal
public boolean isTerminal()Returns true if this instruction terminates- Returns:
- true if terminal
-
isOverride
public boolean isOverride()True if this is an override reference- Returns:
- true if this is an override reference
-