Enum Class DebuggerPcodeUtils

java.lang.Object
java.lang.Enum<DebuggerPcodeUtils>
ghidra.pcode.exec.DebuggerPcodeUtils
All Implemented Interfaces:
Serializable, Comparable<DebuggerPcodeUtils>, Constable

public enum DebuggerPcodeUtils extends Enum<DebuggerPcodeUtils>
Utilities for evaluating or executing Sleigh/p-code in the Debugger
  • Method Details

    • values

      public static DebuggerPcodeUtils[] 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 DebuggerPcodeUtils 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
    • compileProgram

      public static PcodeProgram compileProgram(ServiceProvider provider, DebuggerCoordinates coordinates, String sourceName, String source, PcodeUseropLibrary<?> library)
      Compile the given Sleigh source into a p-code program, resolving user labels

      The resulting program must only be used with a state bound to the same coordinates. Any symbols which are resolved to labels in the trace or its mapped programs are effectively substituted for their offsets. If a label moves, the program should be recompiled in order to update those substitutions.

      Parameters:
      provider - the service provider (usually the tool)
      coordinates - the coordinates for the trace (and programs) from which labels can be resolved
      See Also:
    • compileExpression

      public static PcodeExpression compileExpression(ServiceProvider provider, DebuggerCoordinates coordinates, String source)
      Compile the given Sleigh expression into a p-code program, resolving user labels

      This has the same limitations as compileProgram(ServiceProvider, DebuggerCoordinates, String, String, PcodeUseropLibrary)

      See Also:
    • executorStateForCoordinates

      public static PcodeExecutorState<byte[]> executorStateForCoordinates(ServiceProvider provider, DebuggerCoordinates coordinates)
      Get a p-code executor state for the given coordinates

      If a thread is included, the executor state will have access to both the memory and registers in the context of that thread. Otherwise, only memory access is permitted.

      Parameters:
      provider - the service provider (usually the tool)
      coordinates - the coordinates
      Returns:
      the state
    • executorForCoordinates

      public static PcodeExecutor<byte[]> executorForCoordinates(ServiceProvider provider, DebuggerCoordinates coordinates)
      Get an executor which can be used to evaluate Sleigh expressions at the given coordinates

      If a thread is included, the executor will have access to both the memory and registers in the context of that thread. Otherwise, only memory access is permitted.

      Parameters:
      provider - the service provider (usually the tool)
      coordinates - the coordinates
      Returns:
      the executor
    • buildWatchState

      public static DebuggerPcodeUtils.WatchValuePcodeExecutorState buildWatchState(ServiceProvider provider, DebuggerCoordinates coordinates)
    • buildWatchExecutor

      public static PcodeExecutor<DebuggerPcodeUtils.WatchValue> buildWatchExecutor(ServiceProvider provider, DebuggerCoordinates coordinates)
      Build an executor that can compute watch values

      This computes the concrete value, its state, its address, and the set of physical addresses involved in the computation. CAUTION: This executor's state will attempt to read live machine state, if applicable. Use the executor in a background thread to avoid locking the GUI.

      Parameters:
      provider - the service provider (usually the tool)
      coordinates - the coordinates providing context for the evaluation
      Returns:
      an executor for evaluating the watch