ROSE 0.11.145.192
|
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 RegisterParts & | calleeSavedRegisters () const |
Callee-saved registers. | |
const RegisterParts & | inputRegisters () const |
Input registers. | |
const RegisterParts & | outputRegisters () const |
Output registers. | |
const Variables::StackVariables & | inputStackParameters () const |
Input stack parameters. | |
const Variables::StackVariables & | outputStackParameters () 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. | |
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.
|
explicit |
Construct an analyzer using a specified disassembler.
This constructor chooses a symbolic domain and a dispatcher appropriate for the disassembler's architecture.
|
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.
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.
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.
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.
|
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.
|
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.
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
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.
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.