ROSE  0.11.145.0
Public Member Functions | List of all members
Rose::BinaryAnalysis::CallingConvention::Analysis Class Reference

Description

Function calling convention.

This class encapsulates all information about calling conventions including the analysis functions and the data types.

Definition at line 533 of file CallingConvention.h.

#include <Rose/BinaryAnalysis/CallingConvention.h>

Public Member Functions

 Analysis ()
 Default constructor. More...
 
 Analysis (const Disassembler::BasePtr &)
 Construct an analyzer using a specified disassembler. More...
 
 Analysis (const InstructionSemantics::BaseSemantics::DispatcherPtr &)
 Construct an analysis using a specified dispatcher. More...
 
void analyzeFunction (const Partitioner2::PartitionerConstPtr &, const Sawyer::SharedPointer< Partitioner2::Function > &)
 Analyze one function. More...
 
bool hasResults () const
 Whether a function has been analyzed. More...
 
bool didConverge () const
 Whether the analysis results are valid. More...
 
void clearResults ()
 Clear analysis results. More...
 
void clearNonResults ()
 Clears everything but results. More...
 
const RegisterPartscalleeSavedRegisters () const
 Callee-saved registers. More...
 
const RegisterPartsinputRegisters () const
 Input registers. More...
 
const RegisterPartsoutputRegisters () const
 Output registers. More...
 
const Variables::StackVariablesinputStackParameters () const
 Input stack parameters. More...
 
const Variables::StackVariablesoutputStackParameters () const
 Output stack parameters. More...
 
Sawyer::Optional< int64_t > stackDelta () const
 Concrete stack delta. More...
 
bool match (const Definition::Ptr &) const
 Determine whether a definition matches. More...
 
Dictionary match (const Dictionary &) const
 Find matching calling convention definitions. More...
 
void print (std::ostream &, bool multiLine=false) const
 Print information about the analysis results. More...
 
Definition::Ptr defaultCallingConvention () const
 Property: Default calling convention. More...
 
void defaultCallingConvention (const Definition::Ptr &x)
 Property: Default calling convention. More...
 
RegisterDictionaryPtr registerDictionary () const
 Property: Register dictionary. More...
 
void registerDictionary (const RegisterDictionaryPtr &d)
 Property: Register dictionary. More...
 

Constructor & Destructor Documentation

Rose::BinaryAnalysis::CallingConvention::Analysis::Analysis ( )

Default constructor.

This creates an analyzer that is not suitable for analysis since it doesn't know anything about the architecture it would be analyzing. This is mostly for use in situations where an analyzer must be constructed as a member of another class's default constructor, in containers that initialize their contents with a default constructor, etc.

Rose::BinaryAnalysis::CallingConvention::Analysis::Analysis ( const Disassembler::BasePtr )
explicit

Construct an analyzer using a specified disassembler.

This constructor chooses a symbolic domain and a dispatcher appropriate for the disassembler's architecture.

Rose::BinaryAnalysis::CallingConvention::Analysis::Analysis ( const InstructionSemantics::BaseSemantics::DispatcherPtr )
explicit

Construct an analysis using a specified dispatcher.

This constructor uses the supplied dispatcher and associated semantic domain. For best results, the semantic domain should be a symbolic domain that uses MemoryCellList and RegisterStateGeneric. These happen to also be the defaults used by InstructionSemantics::SymbolicSemantics.

Member Function Documentation

Definition::Ptr Rose::BinaryAnalysis::CallingConvention::Analysis::defaultCallingConvention ( ) const
inline

Property: Default calling convention.

The data-flow portion of the analysis uses analysis results previously computed for called functions. If a called function has no previous analysis result then a default calling convention can be specified for this property and that convention's definition determines how the called function modifies the current function's data-flow state.

Definition at line 598 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Analysis::defaultCallingConvention ( const Definition::Ptr x)
inline

Property: Default calling convention.

The data-flow portion of the analysis uses analysis results previously computed for called functions. If a called function has no previous analysis result then a default calling convention can be specified for this property and that convention's definition determines how the called function modifies the current function's data-flow state.

Definition at line 599 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Analysis::analyzeFunction ( const Partitioner2::PartitionerConstPtr ,
const Sawyer::SharedPointer< Partitioner2::Function > &   
)

Analyze one function.

This analysis method uses Partitioner2 data structures which are generally faster than using the AST. The specified function need not be attached to the partitioner. Results of the analysis are stored in this analysis object to be queried after the analysis completes.

bool Rose::BinaryAnalysis::CallingConvention::Analysis::hasResults ( ) const
inline

Whether a function has been analyzed.

Returns true if this analysis object holds results from analyzing a function. The results might be only approximations depending on whether didConverge also returns true.

Definition at line 613 of file CallingConvention.h.

bool Rose::BinaryAnalysis::CallingConvention::Analysis::didConverge ( ) const
inline

Whether the analysis results are valid.

Returns true if hasResults is true and the analysis converged to a solution. If the analysis did not converge then the other results are only approximations.

Definition at line 619 of file CallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Analysis::clearResults ( )

Clear analysis results.

Resets the analysis results so it looks like this analyzer is initialized but has not run yet. When this method returns, hasResults and didConverge will both retun false.

void Rose::BinaryAnalysis::CallingConvention::Analysis::clearNonResults ( )

Clears everything but results.

This resets the virtual CPU to the null pointer, possibly freeing some memory if the CPU isn't being used for other things. Once the CPU is removed it's no longer possible to do more analysis.

RegisterDictionaryPtr Rose::BinaryAnalysis::CallingConvention::Analysis::registerDictionary ( ) const

Property: Register dictionary.

The register dictionary provides names for register parts. If a dictionary is provided before analyzeFunction is called then that dictionary is used if possible, otherwise analyzeFunction assigns a new dictionary. In any case, this property is non-null after a call to analyzeFunction.

void Rose::BinaryAnalysis::CallingConvention::Analysis::registerDictionary ( const RegisterDictionaryPtr d)

Property: Register dictionary.

The register dictionary provides names for register parts. If a dictionary is provided before analyzeFunction is called then that dictionary is used if possible, otherwise analyzeFunction assigns a new dictionary. In any case, this property is non-null after a call to analyzeFunction.

const RegisterParts& Rose::BinaryAnalysis::CallingConvention::Analysis::calleeSavedRegisters ( ) const
inline

Callee-saved registers.

Returns the set of registers that are accessed by the function but which are also reset to their original values before the function returns. A callee-saved register will not be included in the set of input or output registers.

Definition at line 648 of file CallingConvention.h.

const RegisterParts& Rose::BinaryAnalysis::CallingConvention::Analysis::inputRegisters ( ) const
inline

Input registers.

Returns the set of registers that the function uses as input values. These are the registers that the function reads without first writing and which the function does not restore before returning.

Definition at line 654 of file CallingConvention.h.

const RegisterParts& Rose::BinaryAnalysis::CallingConvention::Analysis::outputRegisters ( ) const
inline

Output registers.

Returns the set of registers into which the function writes potential return values. These are the registers to which the function writes with no following read. An output register is not also a calle-saved register.

Definition at line 660 of file CallingConvention.h.

const Variables::StackVariables& Rose::BinaryAnalysis::CallingConvention::Analysis::inputStackParameters ( ) const
inline

Input stack parameters.

Locations for stack-based parameters that are used as inputs to the function.

Definition at line 665 of file CallingConvention.h.

const Variables::StackVariables& Rose::BinaryAnalysis::CallingConvention::Analysis::outputStackParameters ( ) const
inline

Output stack parameters.

Locations for stack-based parameters that are used as outputs of the function.

Definition at line 670 of file CallingConvention.h.

Sawyer::Optional<int64_t> Rose::BinaryAnalysis::CallingConvention::Analysis::stackDelta ( ) const
inline

Concrete stack delta.

This is the amount added to the stack pointer by the function. For caller-cleanup this is usually just the size of the non-parameter area (the return address). Stack deltas are measured in bytes.

Definition at line 676 of file CallingConvention.h.

bool Rose::BinaryAnalysis::CallingConvention::Analysis::match ( const Definition::Ptr ) const

Determine whether a definition matches.

Returns true if the specified definition is compatible with the results of this analysis.

Dictionary Rose::BinaryAnalysis::CallingConvention::Analysis::match ( const Dictionary ) const

Find matching calling convention definitions.

Given an ordered list of calling convention definitons (a calling convention dictionary) return a list of definitions that is consistent with the results of this analysis. The definitions in the returned list are in the same order as those in the specified dictionary.

void Rose::BinaryAnalysis::CallingConvention::Analysis::print ( std::ostream &  ,
bool  multiLine = false 
) const

Print information about the analysis results.

The output is a single line of comma-separated values if multiLine is true. Otherwise, the top-level commas are replaced by linefeeds.


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