retdec
Public Member Functions | Static Public Member Functions | List of all members
retdec::llvmir2hll::BasicBlockAPICallSeqFinder Class Reference

API call finder which searches only in a basic block. More...

#include <basic_block_api_call_seq_finder.h>

Inheritance diagram for retdec::llvmir2hll::BasicBlockAPICallSeqFinder:
Inheritance graph
[legend]
Collaboration diagram for retdec::llvmir2hll::BasicBlockAPICallSeqFinder:
Collaboration graph
[legend]

Public Member Functions

 BasicBlockAPICallSeqFinder (ShPtr< ValueAnalysis > va, ShPtr< CallInfoObtainer > cio)
 Constructs a BasicBlockAPICallSeqFinder object. More...
 
virtual Patterns findPatterns (const APICallInfoSeq &info, ShPtr< CallExpr > call, ShPtr< Statement > stmt, ShPtr< Function > func, ShPtr< Module > module) override
 Tries to find the given sequence of API calls, starting at stmt. More...
 
- Public Member Functions inherited from retdec::llvmir2hll::APICallSeqFinder
virtual ~APICallSeqFinder ()=default
 

Static Public Member Functions

static ShPtr< BasicBlockAPICallSeqFindercreate (ShPtr< ValueAnalysis > va, ShPtr< CallInfoObtainer > cio)
 

Additional Inherited Members

- Public Types inherited from retdec::llvmir2hll::APICallSeqFinder
using Patterns = std::vector< ShPtr< Pattern > >
 List of patterns. More...
 
- Protected Member Functions inherited from retdec::llvmir2hll::APICallSeqFinder
 APICallSeqFinder (ShPtr< ValueAnalysis > va, ShPtr< CallInfoObtainer > cio)
 Constructs the base class. More...
 
- Protected Attributes inherited from retdec::llvmir2hll::APICallSeqFinder
ShPtr< ValueAnalysisva
 Analysis of values. More...
 
ShPtr< CallInfoObtainercio
 The used call info obtainer. More...
 

Detailed Description

API call finder which searches only in a basic block.

This finder searches only within the same basic block in which the first statement of a possible pattern appears. For example, consider the following code

char input[100];
FILE *f = fopen("file.txt", "r");
fread(input, 1, 99, f);
input[99] = '\0';
if (input[0] != 'X') {
fclose(f);
}

and suppose that the pattern is

id = fopen();
fread(id);
fclose(id);

Then, the present finder does not recognize this pattern because in the code, it spans over multiple basic blocks.

Instances of this class have reference object semantics. Use create() to create instances.

Constructor & Destructor Documentation

◆ BasicBlockAPICallSeqFinder()

retdec::llvmir2hll::BasicBlockAPICallSeqFinder::BasicBlockAPICallSeqFinder ( ShPtr< ValueAnalysis va,
ShPtr< CallInfoObtainer cio 
)

Constructs a BasicBlockAPICallSeqFinder object.

Parameters
[in]vaThe used analysis of values.
[in]cioThe used call info obtainer.
Preconditions
  • va and cio are non-null
  • va is in a valid state
  • cio has been initialized

Member Function Documentation

◆ create()

static ShPtr<BasicBlockAPICallSeqFinder> retdec::llvmir2hll::BasicBlockAPICallSeqFinder::create ( ShPtr< ValueAnalysis va,
ShPtr< CallInfoObtainer cio 
)
static

◆ findPatterns()

BasicBlockAPICallSeqFinder::Patterns retdec::llvmir2hll::BasicBlockAPICallSeqFinder::findPatterns ( const APICallInfoSeq info,
ShPtr< CallExpr call,
ShPtr< Statement stmt,
ShPtr< Function func,
ShPtr< Module module 
)
overridevirtual

Tries to find the given sequence of API calls, starting at stmt.

Parameters
[in]infoA description of an API call sequence.
[in]callA function call.
[in]stmtThe statement in which call appears.
[in]funcThe function in which stmt appears.
[in]moduleThe module in which func appears.

The used way of finding the pattern depends on concrete finders.

Preconditions
  • call, stmt, func, and module are non-null

Implements retdec::llvmir2hll::APICallSeqFinder.


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