Class RefType

java.lang.Object
ghidra.program.model.symbol.RefType
Direct Known Subclasses:
DataRefType, FlowType

public abstract class RefType extends Object
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 Details

    • INVALID

      public static final FlowType INVALID
      INVALID corresponds to an unknown FlowType which encountered an error when determining the flow-type of the instruction at the from address.
    • FLOW

      public static final FlowType FLOW
      FLOW corresponds to a complex or generic FlowType. This may be used to describe the flow-type of an instruction or code-block which contains multiple outbound flows of differing types. This should not be used for a specific flow Reference.
    • FALL_THROUGH

      public static final FlowType FALL_THROUGH
      FALL_THROUGH corresponds to an instruction fall-through override where modeling requires a fall-through instruction to convey a branch around other CodeUnits. 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 a Reference is reserved for internal use to reflect an Instruction fall-through-override or length-override condition.
    • UNCONDITIONAL_JUMP

      public static final FlowType UNCONDITIONAL_JUMP
      UNCONDITIONAL_JUMP corresponds to an unconditional jump/branch FlowType. This may be used to describe the flow-type of an instruction or code-block, or Reference to another instruction or code-block.
    • CONDITIONAL_JUMP

      public static final FlowType CONDITIONAL_JUMP
      CONDITIONAL_JUMP corresponds to a conditional jump/branch FlowType. This may be used to describe the flow-type of an instruction or code-block, or Reference to another instruction or code-block.
    • UNCONDITIONAL_CALL

      public static final FlowType UNCONDITIONAL_CALL
      UNCONDITIONAL_CALL corresponds to an unconditional call FlowType with fall-through. This may be used to describe the flow-type of an instruction or code-block, or call Reference to another instruction or code-block.
    • CONDITIONAL_CALL

      public static final FlowType CONDITIONAL_CALL
      CONDITIONAL_CALL corresponds to a conditional call FlowType with fall-through. This may be used to describe the flow-type of an instruction or code-block, or call Reference to another instruction or code-block.
    • TERMINATOR

      public static final FlowType TERMINATOR
      TERMINATOR corresponds to a terminal FlowType (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 a Reference.
    • COMPUTED_JUMP

      public static final FlowType COMPUTED_JUMP
      COMPUTED_JUMP corresponds to a computed jump/branch FlowType. This may be used to describe the flow-type of an instruction or code-block, or Reference to another instruction or code-block.
    • CONDITIONAL_TERMINATOR

      public static final FlowType CONDITIONAL_TERMINATOR
      TERMINATOR corresponds to a terminal FlowType (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 a Reference.
    • COMPUTED_CALL

      public static final FlowType COMPUTED_CALL
      COMPUTED_CALL corresponds to a computed call FlowType with fall-through. This may be used to describe the flow-type of an instruction or code-block, or call Reference to another instruction or code-block.
    • CALL_TERMINATOR

      public static final FlowType CALL_TERMINATOR
      CALL_TERMINATOR corresponds to an unconditional call FlowType 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 a Reference. A corresponding Reference should generally specify __UNCONDITIONAL_CALL.
    • COMPUTED_CALL_TERMINATOR

      public static final FlowType COMPUTED_CALL_TERMINATOR
      COMPUTED_CALL_TERMINATOR corresponds to an unconditional call FlowType 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 a Reference. A corresponding Reference should generally specify COMPUTED_CALL.
    • CONDITIONAL_CALL_TERMINATOR

      public static final FlowType CONDITIONAL_CALL_TERMINATOR
      CONDITIONAL_CALL_TERMINATOR corresponds to a conditional call FlowType 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 a Reference. A corresponding Reference should generally specify CONDITIONAL_CALL.
    • CONDITIONAL_COMPUTED_CALL

      public static final FlowType CONDITIONAL_COMPUTED_CALL
      CONDITIONAL_COMPUTED_CALL corresponds to a conditional computed call FlowType with fall-through. This may be used to describe the flow-type of an instruction or code-block, or call Reference to another instruction or code-block.
    • CONDITIONAL_COMPUTED_JUMP

      public static final FlowType CONDITIONAL_COMPUTED_JUMP
      CONDITIONAL_COMPUTED_JUMP corresponds to a conditional computed jump/branch FlowType. This may be used to describe the flow-type of an instruction or code-block, or Reference to another instruction or code-block.
    • JUMP_TERMINATOR

      public static final FlowType JUMP_TERMINATOR
      JUMP_TERMINATOR corresponds to a conditional jump/branch FlowType 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 a Reference. A corresponding Reference should generally specify CONDITIONAL_JUMP.
    • INDIRECTION

      public static final FlowType INDIRECTION
      INDIRECTION corresponds to a flow Reference placed on a pointer data location that is utilized indirectly by a computed jump/branch or call instruction.
    • CALL_OVERRIDE_UNCONDITIONAL

      public static final FlowType CALL_OVERRIDE_UNCONDITIONAL
      __CALL_OVERRIDE_UNCONDITIONAL is used with a memory Reference to override the destination of an instruction PcodeOp.CALL or PcodeOp.CALLIND pcode operation. PcodeOp.CALLIND operations are changed to PcodeOp.CALL operations. The new call target is the "to" address of the Reference. The override only takes effect when the Reference is primary, and only when there is exactly one __CALL_OVERRIDE_UNCONDITIONAL Reference at the "from" address of the reference.
    • JUMP_OVERRIDE_UNCONDITIONAL

      public static final FlowType JUMP_OVERRIDE_UNCONDITIONAL
      JUMP_OVERRIDE_UNCONDITIONAL is used with a memory Reference to override the destination of an instruction PcodeOp.BRANCH or PcodeOp.CBRANCH pcode operation. PcodeOp.CBRANCH operations are changed to PcodeOp.BRANCH operations. The new jump target is the "to" address of the Reference. The override only takes effect when the Reference is primary, and only when there is exactly one JUMP_OVERRIDE_UNCONDITIONAL reference at the "from" address of the reference.
    • CALLOTHER_OVERRIDE_CALL

      public static final FlowType CALLOTHER_OVERRIDE_CALL
      CALLOTHER_OVERRIDE_CALL is used to change a PcodeOp.CALLOTHER pcode operation to a PcodeOp.CALL operation. The new call target is the "to" address of the Reference. Any inputs to the original PcodeOp.CALLOTHER are discarded; the new PcodeOp.CALL may have inputs assigned to it during decompilation. The override only takes effect when the Reference is primary, and only when there is exactly one CALLOTHER_OVERRIDE_CALL reference at the "from" address of the reference. Only the first PcodeOp.CALLOTHER operation at the "from" address of the reference is changed. Applying this override to instances of a PcodeOp.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 over CALLOTHER_OVERRIDE_JUMP references.
    • CALLOTHER_OVERRIDE_JUMP

      public static final FlowType CALLOTHER_OVERRIDE_JUMP
      CALLOTHER_OVERRIDE_CALL is used to change a PcodeOp.CALLOTHER pcode operation to a PcodeOp.BRANCH operation. The new jump target is the "to" address of the Reference. The override only takes effect when the Reference is primary, and only when there is exactly one CALLOTHER_OVERRIDE_CALL reference at the "from" address of the reference. Only the first PcodeOp.CALLOTHER operation at the "from" address of the reference is changed. Applying this override to an instance of a PcodeOp.CALLOTHER with output is not recommended (see CALLOTHER_OVERRIDE_CALL).
    • THUNK

      public static final RefType THUNK
      THUNK type identifies the relationship between a thunk-function and its corresponding thunked-function which do not rely on a stored Reference.
    • DATA

      public static final RefType 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 a INDIRECTION type if used for by a computed jump/branch or call.
    • PARAM

      public static final RefType PARAM
      PARAM type is used to identify data (constant or pointer) that is passed to a function.
    • DATA_IND

      public static final RefType DATA_IND
      Deprecated.
      use of this type is discouraged and may be eliminated in a future release. The type DATA should generally be used in place of this type.
      DATA_IND corresponds to a data Reference placed on a pointer data location that is utilized indirectly to access a data location.
    • READ

      public static final RefType READ
      READ type identifies an instruction reference to a data location that is directly read.
    • WRITE

      public static final RefType WRITE
      WRITE type identifies an instruction reference to a data location that is directly written.
    • READ_WRITE

      public static final RefType READ_WRITE
      READ_WRITE type identifies an instruction reference to a data location that is both directly read and written.
    • READ_IND

      public static final RefType 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

      public static final RefType 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

      public static final RefType 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

      public static final RefType EXTERNAL_REF
      EXTERNAL_REF type is used internally to identify external entry point locations using a from address of Address.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

      protected RefType(byte type, String name)
  • Method Details

    • getDisplayString

      public String 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

      public String getName()
      Returns name of ref-type
      Returns:
      the name
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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