Package ghidra.app.decompiler
Class DecompileProcess
java.lang.Object
ghidra.app.decompiler.DecompileProcess
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Free decompiler resourcesvoid
dispose()
boolean
isReady()
void
registerProgram
(DecompileCallback cback, String pspecxml, String cspecxml, String tspecxml, String coretypesxml, Program program) Initialize decompiler for a particular platformvoid
sendCommand
(String command, ByteIngest response) Send a single command to the decompiler with no parameters and return responsevoid
sendCommand1Param
(String command, CachedEncoder param1, ByteIngest response) Send a command to the decompiler with one parameter and return the resultvoid
sendCommand1Param
(String command, String param1, ByteIngest response) Send a command to the decompiler with one parameter and return the resultvoid
sendCommand2Params
(String command, String param1, String param2, ByteIngest response) Send a command with 2 parameters to the decompiler and read the resultvoid
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.
-
Constructor Details
-
DecompileProcess
-
-
Method Details
-
dispose
public void dispose() -
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 decompilerpspecxml
- = string containing .pspec xmlcspecxml
- = string containing .cspec xmltspecxml
- = XML string containing translator speccoretypesxml
- = XML description of core data-typesprogram
- is the program being registered- Throws:
IOException
- for problems with the pipe to the decompiler processDecompileException
- for problems executing the command
-
deregisterProgram
Free decompiler resources- Returns:
- 1 if a program was actively deregistered, 0 otherwise
- Throws:
IOException
- for problems with the pipe to the decompilerDecompileException
- for problems executing the command
-
sendCommand
Send a single command to the decompiler with no parameters and return response- Parameters:
command
- is the name of the command to executeresponse
- the response accumulator- Throws:
IOException
- for any problems with the pipe to the decompiler processDecompileException
- 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 executetimeoutSecs
- the number of seconds to run before timing outencodeSet
- contains encoded parameters and the response container- Throws:
IOException
- for any problems with the pipe to the decompiler processDecompileException
- 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 sendparam1
- is the first parameter stringparam2
- is the second parameter stringresponse
- the response accumulator- Throws:
IOException
- for any problems with the pipe to the decompiler processDecompileException
- 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, CachedEncoder param1, ByteIngest response) throws IOException, DecompileException Send a command to the decompiler with one parameter and return the result- Parameters:
command
- is the command stringparam1
- is the encoded parameterresponse
- is the result accumulator- Throws:
IOException
- for problems with the pipe to the decompiler processDecompileException
- 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 stringparam1
- is the parameter encoded as a stringresponse
- is the result accumulator- Throws:
IOException
- for problems with the pipe to the decompiler processDecompileException
- for problems executing the command
-