Package ghidra.pcode.exec

# Class PcodeExecutionException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
ghidra.pcode.exec.PcodeExecutionException

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `AccessPcodeExecutionException`, `ConcretionError`, `DecodePcodeExecutionException`, `InjectionErrorPcodeExecutionException`, `InterruptPcodeExecutionException`, `SuspendedPcodeExecutionException`

public class PcodeExecutionException extends RuntimeException
The base exception for all p-code execution errors

Exceptions caught by the executor that are not of this type are typically caught and wrapped, so that the frame can be recovered. The frame is important for diagnosing the error, because it records what the executor was doing. It essentially serves as the "line number" of the p-code program within the greater Java stack. Additionally, if execution of p-code is to resume, the frame must be recovered, and possibly stepped back one.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PcodeExecutionException(String message)`
  `PcodeExecutionException(String message, PcodeFrame frame)`
  `PcodeExecutionException(String message, PcodeFrame frame, Throwable cause)`
  Construct an execution exception
  `PcodeExecutionException(String message, Throwable cause)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PcodeFrame`
  `getFrame()`
  Get the frame at the time of the exception

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

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

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

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### PcodeExecutionException

    public PcodeExecutionException(String message, PcodeFrame frame, Throwable cause)
    Construct an execution exception

    The frame is often omitted at the throw site. The executor should catch the exception, fill in the frame, and re-throw it.

    Parameters:
      `message` - the message
      `frame` - if known, the frame at the time of the exception
      `cause` - the exception that caused this one

  - ### PcodeExecutionException

    public PcodeExecutionException(String message, PcodeFrame frame)

  - ### PcodeExecutionException

    public PcodeExecutionException(String message, Throwable cause)

  - ### PcodeExecutionException

    public PcodeExecutionException(String message)

- ## Method Details

  - ### getFrame

    public PcodeFrame getFrame()
    Get the frame at the time of the exception

    Note that the frame counter is advanced before execution of the p-code op. Thus, the counter often points to the op following the one which caused the exception. For a frame to be present and meaningful, the executor must intervene between the throw and the catch. In other words, if you're invoking the executor, you should always expect to see a frame. If you are implementing, e.g., a userop, then it is possible to catch an exception without frame information populated. You might instead retrieve the frame from the executor, if you have a handle to it.

    Returns:
      the frame, possibly `null`