Enum Class ControlMode

java.lang.Object
java.lang.Enum<ControlMode>
ghidra.debug.api.control.ControlMode
All Implemented Interfaces:
Serializable, Comparable<ControlMode>, Constable

public enum ControlMode extends Enum<ControlMode>
The control / state editing modes
  • Enum Constant Details

    • RO_TARGET

      public static final ControlMode RO_TARGET
      Control actions, breakpoint commands are directed to the target, but state edits are rejected.
    • RW_TARGET

      public static final ControlMode RW_TARGET
      Control actions, breakpoint commands, and state edits are all directed to the target.
    • RO_TRACE

      public static final ControlMode RO_TRACE
      Control actions activate trace snapshots, breakpoint commands are directed to the emulator, and state edits are rejected.
    • RW_TRACE

      public static final ControlMode RW_TRACE
      Control actions activate trace snapshots, breakpoint commands are directed to the emulator, and state edits modify the current trace snapshot.
    • RW_EMULATOR

      public static final ControlMode RW_EMULATOR
      Control actions, breakpoint commands, and state edits are directed to the emulator.

      Edits are accomplished by appending patch steps to the current schedule and activating that schedule.

  • Field Details

  • Method Details

    • values

      public static ControlMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ControlMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • followsPresent

      public abstract boolean followsPresent()
      Check if the UI should keep its active snapshot in sync with the recorder's latest.
      Returns:
      true to follow, false if not
    • validateCoordinates

      public DebuggerCoordinates validateCoordinates(PluginTool tool, DebuggerCoordinates coordinates, DebuggerTraceManagerService.ActivationCause cause)
      Validate and/or adjust the given coordinates pre-activation

      This is called by the trace manager whenever there is a request to activate new coordinates. The control mode may adjust or reject the request before the trace manager actually performs and notifies the activation.

      Parameters:
      tool - the tool for displaying status messages
      coordinates - the requested coordinates
      cause - the cause of the activation
      Returns:
      the effective coordinates or null to reject
    • platformFor

      protected TracePlatform platformFor(DebuggerCoordinates coordinates, Address address)
    • canEdit

      public abstract boolean canEdit(DebuggerCoordinates coordinates)
      Check if (broadly speaking) the mode supports editing the given coordinates
      Parameters:
      coordinates - the coordinates to check
      Returns:
      true if editable, false if not
    • isVariableEditable

      public abstract boolean isVariableEditable(DebuggerCoordinates coordinates, Address address, int length)
      Check if the given variable can be edited under this mode
      Parameters:
      coordinates - the coordinates to check
      address - the address of the variable
      length - the length of the variable, in bytes
      Returns:
      true if editable, false if not
    • setVariable

      public abstract CompletableFuture<Void> setVariable(PluginTool tool, DebuggerCoordinates coordinates, Address address, byte[] data)
      Set the value of a variable

      Because the edit may be directed to a live target, the return value is a CompletableFuture. Additionally, when directed to the emulator, this allows the emulated state to be computed in the background.

      Parameters:
      tool - the tool requesting the edit
      coordinates - the coordinates of the edit
      address - the address of the variable
      data - the desired value of the variable
      Returns:
      a future which completes when the edit is finished
    • useEmulatedBreakpoints

      public abstract boolean useEmulatedBreakpoints()
      Check if this mode operates on target breakpoints or emulator breakpoints
      Returns:
      false for target, true for emulator
    • isSelectable

      public boolean isSelectable(DebuggerCoordinates coordinates)
      Check if this mode can be selected for the given coordinates
      Parameters:
      coordinates - the current coordinates
      Returns:
      true to enable selection, false to disable
    • getAlternative

      public ControlMode getAlternative(DebuggerCoordinates coordinates)
      If the mode can no longer be selected for new coordinates, get the new mode

      For example, if a target terminates while the mode is RO_TARGET, this specifies the new mode.

      Parameters:
      coordinates - the new coordinates
      Returns:
      the new mode
    • modeOnChange

      public ControlMode modeOnChange(DebuggerCoordinates coordinates)
      Find the new mode (or same) mode when activating the given coordinates

      The default is implemented using isSelectable(DebuggerCoordinates) followed by getAlternative(DebuggerCoordinates).

      Parameters:
      coordinates - the new coordinates
      Returns:
      the mode
    • isTarget

      public abstract boolean isTarget()
      Indicates whether this mode controls the target
      Returns:
      true if it controls the target