decompiler
1.0.0
|
Base class for a command to the decompiler as issued by a Ghidra client. More...
#include <ghidra_process.hh>
Public Member Functions | |
GhidraCommand (void) | |
Construct given i/o streams. | |
virtual | ~GhidraCommand (void) |
Destructor. | |
virtual void | rawAction (void)=0 |
Perform the action of the command. More... | |
int4 | doit (void) |
Configure and execute the command, then send back results. More... | |
Protected Member Functions | |
virtual void | loadParameters (void) |
Read parameters directing command execution. More... | |
virtual void | sendResult (void) |
Send results of the command (if any) back to the Ghidra client. More... | |
Protected Attributes | |
istream & | sin |
The input stream from the Ghidra client. | |
ostream & | sout |
The output stream to the Ghidra client. | |
ArchitectureGhidra * | ghidra |
The Architecture on which to perform the command. | |
int4 | status |
Meta-command to system (0=wait for next command, 1=terminate process) | |
Base class for a command to the decompiler as issued by a Ghidra client.
A command object is provided i/o streams to the client, and the action of the command is performed by calling the doit() method. This wraps the main sequence of methods:
At a minimum, loadParameters() will read an id to select the active ArchitectureGhidra object, and sendResult() will send back any accumulated warning/error messages.
int4 GhidraCommand::doit | ( | void | ) |
Configure and execute the command, then send back results.
This method calls the main overloaded methods:
It wraps the sequence with appropriate error handling and message protocol.
References LowlevelError::explain, XmlError::explain, ghidra, loadParameters(), ArchitectureGhidra::passJavaException(), ArchitectureGhidra::printMessage(), rawAction(), ArchitectureGhidra::readToAnyBurst(), sendResult(), sin, sout, status, and JavaError::type.
|
protectedvirtual |
Read parameters directing command execution.
This method reads an id selecting the Architecture to act on, but it can be overloaded to read any set of data from the Ghidra client to configure how the command is executed. Individual parameters are read using the method protocol.
Reimplemented in SetOptions, SetAction, StructureGraph, DecompileAt, DeregisterProgram, and RegisterProgram.
References ArchitectureGhidra::clearWarnings(), ghidra, ArchitectureGhidra::readToAnyBurst(), and sin.
Referenced by doit(), DecompileAt::loadParameters(), StructureGraph::loadParameters(), SetAction::loadParameters(), and SetOptions::loadParameters().
|
pure virtual |
Perform the action of the command.
Configuration is assumed to have happened, and this object can immediately begin examining and manipulating data under the active Architecture object to perform the command.
Implemented in SetOptions, SetAction, StructureGraph, DecompileAt, FlushNative, DeregisterProgram, and RegisterProgram.
Referenced by doit().
|
protectedvirtual |
Send results of the command (if any) back to the Ghidra client.
This method sends any warnings accumulated during execution back, but it can be overloaded to send back any kind of information. Individual records are sent using the message protocol.
Reimplemented in SetOptions, SetAction, FlushNative, DeregisterProgram, and RegisterProgram.
References ArchitectureGhidra::getWarnings(), ghidra, and sout.
Referenced by doit(), RegisterProgram::sendResult(), DeregisterProgram::sendResult(), FlushNative::sendResult(), SetAction::sendResult(), and SetOptions::sendResult().