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
Modifier and TypeFieldDescriptionstatic final FlowType
__CALL_OVERRIDE_UNCONDITIONAL
is used with a memoryReference
to override the destination of an instructionPcodeOp.CALL
orPcodeOp.CALLIND
pcode operation.static final FlowType
CALL_TERMINATOR
corresponds to an unconditional callFlowType
followed by a terminal without fall-through (e.g., unconditional return from a function).static final FlowType
CALLOTHER_OVERRIDE_CALL
is used to change aPcodeOp.CALLOTHER
pcode operation to aPcodeOp.CALL
operation.static final FlowType
CALLOTHER_OVERRIDE_CALL
is used to change aPcodeOp.CALLOTHER
pcode operation to aPcodeOp.BRANCH
operation.static final FlowType
COMPUTED_CALL
corresponds to a computed callFlowType
with fall-through.static final FlowType
COMPUTED_CALL_TERMINATOR
corresponds to an unconditional callFlowType
followed by a terminal without fall-through (e.g., unconditional return from a function).static final FlowType
COMPUTED_JUMP
corresponds to a computed jump/branchFlowType
.static final FlowType
CONDITIONAL_CALL
corresponds to a conditional callFlowType
with fall-through.static final FlowType
CONDITIONAL_CALL_TERMINATOR
corresponds to a conditional callFlowType
followed by a terminal without fall-through (e.g., unconditional return from a function).static final FlowType
CONDITIONAL_COMPUTED_CALL
corresponds to a conditional computed callFlowType
with fall-through.static final FlowType
CONDITIONAL_COMPUTED_JUMP
corresponds to a conditional computed jump/branchFlowType
.static final FlowType
CONDITIONAL_JUMP
corresponds to a conditional jump/branchFlowType
.static final FlowType
TERMINATOR
corresponds to a terminalFlowType
(e.g., conditional return from a function).static final RefType
DATA
type 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 RefType
Deprecated.use of this type is discouraged and may be eliminated in a future release.static final RefType
EXTERNAL_REF
type is used internally to identify external entry point locations using a from address ofAddress.NO_ADDRESS
.static final FlowType
FALL_THROUGH
corresponds to an instruction fall-through override where modeling requires a fall-through instruction to convey a branch around otherCodeUnit
s.static final FlowType
static final FlowType
INDIRECTION
corresponds to a flowReference
placed on a pointer data location that is utilized indirectly by a computed jump/branch or call instruction.static final FlowType
static final FlowType
JUMP_OVERRIDE_UNCONDITIONAL
is used with a memoryReference
to override the destination of an instructionPcodeOp.BRANCH
orPcodeOp.CBRANCH
pcode operation.static final FlowType
JUMP_TERMINATOR
corresponds to a conditional jump/branchFlowType
followed by a terminal without fall-through (e.g., unconditional return from a function).static final RefType
PARAM
type is used to identify data (constant or pointer) that is passed to a function.static final RefType
READ
type identifies an instruction reference to a data location that is directly read.static final RefType
READ_IND
type identifies an instruction reference to a data location that is indirectly read using a stored pointer or computed value.static final RefType
READ_WRITE
type identifies an instruction reference to a data location that is both directly read and written.static final RefType
READ_WRITE_IND
type identifies an instruction reference to a data location that is both indirectly read and written using a stored pointer or computed value.static final FlowType
TERMINATOR
corresponds to a terminalFlowType
(e.g., return from a function).static final RefType
static final FlowType
UNCONDITIONAL_CALL
corresponds to an unconditional callFlowType
with fall-through.static final FlowType
UNCONDITIONAL_JUMP
corresponds to an unconditional jump/branchFlowType
.static final RefType
WRITE
type identifies an instruction reference to a data location that is directly written.static final RefType
WRITE_IND
type identifies an instruction reference to a data location that is indirectly written using a stored pointer or computed value. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns an easy to read display string for this ref type.getName()
Returns name of ref-typebyte
getValue()
Get the int value for this RefType objectboolean
Returns true if this flow type can fall throughint
hashCode()
boolean
isCall()
Returns true if the flow is callboolean
Returns true if the flow is a computed call or compute jumpboolean
Returns true if the flow is a conditional call or jumpboolean
isData()
Returns true if the reference is to datafinal boolean
Return true if this flow type is one that does not cause a break in control flowboolean
isFlow()
Returns true if the reference is an instruction flow referenceboolean
Returns true if the reference is indirectboolean
isJump()
Returns true if the flow is jumpboolean
True if this is an override referenceboolean
isRead()
Returns true if the reference is a readboolean
Returns true if this instruction terminatesboolean
Returns true if the flow is an unconditional call or jumpboolean
isWrite()
Returns true if the reference is a writetoString()
-
Field Details
-
INVALID
-
FLOW
-
FALL_THROUGH
FALL_THROUGH
corresponds to an instruction fall-through override where modeling requires a fall-through instruction to convey a branch around otherCodeUnit
s. 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 aReference
is reserved for internal use to reflect anInstruction
fall-through-override or length-override condition. -
UNCONDITIONAL_JUMP
UNCONDITIONAL_JUMP
corresponds to an unconditional jump/branchFlowType
. This may be used to describe the flow-type of an instruction or code-block, orReference
to another instruction or code-block. -
CONDITIONAL_JUMP
CONDITIONAL_JUMP
corresponds to a conditional jump/branchFlowType
. This may be used to describe the flow-type of an instruction or code-block, orReference
to another instruction or code-block. -
UNCONDITIONAL_CALL
UNCONDITIONAL_CALL
corresponds to an unconditional callFlowType
with fall-through. This may be used to describe the flow-type of an instruction or code-block, or callReference
to another instruction or code-block. -
CONDITIONAL_CALL
CONDITIONAL_CALL
corresponds to a conditional callFlowType
with fall-through. This may be used to describe the flow-type of an instruction or code-block, or callReference
to another instruction or code-block. -
TERMINATOR
TERMINATOR
corresponds 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_JUMP
corresponds to a computed jump/branchFlowType
. This may be used to describe the flow-type of an instruction or code-block, orReference
to another instruction or code-block. -
CONDITIONAL_TERMINATOR
TERMINATOR
corresponds 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_CALL
corresponds to a computed callFlowType
with fall-through. This may be used to describe the flow-type of an instruction or code-block, or callReference
to another instruction or code-block. -
CALL_TERMINATOR
CALL_TERMINATOR
corresponds to an unconditional callFlowType
followed 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 correspondingReference
should generally specify__UNCONDITIONAL_CALL
. -
COMPUTED_CALL_TERMINATOR
COMPUTED_CALL_TERMINATOR
corresponds to an unconditional callFlowType
followed 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 correspondingReference
should generally specifyCOMPUTED_CALL
. -
CONDITIONAL_CALL_TERMINATOR
CONDITIONAL_CALL_TERMINATOR
corresponds to a conditional callFlowType
followed 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 correspondingReference
should generally specifyCONDITIONAL_CALL
. -
CONDITIONAL_COMPUTED_CALL
CONDITIONAL_COMPUTED_CALL
corresponds to a conditional computed callFlowType
with fall-through. This may be used to describe the flow-type of an instruction or code-block, or callReference
to another instruction or code-block. -
CONDITIONAL_COMPUTED_JUMP
CONDITIONAL_COMPUTED_JUMP
corresponds to a conditional computed jump/branchFlowType
. This may be used to describe the flow-type of an instruction or code-block, orReference
to another instruction or code-block. -
JUMP_TERMINATOR
JUMP_TERMINATOR
corresponds to a conditional jump/branchFlowType
followed 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 correspondingReference
should generally specifyCONDITIONAL_JUMP
. -
INDIRECTION
INDIRECTION
corresponds to a flowReference
placed on a pointer data location that is utilized indirectly by a computed jump/branch or call instruction. -
CALL_OVERRIDE_UNCONDITIONAL
__CALL_OVERRIDE_UNCONDITIONAL
is used with a memoryReference
to override the destination of an instructionPcodeOp.CALL
orPcodeOp.CALLIND
pcode operation.PcodeOp.CALLIND
operations are changed toPcodeOp.CALL
operations. The new call target is the "to" address of theReference
. The override only takes effect when theReference
is primary, and only when there is exactly one__CALL_OVERRIDE_UNCONDITIONAL
Reference
at the "from" address of the reference. -
JUMP_OVERRIDE_UNCONDITIONAL
JUMP_OVERRIDE_UNCONDITIONAL
is used with a memoryReference
to override the destination of an instructionPcodeOp.BRANCH
orPcodeOp.CBRANCH
pcode operation.PcodeOp.CBRANCH
operations are changed toPcodeOp.BRANCH
operations. The new jump target is the "to" address of theReference
. The override only takes effect when theReference
is primary, and only when there is exactly oneJUMP_OVERRIDE_UNCONDITIONAL
reference at the "from" address of the reference. -
CALLOTHER_OVERRIDE_CALL
CALLOTHER_OVERRIDE_CALL
is used to change aPcodeOp.CALLOTHER
pcode operation to aPcodeOp.CALL
operation. The new call target is the "to" address of theReference
. Any inputs to the originalPcodeOp.CALLOTHER
are discarded; the newPcodeOp.CALL
may have inputs assigned to it during decompilation. The override only takes effect when theReference
is primary, and only when there is exactly oneCALLOTHER_OVERRIDE_CALL
reference at the "from" address of the reference. Only the firstPcodeOp.CALLOTHER
operation at the "from" address of the reference is changed. Applying this override to instances of aPcodeOp.CALLOTHER
that 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_JUMP
references. -
CALLOTHER_OVERRIDE_JUMP
CALLOTHER_OVERRIDE_CALL
is used to change aPcodeOp.CALLOTHER
pcode operation to aPcodeOp.BRANCH
operation. The new jump target is the "to" address of theReference
. The override only takes effect when theReference
is primary, and only when there is exactly oneCALLOTHER_OVERRIDE_CALL
reference at the "from" address of the reference. Only the firstPcodeOp.CALLOTHER
operation at the "from" address of the reference is changed. Applying this override to an instance of aPcodeOp.CALLOTHER
with output is not recommended (seeCALLOTHER_OVERRIDE_CALL
). -
THUNK
-
DATA
DATA
type 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 aINDIRECTION
type if used for by a computed jump/branch or call. -
PARAM
PARAM
type 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 typeDATA
should generally be used in place of this type. -
READ
READ
type identifies an instruction reference to a data location that is directly read. -
WRITE
WRITE
type identifies an instruction reference to a data location that is directly written. -
READ_WRITE
READ_WRITE
type identifies an instruction reference to a data location that is both directly read and written. -
READ_IND
READ_IND
type identifies an instruction reference to a data location that is indirectly read using a stored pointer or computed value. -
WRITE_IND
WRITE_IND
type identifies an instruction reference to a data location that is indirectly written using a stored pointer or computed value. -
READ_WRITE_IND
READ_WRITE_IND
type 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_REF
type 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
-