Package ghidra.debug.api.control

# 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

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `RO_TARGET`
  Control actions, breakpoint commands are directed to the target, but state edits are rejected.
  `RO_TRACE`
  Control actions activate trace snapshots, breakpoint commands are directed to the emulator, and state edits are rejected.
  `RW_EMULATOR`
  Control actions, breakpoint commands, and state edits are directed to the emulator.
  `RW_TARGET`
  Control actions, breakpoint commands, and state edits are all directed to the target.
  `RW_TRACE`
  Control actions activate trace snapshots, breakpoint commands are directed to the emulator, and state edits modify the current trace snapshot.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final List<ControlMode>`
  `ALL`
  `static final ControlMode`
  `DEFAULT`
  `final Icon`
  `icon`
  `final String`
  `name`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract boolean`
  `canEdit(DebuggerCoordinates coordinates)`
  Check if (broadly speaking) the mode supports editing the given coordinates
  `abstract boolean`
  `followsPresent()`
  Check if the UI should keep its active snapshot in sync with the recorder's latest.
  `ControlMode`
  `getAlternative(DebuggerCoordinates coordinates)`
  If the mode can no longer be selected for new coordinates, get the new mode
  `boolean`
  `isSelectable(DebuggerCoordinates coordinates)`
  Check if this mode can be selected for the given coordinates
  `abstract boolean`
  `isTarget()`
  Indicates whether this mode controls the target
  `abstract boolean`
  `isVariableEditable(DebuggerCoordinates coordinates, Address address, int length)`
  Check if the given variable can be edited under this mode
  `ControlMode`
  `modeOnChange(DebuggerCoordinates coordinates)`
  Find the new mode (or same) mode when activating the given coordinates
  `protected TracePlatform`
  `platformFor(DebuggerCoordinates coordinates, Address address)`
  `abstract CompletableFuture<Void>`
  `setVariable(PluginTool tool, DebuggerCoordinates coordinates, Address address, byte[] data)`
  Set the value of a variable
  `abstract boolean`
  `useEmulatedBreakpoints()`
  Check if this mode operates on target breakpoints or emulator breakpoints
  `DebuggerCoordinates`
  `validateCoordinates(PluginTool tool, DebuggerCoordinates coordinates, DebuggerTraceManagerService.ActivationCause cause)`
  Validate and/or adjust the given coordinates pre-activation
  `static ControlMode`
  `valueOf(String name)`
  Returns the enum constant of this class with the specified name.
  `static ControlMode[]`
  `values()`
  Returns an array containing the constants of this enum class, in the order they are declared.

  ### Methods inherited from class java.lang.Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## 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

  - ### ALL

    public static final List<ControlMode> ALL

  - ### DEFAULT

    public static final ControlMode DEFAULT

  - ### name

    public final String name

  - ### icon

    public final Icon icon

- ## 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