decompiler  1.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
StructureGraph Class Reference

Command to structure a control-flow graph. More...

#include <ghidra_process.hh>

Inheritance diagram for StructureGraph:
GhidraCommand

Public Member Functions

virtual void rawAction (void)
 Perform the action of the command. More...
 
- Public Member Functions inherited from GhidraCommand
 GhidraCommand (void)
 Construct given i/o streams.
 
virtual ~GhidraCommand (void)
 Destructor.
 
int4 doit (void)
 Configure and execute the command, then send back results. More...
 

Private Member Functions

virtual void loadParameters (void)
 Read parameters directing command execution. More...
 

Private Attributes

BlockGraph ingraph
 The control-flow graph to structure.
 

Additional Inherited Members

- Protected Member Functions inherited from GhidraCommand
virtual void sendResult (void)
 Send results of the command (if any) back to the Ghidra client. More...
 
- Protected Attributes inherited from GhidraCommand
istream & sin
 The input stream from the Ghidra client.
 
ostream & sout
 The output stream to the Ghidra client.
 
ArchitectureGhidraghidra
 The Architecture on which to perform the command.
 
int4 status
 Meta-command to system (0=wait for next command, 1=terminate process)
 

Detailed Description

Command to structure a control-flow graph.

An arbitrary control-flow is sent as a <block> tag, with nested <block>, <bhead>, and <edge> sub-tags. The decompiler structures the control-flow using standard structured code elements: if/else, loops, switches, etc. The resulting structure information is returned to the client as an XML document.

The command expects 2 string parameters. The first is the encoded integer id of a program in which we assume the control-flow graph lives. The second is the XML description of the control-flow.

Member Function Documentation

◆ loadParameters()

void StructureGraph::loadParameters ( void  )
privatevirtual

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 from GhidraCommand.

References GhidraCommand::ghidra, ingraph, GhidraCommand::loadParameters(), ArchitectureGhidra::readXMLStream(), BlockGraph::restoreXml(), and GhidraCommand::sin.

◆ rawAction()

void StructureGraph::rawAction ( void  )
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.

Implements GhidraCommand.

References BlockGraph::buildCopy(), BlockGraph::calcForwardDominator(), CollapseStructure::collapseAll(), ingraph, BlockGraph::orderBlocks(), FlowBlock::saveXml(), GhidraCommand::sout, and BlockGraph::structureLoops().


The documentation for this class was generated from the following files: