decompiler 1.0.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
IfaceDecompCommand Class Reference

Root class for all decompiler specific commands. More...

#include <ifacedecomp.hh>

Inheritance diagram for IfaceDecompCommand:
IfaceCommand IfcAddrrangeLoad IfcAdjustVma IfcAnalyzeRange IfcBreakaction IfcBreakstart IfcCallFixup IfcCallGraphBuild IfcCallGraphDump IfcCallGraphList IfcCallGraphLoad IfcCallOtherFixup IfcCleararch IfcComment IfcCommentInstr IfcContinue IfcCountPcode IfcDeadcodedelay IfcDecompile IfcDump IfcDumpbinary IfcDuplicateHash IfcExecuteTestCommand IfcFlowOverride IfcForceDec IfcForceHex IfcForcegoto IfcFuncload IfcGlobalAdd IfcGlobalRegisters IfcGlobalRemove IfcGlobalify IfcGraphControlflow IfcGraphDataflow IfcGraphDom IfcJumpOverride IfcListOverride IfcListTestCommands IfcListaction IfcListprototypes IfcLoadTestFile IfcLockPrototype IfcMapaddress IfcMapconvert IfcMapexternalref IfcMapfunction IfcMaphash IfcMaplabel IfcNameVarnode IfcOption IfcParseFile IfcParseLine IfcPointerSetting IfcPreferSplit IfcPrintActionstats IfcPrintBlocktree IfcPrintCFlat IfcPrintCGlobals IfcPrintCStruct IfcPrintCTypes IfcPrintCXml IfcPrintCover IfcPrintExtrapop IfcPrintHigh IfcPrintInputs IfcPrintInputsAll IfcPrintLanguage IfcPrintLocalrange IfcPrintMap IfcPrintParamMeasures IfcPrintRaw IfcPrintSpaces IfcPrintTree IfcPrintVarnode IfcPrintdisasm IfcProduceC IfcProducePrototypes IfcProtooverride IfcReadSymbols IfcReadonly IfcRemove IfcRename IfcResetActionstats IfcRetype IfcSetcontextrange IfcSettrackedrange IfcSource IfcStructureBlocks IfcTypeVarnode IfcUnlockPrototype IfcVarnodeCover IfcVarnodehighCover IfcVolatile

Public Member Functions

virtual void setData (IfaceStatus *root, IfaceData *data)
 Associate a specific data object with this command. More...
 
virtual string getModule (void) const
 Get the formal module name to which this command belongs. More...
 
virtual IfaceDatacreateData (void)
 Create a specialized data object for this command (and its module) More...
 
virtual void iterationCallback (Funcdata *fd)
 Perform the per-function aspect of this command. More...
 
void iterateFunctionsAddrOrder (void)
 Iterate command over all functions in all scopes. More...
 
void iterateFunctionsLeafOrder (void)
 Iterate command over all functions in a call-graph traversal. More...
 
- Public Member Functions inherited from IfaceCommand
virtual ~IfaceCommand (void)
 Destructor.
 
virtual void setData (IfaceStatus *root, IfaceData *data)=0
 Associate a specific data object with this command. More...
 
virtual void execute (istream &s)=0
 
virtual string getModule (void) const =0
 Get the formal module name to which this command belongs. More...
 
virtual IfaceDatacreateData (void)=0
 Create a specialized data object for this command (and its module) More...
 
void addWord (const string &temp)
 Add a token to the command line string associated with this command. More...
 
void removeWord (void)
 Remove the last token from the associated command line string.
 
const string & getCommandWord (int4 i) const
 Get the i-th command token.
 
void addWords (const vector< string > &wordlist)
 Add words to the associated command line string.
 
int4 numWords (void) const
 Return the number of tokens in the command line string.
 
void commandString (string &res) const
 Get the complete command line string. More...
 
int4 compare (const IfaceCommand &op2) const
 Order two commands by their command line strings. More...
 

Protected Member Functions

void iterateScopesRecursive (Scope *scope)
 Iterate recursively over all functions in given scope. More...
 
void iterateFunctionsAddrOrder (Scope *scope)
 Iterate over all functions in a given scope. More...
 

Protected Attributes

IfaceStatusstatus
 The console owning this command.
 
IfaceDecompDatadcp
 Data common to decompiler commands.
 

Detailed Description

Root class for all decompiler specific commands.

Commands share the data object IfaceDecompData and are capable of iterating over all functions in the program/architecture.

Member Function Documentation

◆ createData()

virtual IfaceData * IfaceDecompCommand::createData ( void  )
inlinevirtual

Create a specialized data object for this command (and its module)

This method is only called once per module

Returns
the newly created data object for the module

Implements IfaceCommand.

◆ getModule()

virtual string IfaceDecompCommand::getModule ( void  ) const
inlinevirtual

Get the formal module name to which this command belongs.

Commands in the same module share data through their registered IfaceData object

Returns
the formal module name

Implements IfaceCommand.

◆ iterateFunctionsAddrOrder() [1/2]

void IfaceDecompCommand::iterateFunctionsAddrOrder ( Scope scope)
protected

Iterate over all functions in a given scope.

Runs over every function in the scope calling iterationCallback().

Parameters
scopeis the given scope

References Scope::begin(), Scope::end(), FunctionSymbol::getFunction(), and iterationCallback().

◆ iterateFunctionsAddrOrder() [2/2]

void IfaceDecompCommand::iterateFunctionsAddrOrder ( void  )

Iterate command over all functions in all scopes.

Scopes are traversed depth-first, then within a scope, functions are traversed in address order.

References IfaceDecompData::conf, dcp, Database::getGlobalScope(), iterateScopesRecursive(), and Architecture::symboltab.

Referenced by IfcProduceC::execute(), IfcPrintInputsAll::execute(), IfcDuplicateHash::execute(), IfcCallGraphBuild::execute(), IfcCallGraphBuildQuick::execute(), and iterateScopesRecursive().

◆ iterateFunctionsLeafOrder()

void IfaceDecompCommand::iterateFunctionsLeafOrder ( void  )

Iterate command over all functions in a call-graph traversal.

Traversal is based on the current CallGraph for the program. Child functions are traversed before their parents.

References IfaceDecompData::cgraph, IfaceDecompData::conf, dcp, and iterationCallback().

Referenced by IfcProducePrototypes::execute(), and IfcCallGraphList::execute().

◆ iterateScopesRecursive()

void IfaceDecompCommand::iterateScopesRecursive ( Scope scope)
protected

Iterate recursively over all functions in given scope.

Runs over every function in the scope, or any sub-scope , calling iterationCallback()

Parameters
scopeis the given scope

References Scope::childrenBegin(), Scope::childrenEnd(), Scope::isGlobal(), iterateFunctionsAddrOrder(), and iterateScopesRecursive().

Referenced by iterateFunctionsAddrOrder(), and iterateScopesRecursive().

◆ iterationCallback()

virtual void IfaceDecompCommand::iterationCallback ( Funcdata fd)
inlinevirtual

Perform the per-function aspect of this command.

Parameters
fdis the particular function to operate on

Reimplemented in IfcProduceC, IfcProducePrototypes, IfcPrintInputsAll, IfcDuplicateHash, IfcCallGraphBuild, and IfcCallGraphList.

Referenced by iterateFunctionsAddrOrder(), and iterateFunctionsLeafOrder().

◆ setData()

virtual void IfaceDecompCommand::setData ( IfaceStatus root,
IfaceData data 
)
inlinevirtual

Associate a specific data object with this command.

Parameters
rootis the interface object this command is registered with
datais the data object the command should use

Implements IfaceCommand.

References dcp, and status.


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