Class FlowInformation

java.lang.Object
com.pnfsoftware.jeb.core.units.code.FlowInformation
All Implemented Interfaces:
IFlowInformation

@Ser public class FlowInformation extends Object implements IFlowInformation
Default IFlowInformation implementation
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final FlowInformation
    Empty flow information: the instruction modifies the flow of execution, but no target is explicitly specified.
    static final FlowInformation
    Empty flow information, and implicit fall-through is disabled: the instruction modifies the flow of execution, but no target is explicitly specified.
    static final int
    Flag indicating that fall-through should be computed.
    static final int
    Flag indicating that fall-through is disabled.
    static final FlowInformation
    No flow information: the instruction does not modify the flow of execution.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an object with an empty target list, no post-compute fall-through, and no delay-slot (default).
    FlowInformation(boolean computeFallThrough, int delaySlotCount)
    Create an object with an empty target list.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTarget(ICodePointer entryPoint)
    Add a target to the list of possible targets.
    void
    addTargets(Collection<? extends ICodePointer> entryPoints)
    Add a collection of targets to the list of possible targets.
    int
    Get the number of instructions in the delay slot.
    Get the a list of targets.
    static boolean
    isAddressInTargets(IFlowInformation flowinfo, long address)
    Determine whether an address is listed among flow targets.
    boolean
    Determine if this object does contain flow information.
    boolean
    Determine if this object does contain flow information and all targets are known.
    boolean
    Determine if this object does contain flow information but has no known targets.
    boolean
    Indicate if the flow information includes a fall-through address (relative to the current instruction) that is not present in the FlowInfo object itself.
    boolean
    Indicate whether this flow information forbids the implicit calculation of a fall-through edge.
    void
    setComputeFallThrough(boolean enabled)
    Set whether fall-through should be computed.
    void
    setDelaySlotCount(int delaySlotCount)
    Set the delay slot count.
    void
    setNoFallThrough(boolean enabled)
    Set whether fall-through is disabled.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • FLAG_COMPUTE_FT

      public static final int FLAG_COMPUTE_FT
      Flag indicating that fall-through should be computed.
      See Also:
    • FLAG_NO_FT

      public static final int FLAG_NO_FT
      Flag indicating that fall-through is disabled.
      See Also:
    • NONE

      public static final FlowInformation NONE
      No flow information: the instruction does not modify the flow of execution.
    • EMPTY

      public static final FlowInformation EMPTY
      Empty flow information: the instruction modifies the flow of execution, but no target is explicitly specified.
    • EMPTY_NO_FT

      public static final FlowInformation EMPTY_NO_FT
      Empty flow information, and implicit fall-through is disabled: the instruction modifies the flow of execution, but no target is explicitly specified. This constant is suitable for bad or tentative call-to-subs for which the return-to-caller is uncertain.
  • Constructor Details

    • FlowInformation

      public FlowInformation()
      Create an object with an empty target list, no post-compute fall-through, and no delay-slot (default). Note: this object indicates that the flow is changing, regardless of whether of not the target list will be populated. To indicate no-change in flow, a user should use NONE.
    • FlowInformation

      public FlowInformation(boolean computeFallThrough, int delaySlotCount)
      Create an object with an empty target list. Note: this object indicates that the flow is changing, regardless of whether of not the target list will be populated. To indicate no-change in flow, a user should use NONE.
      Parameters:
      computeFallThrough - true to compute fall-through
      delaySlotCount - delay slot count
  • Method Details

    • addTarget

      public void addTarget(ICodePointer entryPoint)
      Add a target to the list of possible targets.
      Parameters:
      entryPoint - target entry point
    • addTargets

      public void addTargets(Collection<? extends ICodePointer> entryPoints)
      Add a collection of targets to the list of possible targets.
      Parameters:
      entryPoints - target entry points
    • isBroken

      public boolean isBroken()
      Description copied from interface: IFlowInformation
      Determine if this object does contain flow information.
      Specified by:
      isBroken in interface IFlowInformation
      Returns:
      true is the flow is broken (eg, generic branch)
    • isBrokenUnknown

      public boolean isBrokenUnknown()
      Description copied from interface: IFlowInformation
      Determine if this object does contain flow information but has no known targets.

      IMPORTANT: if this flow info object is mixed (it specifies having unknown target(s), and also bears known targets), this method returns false.

      Specified by:
      isBrokenUnknown in interface IFlowInformation
      Returns:
      true if the flow is broken but no targets are known
    • isBrokenKnown

      public boolean isBrokenKnown()
      Description copied from interface: IFlowInformation
      Determine if this object does contain flow information and all targets are known.
      Specified by:
      isBrokenKnown in interface IFlowInformation
      Returns:
      true if the flow is broken and all targets are known
    • getTargets

      public List<ICodePointer> getTargets()
      Description copied from interface: IFlowInformation
      Get the a list of targets. Be careful, this list does not include the fall-through target if it is implied (eg, when flow-info is returned by IInstruction.getRoutineCall(long)) or when its calculation was requested dynamically (via IFlowInformation.mustComputeFallThrough()).
      Specified by:
      getTargets in interface IFlowInformation
      Returns:
      the list of addresses that must be checked, possibly empty. A null value signifies no-flow information.
    • setComputeFallThrough

      public void setComputeFallThrough(boolean enabled)
      Set whether fall-through should be computed.
      Parameters:
      enabled - true to compute fall-through
    • mustComputeFallThrough

      public boolean mustComputeFallThrough()
      Description copied from interface: IFlowInformation
      Indicate if the flow information includes a fall-through address (relative to the current instruction) that is not present in the FlowInfo object itself. If this method returns true, the caller must dynamically calculate the fall-through address itself.

      Note that the creator of a flowinfo object may decide to add the fall-through (if any) in the flowinfo object target list. However, in some cases, such as branching instructions with delay slot(s), it is simpler to indicate that the branching instruction allows a fall-through flow, but that it should be computed by the client/user, instead of stored or computed by the flowinfo object.

      Specified by:
      mustComputeFallThrough in interface IFlowInformation
      Returns:
      true if the flowinfo object does not include a fall-through address, false otherwise
    • setNoFallThrough

      public void setNoFallThrough(boolean enabled)
      Set whether fall-through is disabled.
      Parameters:
      enabled - true to disable fall-through
    • noFallThrough

      public boolean noFallThrough()
      Description copied from interface: IFlowInformation
      Indicate whether this flow information forbids the implicit calculation of a fall-through edge. (A fall-through may be explicitly specified as a target, regardless.)
      Specified by:
      noFallThrough in interface IFlowInformation
      Returns:
      true if the flowinfo specifies no fall-through
    • setDelaySlotCount

      public void setDelaySlotCount(int delaySlotCount)
      Set the delay slot count.
      Parameters:
      delaySlotCount - delay slot count
    • getDelaySlotCount

      public int getDelaySlotCount()
      Description copied from interface: IFlowInformation
      Get the number of instructions in the delay slot.
      Specified by:
      getDelaySlotCount in interface IFlowInformation
      Returns:
      number of instructions in delay slot
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isAddressInTargets

      public static boolean isAddressInTargets(IFlowInformation flowinfo, long address)
      Determine whether an address is listed among flow targets.
      Parameters:
      flowinfo - flow information
      address - address to test
      Returns:
      true if the address is a target