ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Partitioner::FindFunctionFragments Struct Reference

Callback to insert unreachable code fragments. More...

#include <Partitioner.h>

Inheritance diagram for Partitioner::FindFunctionFragments:
Collaboration diagram for Partitioner::FindFunctionFragments:

Public Member Functions

 FindFunctionFragments ()
 
virtual ~FindFunctionFragments ()
 
virtual bool operator() (bool enabled, const Args &args)
 The actual callback function. More...
 
- Public Member Functions inherited from Partitioner::ByteRangeCallback
virtual ~ByteRangeCallback ()
 

Public Attributes

bool require_noninterleaved
 If set, then preceding function cannot be interleaved. More...
 
bool require_intrafunction
 If set, range must be inside the preceding function. More...
 
double threshold
 Threshold for determining whether range is code. More...
 
unsigned excluded_reasons
 Functions for which callback should be skipped. More...
 
size_t nfound
 Number of basic blocks added as code fragments. More...
 
FunctionRangeMapfunction_extents
 Cached function extents computed on first call. More...
 
CodeCriteriacode_criteria
 Cached code criteria computed on first call. More...
 

Detailed Description

Callback to insert unreachable code fragments.

This callback can be passed to the scan_unassigned_bytes() method's callback list. Whenever it detects a region of unassigned bytes that looks like it might be code, it generates basic blocks and attaches them to the immediately preceding function.

If the require_noninterleaved property is set (the default) then the callback is triggered only if the preceding function's extent is not interleaved with other functions. Normally, if two or more functions are interleaved then we cannot assume that the range of instructions being analyzed by this callback belongs to the surrounding function or some other (possibly interleaved) function.

If the require_intrafunction property is set (default is clear) then the region being analyzed must be immediately followed by something that belongs to the preceding function.

A fragment is added to the preceding function only if the fragment looks statistically like code. A CodeCriteria object is created on the first call if necessary and is initialized based on the statistics computed across all known functions (as returned by Partitioner::aggregate_statistics()) and the threshold data member. The caller can supply its own CodeCriteria if desired, in which case FindFunctionFragments::threshold is unused. In either case, the CodeCriteria object is deleted when the FindFunctionFragments object is deleted.

This callback is skipped if the preceding function contains any of the SgAsmFunction::FunctionReason bits that are set in the excluded_reasons data member. The default is to exclude functions created for padding or thunks.

This callback might create new basic blocks as a side effect even if those blocks are not added to any function.

Definition at line 1315 of file Partitioner.h.

Constructor & Destructor Documentation

Partitioner::FindFunctionFragments::FindFunctionFragments ( )
inline

Definition at line 1325 of file Partitioner.h.

virtual Partitioner::FindFunctionFragments::~FindFunctionFragments ( )
inlinevirtual

Definition at line 1330 of file Partitioner.h.

References code_criteria, and function_extents.

Member Function Documentation

Member Data Documentation

bool Partitioner::FindFunctionFragments::require_noninterleaved

If set, then preceding function cannot be interleaved.

Definition at line 1316 of file Partitioner.h.

Referenced by Partitioner::post_cfg().

bool Partitioner::FindFunctionFragments::require_intrafunction

If set, range must be inside the preceding function.

Definition at line 1317 of file Partitioner.h.

Referenced by Partitioner::post_cfg().

double Partitioner::FindFunctionFragments::threshold

Threshold for determining whether range is code.

Definition at line 1318 of file Partitioner.h.

Referenced by Partitioner::post_cfg().

unsigned Partitioner::FindFunctionFragments::excluded_reasons

Functions for which callback should be skipped.

Definition at line 1319 of file Partitioner.h.

size_t Partitioner::FindFunctionFragments::nfound

Number of basic blocks added as code fragments.

Definition at line 1320 of file Partitioner.h.

FunctionRangeMap* Partitioner::FindFunctionFragments::function_extents

Cached function extents computed on first call.

Definition at line 1322 of file Partitioner.h.

Referenced by ~FindFunctionFragments().

CodeCriteria* Partitioner::FindFunctionFragments::code_criteria

Cached code criteria computed on first call.

Definition at line 1323 of file Partitioner.h.

Referenced by ~FindFunctionFragments().


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