retdec
|
A storage of intermediate data when finding sequences of API calls. More...
#include <api_call_seq_data.h>
Public Member Functions | |
APICallSeqData (const APICallInfoSeq &info) | |
Constructs data from the given information. More... | |
APICallSeqData (const APICallSeqData &data) | |
Constructs data from data. More... | |
APICallSeqData & | operator= (const APICallSeqData &data) |
Assigns data into the current data. More... | |
bool | operator== (const APICallSeqData &other) const |
Returns true if this data equal the other data, false otherwise. More... | |
bool | operator!= (const APICallSeqData &other) const |
Returns true if this data differ from the other data, false otherwise. More... | |
bool | matches (ShPtr< CallExpr > call) const |
Returns true if call matches the currently set API call information, false otherwise. More... | |
void | apply (ShPtr< Statement > stmt, ShPtr< CallExpr > call) |
Applies call that occur in stmt. More... | |
bool | patternIsComplete () const |
Returns true if the pattern is complete, false otherwise. More... | |
ShPtr< Pattern > | getPattern () const |
Returns the current version of the built pattern. More... | |
bool | atEnd () const |
Returns true if all the API call information passed to the constructor have been matched, false otherwise. More... | |
Private Types | |
using | BindIdValueMap = std::map< std::string, ShPtr< Expression > > |
Mapping of a bind ID into the bound value. More... | |
Private Member Functions | |
bool | funcNameMatches (ShPtr< Expression > calledExpr) const |
Checks that the function called in calledExpr is the one we expect. More... | |
bool | argsMatch (ShPtr< CallExpr > call) const |
Checks that all the bound parameters from the API call info match the values in call. More... | |
bool | valuesMatch (ShPtr< Value > value1, ShPtr< Value > value2) const |
Checks whether value1 is structurally equal to value2. More... | |
void | addToPattern (ShPtr< Statement > stmt, ShPtr< CallExpr > call) |
Adds a new piece of information into the currently built pattern. More... | |
void | advanceToNextInfo () |
Advances to the next information in allInfos . More... | |
void | bindValues (ShPtr< Statement > stmt, ShPtr< CallExpr > call) |
Binds values from call that appear in stmt. More... | |
void | bindValueFromReturnValue (ShPtr< Statement > stmt, ShPtr< CallExpr > call) |
Binds the value returned from call (if any). More... | |
void | bindValuesFromArgs (ShPtr< CallExpr > call) |
Binds the values from the arguments of call. More... | |
Private Attributes | |
const APICallInfoSeq & | allInfos |
Sequence of API call information that we are looking for. More... | |
const APICallInfo * | currInfo |
Pointer to the current information from allInfos . More... | |
APICallInfoSeq::iterator | currInfoIter |
Iterator to the current information in allInfos . More... | |
BindIdValueMap | boundValues |
Mapping of a bind ID into the bound value. More... | |
ShPtr< StmtsPattern > | pattern |
Pattern that is being built. More... | |
A storage of intermediate data when finding sequences of API calls.
|
private |
Mapping of a bind ID into the bound value.
retdec::llvmir2hll::APICallSeqData::APICallSeqData | ( | const APICallInfoSeq & | info | ) |
Constructs data from the given information.
It starts with the first information in info and an empty pattern.
retdec::llvmir2hll::APICallSeqData::APICallSeqData | ( | const APICallSeqData & | data | ) |
Constructs data from data.
|
private |
Adds a new piece of information into the currently built pattern.
|
private |
Advances to the next information in allInfos
.
Applies call that occur in stmt.
In a greater detail, this function adds the information to the currently build pattern, binds values occurring in call, and advances to the next API call information.
Note: This function should be called only after matches() returned true
.
Checks that all the bound parameters from the API call info match the values in call.
bool retdec::llvmir2hll::APICallSeqData::atEnd | ( | ) | const |
Returns true
if all the API call information passed to the constructor have been matched, false
otherwise.
|
private |
Binds the value returned from call (if any).
|
private |
Binds values from call that appear in stmt.
Binds the values from the arguments of call.
|
private |
Checks that the function called in calledExpr is the one we expect.
Returns the current version of the built pattern.
This functions returns a complete pattern only if patternIsComplete() returns true
. Otherwise, it returns a partially build pattern.
Returns true if call matches the currently set API call information, false
otherwise.
bool retdec::llvmir2hll::APICallSeqData::operator!= | ( | const APICallSeqData & | other | ) | const |
Returns true
if this data differ from the other data, false
otherwise.
APICallSeqData & retdec::llvmir2hll::APICallSeqData::operator= | ( | const APICallSeqData & | data | ) |
Assigns data into the current data.
bool retdec::llvmir2hll::APICallSeqData::operator== | ( | const APICallSeqData & | other | ) | const |
Returns true
if this data equal the other data, false
otherwise.
bool retdec::llvmir2hll::APICallSeqData::patternIsComplete | ( | ) | const |
Returns true
if the pattern is complete, false
otherwise.
A pattern is complete if all API call information has been successfully matched.
|
private |
Checks whether value1 is structurally equal to value2.
Structurally equal means that they may have different addresses, but they hold the same data.
|
private |
Sequence of API call information that we are looking for.
|
private |
Mapping of a bind ID into the bound value.
|
private |
Pointer to the current information from allInfos
.
|
private |
Iterator to the current information in allInfos
.
|
private |
Pattern that is being built.