decompiler  1.0.0
Public Member Functions | Static Public Member Functions | List of all members
ghidra::IfcPrintInputs Class Reference

Print info about the current function's input Varnodes: print inputs More...

Inheritance diagram for ghidra::IfcPrintInputs:
ghidra::IfaceDecompCommand ghidra::IfaceCommand

Public Member Functions

virtual void execute (istream &s)
 
- Public Member Functions inherited from ghidra::IfaceDecompCommand
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 ghidra::IfaceCommand
virtual ~IfaceCommand (void)
 Destructor.
 
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...
 

Static Public Member Functions

static bool nonTrivialUse (Varnode *vn)
 Check for non-trivial use of given Varnode. More...
 
static int4 checkRestore (Varnode *vn)
 Check if a Varnode is restored to its original input value. More...
 
static bool findRestore (Varnode *vn, Funcdata *fd)
 Check if storage is restored. More...
 
static void print (Funcdata *fd, ostream &s)
 Print information about function inputs. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ghidra::IfaceDecompCommand
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 inherited from ghidra::IfaceDecompCommand
IfaceStatusstatus
 The console owning this command.
 
IfaceDecompDatadcp
 Data common to decompiler commands.
 

Detailed Description

Print info about the current function's input Varnodes: print inputs

Member Function Documentation

◆ checkRestore()

int4 ghidra::IfcPrintInputs::checkRestore ( Varnode vn)
static

Check if a Varnode is restored to its original input value.

Look for any value flowing into the Varnode coming from anything other than an input Varnode with the same storage. The value can flow through a COPY, CAST, INDIRECT, or MULTIEQUAL

Parameters
vnis the given Varnode
Returns
0 if Varnode is restored, 1 otherwise

References ghidra::PcodeOp::code(), ghidra::CPUI_CAST, ghidra::CPUI_COPY, ghidra::CPUI_INDIRECT, ghidra::CPUI_MULTIEQUAL, ghidra::Varnode::getAddr(), ghidra::Varnode::getDef(), ghidra::PcodeOp::getIn(), ghidra::Varnode::getSize(), ghidra::Varnode::isInput(), ghidra::Varnode::isMark(), ghidra::Varnode::isWritten(), ghidra::PcodeOp::numInput(), and ghidra::Varnode::setMark().

◆ execute()

void ghidra::IfcPrintInputs::execute ( istream &  s)
virtual

Execute this command. Additional state can be read from the given command line stream. Otherwise, the command gets its data from its registered IfaceData object

Parameters
sis the input stream from the command line

Implements ghidra::IfaceCommand.

◆ findRestore()

bool ghidra::IfcPrintInputs::findRestore ( Varnode vn,
Funcdata fd 
)
static

Check if storage is restored.

For the given storage location, check that it is restored from its original input value.

Parameters
vnis the given storage location
fdis the function being analyzed

References ghidra::Funcdata::beginLoc(), ghidra::PcodeOp::code(), ghidra::CPUI_INDIRECT, ghidra::Funcdata::endLoc(), ghidra::Varnode::getAddr(), ghidra::Varnode::getDef(), ghidra::Varnode::hasNoDescend(), and ghidra::Varnode::isWritten().

◆ nonTrivialUse()

bool ghidra::IfcPrintInputs::nonTrivialUse ( Varnode vn)
static

Check for non-trivial use of given Varnode.

The use is non-trivial if it can be traced to any p-code operation except a COPY, CAST, INDIRECT, or MULTIEQUAL.

Parameters
vnis the given Varnode
Returns
true if there is a non-trivial use

References ghidra::Varnode::beginDescend(), ghidra::PcodeOp::code(), ghidra::CPUI_CAST, ghidra::CPUI_COPY, ghidra::CPUI_INDIRECT, ghidra::CPUI_MULTIEQUAL, ghidra::Varnode::endDescend(), ghidra::PcodeOp::getOut(), ghidra::Varnode::isMark(), and ghidra::Varnode::setMark().

◆ print()

void ghidra::IfcPrintInputs::print ( Funcdata fd,
ostream &  s 
)
static

Print information about function inputs.

For each input Varnode, print information about the Varnode, any explicit symbol it represents, and info about how the value is used.

Parameters
fdis the function
sis the output stream to write to

References ghidra::Funcdata::beginDef(), ghidra::Funcdata::endDef(), ghidra::Varnode::getHigh(), ghidra::Funcdata::getName(), ghidra::Symbol::getName(), ghidra::HighVariable::getSymbol(), ghidra::Varnode::input, ghidra::Funcdata::isHighOn(), and ghidra::Varnode::printRaw().

Referenced by ghidra::IfcPrintInputsAll::iterationCallback().


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