ROSE 0.11.145.192
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 19 of file CallingConvention/Analysis.h.

#include <Rose/BinaryAnalysis/CallingConvention/Analysis.h>

Public Member Functions

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

Constructor & Destructor Documentation

◆ Analysis() [1/3]

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.

◆ Analysis() [2/3]

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.

◆ Analysis() [3/3]

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

◆ defaultCallingConvention() [1/2]

DefinitionPtr Rose::BinaryAnalysis::CallingConvention::Analysis::defaultCallingConvention ( ) const

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.

◆ defaultCallingConvention() [2/2]

void Rose::BinaryAnalysis::CallingConvention::Analysis::defaultCallingConvention ( const DefinitionPtr )

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.

◆ analyzeFunction()

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.

◆ hasResults()

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 99 of file CallingConvention/Analysis.h.

◆ didConverge()

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 105 of file CallingConvention/Analysis.h.

◆ clearResults()

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.

◆ clearNonResults()

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.

◆ registerDictionary() [1/2]

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.

◆ registerDictionary() [2/2]

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.

◆ calleeSavedRegisters()

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 134 of file CallingConvention/Analysis.h.

◆ inputRegisters()

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 140 of file CallingConvention/Analysis.h.

◆ outputRegisters()

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 146 of file CallingConvention/Analysis.h.

◆ inputStackParameters()

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 151 of file CallingConvention/Analysis.h.

◆ outputStackParameters()

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 156 of file CallingConvention/Analysis.h.

◆ stackDelta()

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 162 of file CallingConvention/Analysis.h.

◆ match() [1/2]

bool Rose::BinaryAnalysis::CallingConvention::Analysis::match ( const DefinitionPtr ) const

Determine whether a definition matches.

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

◆ match() [2/2]

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.

◆ print()

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: