Package ghidra.app.decompiler
Class DecompileProcess
- java.lang.Object
-
- ghidra.app.decompiler.DecompileProcess
-
public class DecompileProcess extends java.lang.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 class
DecompileProcess.DisposeState
-
Constructor Summary
Constructors Constructor Description DecompileProcess(java.lang.String path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
deregisterProgram()
Free decompiler resourcesvoid
dispose()
DecompileProcess.DisposeState
getDisposeState()
boolean
isReady()
void
registerProgram(DecompileCallback cback, java.lang.String pspecxml, java.lang.String cspecxml, java.lang.String tspecxml, java.lang.String coretypesxml)
Initialize decompiler for a particular platformLimitedByteBuffer
sendCommand(java.lang.String command)
Send a single command to the decompiler with no parameters and return responseLimitedByteBuffer
sendCommand1Param(java.lang.String command, java.lang.String param1)
Send a command to the decompiler with one parameter and return the resultLimitedByteBuffer
sendCommand1ParamTimeout(java.lang.String command, java.lang.String param, int timeoutSecs)
LimitedByteBuffer
sendCommand2Params(java.lang.String command, java.lang.String param1, java.lang.String param2)
Send a command with 2 parameters to the decompiler and read the resultvoid
setMaxResultSize(int maxResultSizeMBytes)
-
-
-
Method Detail
-
dispose
public void dispose()
-
getDisposeState
public DecompileProcess.DisposeState getDisposeState()
-
registerProgram
public void registerProgram(DecompileCallback cback, java.lang.String pspecxml, java.lang.String cspecxml, java.lang.String tspecxml, java.lang.String coretypesxml) throws java.io.IOException, DecompileException
Initialize decompiler for a particular platform- Parameters:
cback
- = callback object for decompilerpspecxml
- = string containing .pspec xmlcspecxml
- = string containing .cspec xmltspecxml
- = XML string containing translator speccoretypesxml
- = XML description of core data-types- Throws:
java.io.IOException
- for problems with the pipe to the decompiler processDecompileException
- for problems executing the command
-
deregisterProgram
public int deregisterProgram() throws java.io.IOException, DecompileException
Free decompiler resources- Returns:
- 1 if a program was actively deregistered, 0 otherwise
- Throws:
java.io.IOException
- for problems with the pipe to the decompilerDecompileException
- for problems executing the command
-
sendCommand
public LimitedByteBuffer sendCommand(java.lang.String command) throws java.io.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- Returns:
- the response String
- Throws:
java.io.IOException
- for any problems with the pipe to the decompiler processDecompileException
- for any problems executing the command
-
isReady
public boolean isReady()
-
sendCommand1ParamTimeout
public LimitedByteBuffer sendCommand1ParamTimeout(java.lang.String command, java.lang.String param, int timeoutSecs) throws java.io.IOException, DecompileException
- Parameters:
command
- the decompiler should executeparam
- an additional parameter for the commandtimeoutSecs
- the number of seconds to run before timing out- Returns:
- the response string
- Throws:
java.io.IOException
- for any problems with the pipe to the decompiler processDecompileException
- for any problems while executing the command
-
sendCommand2Params
public LimitedByteBuffer sendCommand2Params(java.lang.String command, java.lang.String param1, java.lang.String param2) throws java.io.IOException, DecompileException
Send a command with 2 parameters to the decompiler and read the result- Parameters:
command
- string to sendparam1
- is the first parameter stringparam2
- is the second parameter string- Returns:
- the result string
- Throws:
java.io.IOException
- for any problems with the pipe to the decompiler processDecompileException
- for problems executing the command
-
setMaxResultSize
public void setMaxResultSize(int maxResultSizeMBytes)
-
sendCommand1Param
public LimitedByteBuffer sendCommand1Param(java.lang.String command, java.lang.String param1) throws java.io.IOException, DecompileException
Send a command to the decompiler with one parameter and return the result- Parameters:
command
- is the command stringparam1
- is the parameter as a string- Returns:
- the result string
- Throws:
java.io.IOException
- for problems with the pipe to the decompiler processDecompileException
- for problems executing the command
-
-