Package ghidra.app.decompiler

# Class DecompileProcess

java.lang.Object
ghidra.app.decompiler.DecompileProcess

public class DecompileProcess extends Object
Class for communicating with a single decompiler process. The process controls decompilation for a single Program. The process is initiated by the registerProgram method. If the process is ready, the statusGood flag will be set to true. This flag must be checked via the isReady method prior to invoking any of the public methods. If the process isn't ready, the only way to recover is by reissuing the registerProgram call and making any other necessary initialization calls.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `DecompileProcess.DisposeState`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DecompileProcess(String path)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `deregisterProgram()`
  Free decompiler resources
  `void`
  `dispose()`
  `DecompileProcess.DisposeState`
  `getDisposeState()`
  `boolean`
  `isReady()`
  `void`
  `registerProgram(DecompileCallback cback, String pspecxml, String cspecxml, String tspecxml, String coretypesxml, Program program)`
  Initialize decompiler for a particular platform
  `void`
  `sendCommand(String command, ByteIngest response)`
  Send a single command to the decompiler with no parameters and return response
  `void`
  `sendCommand1Param(String command, Encoder param1, ByteIngest response)`
  Send a command to the decompiler with one parameter and return the result
  `void`
  `sendCommand1Param(String command, String param1, ByteIngest response)`
  Send a command to the decompiler with one parameter and return the result
  `void`
  `sendCommand2Params(String command, String param1, String param2, ByteIngest response)`
  Send a command with 2 parameters to the decompiler and read the result
  `void`
  `sendCommandTimeout(String command, int timeoutSecs, DecompInterface.EncodeDecodeSet encodeSet)`
  Execute a command with a timeout.
  `void`
  `setMaxResultSize(int maxResultSizeMBytes)`
  Set an upper limit on the amount of data that can be sent back by the decompiler in response to a single command.

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

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

- ## Constructor Details

  - ### DecompileProcess

    public DecompileProcess(String path)

- ## Method Details

  - ### dispose

    public void dispose()

  - ### getDisposeState

    public DecompileProcess.DisposeState getDisposeState()

  - ### registerProgram

    public void registerProgram(DecompileCallback cback, String pspecxml, String cspecxml, String tspecxml, String coretypesxml, Program program) throws IOException, DecompileException
    Initialize decompiler for a particular platform
    Parameters:
      `cback` - = callback object for decompiler
      `pspecxml` - = string containing .pspec xml
      `cspecxml` - = string containing .cspec xml
      `tspecxml` - = XML string containing translator spec
      `coretypesxml` - = XML description of core data-types
      `program` - is the program being registered
    Throws:
      `IOException` - for problems with the pipe to the decompiler process
      `DecompileException` - for problems executing the command

  - ### deregisterProgram

    public int deregisterProgram() throws IOException, DecompileException
    Free decompiler resources
    Returns:
      1 if a program was actively deregistered, 0 otherwise
    Throws:
      `IOException` - for problems with the pipe to the decompiler
      `DecompileException` - for problems executing the command

  - ### sendCommand

    public void sendCommand(String command, ByteIngest response) throws IOException, DecompileException
    Send a single command to the decompiler with no parameters and return response
    Parameters:
      `command` - is the name of the command to execute
      `response` - the response accumulator
    Throws:
      `IOException` - for any problems with the pipe to the decompiler process
      `DecompileException` - for any problems executing the command

  - ### isReady

    public boolean isReady()

  - ### sendCommandTimeout

    public void sendCommandTimeout(String command, int timeoutSecs, DecompInterface.EncodeDecodeSet encodeSet) throws IOException, DecompileException
    Execute a command with a timeout. Parameters are in the encodingSet.mainQuery. The response gets written to encodingSet.mainResponse.
    Parameters:
      `command` - the decompiler should execute
      `timeoutSecs` - the number of seconds to run before timing out
      `encodeSet` - contains encoded parameters and the response container
    Throws:
      `IOException` - for any problems with the pipe to the decompiler process
      `DecompileException` - for any problems while executing the command

  - ### sendCommand2Params

    public void sendCommand2Params(String command, String param1, String param2, ByteIngest response) throws IOException, DecompileException
    Send a command with 2 parameters to the decompiler and read the result
    Parameters:
      `command` - string to send
      `param1` - is the first parameter string
      `param2` - is the second parameter string
      `response` - the response accumulator
    Throws:
      `IOException` - for any problems with the pipe to the decompiler process
      `DecompileException` - for problems executing the command

  - ### setMaxResultSize

    public void setMaxResultSize(int maxResultSizeMBytes)
    Set an upper limit on the amount of data that can be sent back by the decompiler in response to a single command.
    Parameters:
      `maxResultSizeMBytes` - is the maximum size in megabytes

  - ### sendCommand1Param

    public void sendCommand1Param(String command, Encoder param1, ByteIngest response) throws IOException, DecompileException
    Send a command to the decompiler with one parameter and return the result
    Parameters:
      `command` - is the command string
      `param1` - is the encoded parameter
      `response` - is the result accumulator
    Throws:
      `IOException` - for problems with the pipe to the decompiler process
      `DecompileException` - for problems executing the command

  - ### sendCommand1Param

    public void sendCommand1Param(String command, String param1, ByteIngest response) throws IOException, DecompileException
    Send a command to the decompiler with one parameter and return the result
    Parameters:
      `command` - is the command string
      `param1` - is the parameter encoded as a string
      `response` - is the result accumulator
    Throws:
      `IOException` - for problems with the pipe to the decompiler process
      `DecompileException` - for problems executing the command