ROSE  0.9.9.109
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 774 of file BinaryCallingConvention.h.

#include <BinaryCallingConvention.h>

Public Member Functions

 Analysis ()
 Default constructor. More...
 
 Analysis (Disassembler *d)
 Construct an analyzer using a specified disassembler. More...
 
 Analysis (const InstructionSemantics2::BaseSemantics::DispatcherPtr &cpu)
 Construct an analysis using a specified dispatcher. More...
 
void analyzeFunction (const Partitioner2::Partitioner &, 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 StackVariablesinputStackParameters () const
 Input stack parameters. More...
 
const 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...
 
const RegisterDictionaryregisterDictionary () const
 Property: Register dictionary. More...
 
void registerDictionary (const RegisterDictionary *d)
 Property: Register dictionary. More...
 

Constructor & Destructor Documentation

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

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.

Definition at line 816 of file BinaryCallingConvention.h.

Rose::BinaryAnalysis::CallingConvention::Analysis::Analysis ( Disassembler d)
inlineexplicit

Construct an analyzer using a specified disassembler.

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

Definition at line 822 of file BinaryCallingConvention.h.

Rose::BinaryAnalysis::CallingConvention::Analysis::Analysis ( const InstructionSemantics2::BaseSemantics::DispatcherPtr cpu)
inlineexplicit

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 InstructionSemantics2::SymbolicSemantics.

Definition at line 833 of file BinaryCallingConvention.h.

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 843 of file BinaryCallingConvention.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 844 of file BinaryCallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Analysis::analyzeFunction ( const Partitioner2::Partitioner ,
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 858 of file BinaryCallingConvention.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 864 of file BinaryCallingConvention.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.

const RegisterDictionary* Rose::BinaryAnalysis::CallingConvention::Analysis::registerDictionary ( ) const
inline

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.

Definition at line 885 of file BinaryCallingConvention.h.

void Rose::BinaryAnalysis::CallingConvention::Analysis::registerDictionary ( const RegisterDictionary d)
inline

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.

Definition at line 886 of file BinaryCallingConvention.h.

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 893 of file BinaryCallingConvention.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 899 of file BinaryCallingConvention.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 905 of file BinaryCallingConvention.h.

const 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 910 of file BinaryCallingConvention.h.

const 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 915 of file BinaryCallingConvention.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 921 of file BinaryCallingConvention.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: