ROSE  0.11.145.0
Classes | Public Types | Public Member Functions | List of all members
Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph Class Reference

Description

Function call information.

This class provides methods that operate on a function call graph, such as constructing a function call graph from a control flow graph. The graph vertices are function pointers (Function::Ptr) and the edges contain information about the type of inter-function edge (function call, function transfer, etc) and the number of such edges. Function call graphs can be built so that inter-function control transfer is represented by its own edge, or so that multiple transfers share an edge.

Definition at line 21 of file FunctionCallGraph.h.

#include <Rose/BinaryAnalysis/Partitioner2/FunctionCallGraph.h>

Classes

class  Edge
 Information about each edge in the call graph. More...
 
class  VertexKey
 

Public Types

typedef Sawyer::Container::Graph< FunctionPtr, Edge, VertexKeyGraph
 Function call graph. More...
 

Public Member Functions

const Graphgraph () const
 Underlying function call graph. More...
 
 FunctionCallGraph ()
 Constructs an empty function call graph. More...
 
boost::iterator_range< Graph::ConstVertexValueIterator > functions ()
 Return all functions in the call graph. More...
 
Graph::VertexIterator insertFunction (const FunctionPtr &function)
 Insert a function vertex. More...
 
Graph::ConstVertexIterator findFunction (const FunctionPtr &function) const
 Find function in call graph. More...
 
Graph::ConstVertexIterator findFunction (rose_addr_t entryVa) const
 Find function in call graph. More...
 
bool exists (const FunctionPtr &function) const
 Determine if a function exists in the call graph. More...
 
bool exists (rose_addr_t entryVa) const
 Determine if a function exists in the call graph. More...
 
Graph::EdgeIterator insertCall (const FunctionPtr &source, const FunctionPtr &target, EdgeType type=E_FUNCTION_CALL, size_t edgeCount=0)
 Insert a call edge. More...
 
Graph::EdgeIterator insertCall (const Graph::VertexIterator &source, const Graph::VertexIterator &target, EdgeType type=E_FUNCTION_CALL, size_t edgeCount=0)
 Insert a call edge. More...
 
std::vector< FunctionPtrcallers (const FunctionPtr &target) const
 List of all functions that call the specified function. More...
 
std::vector< FunctionPtrcallers (const Graph::ConstVertexIterator &target) const
 List of all functions that call the specified function. More...
 
size_t nCallers (const FunctionPtr &target) const
 Number of functions that call the specified function. More...
 
size_t nCallers (const Graph::ConstVertexIterator &target) const
 Number of functions that call the specified function. More...
 
std::vector< FunctionPtrcallees (const FunctionPtr &source) const
 List of all functions called by the specified function. More...
 
std::vector< FunctionPtrcallees (const Graph::ConstVertexIterator &source) const
 List of all functions called by the specified function. More...
 
size_t nCallees (const FunctionPtr &source) const
 Number of functions that the specified function calls. More...
 
size_t nCallees (const Graph::ConstVertexIterator &source) const
 Number of functions that the specified function calls. More...
 
size_t nCallsIn (const FunctionPtr &target) const
 Total number of calls to a function. More...
 
size_t nCallsIn (const Graph::ConstVertexIterator &target) const
 Total number of calls to a function. More...
 
size_t nCallsOut (const FunctionPtr &source) const
 Total number of calls from a function. More...
 
size_t nCallsOut (const Graph::ConstVertexIterator &source) const
 Total number of calls from a function. More...
 
size_t nCalls (const FunctionPtr &source, const FunctionPtr &target) const
 Number of calls between two specific functions. More...
 
size_t nCalls (const Graph::ConstVertexIterator &source, const Graph::ConstVertexIterator &target) const
 Number of calls between two specific functions. More...
 

Member Typedef Documentation

Function call graph.

Definition at line 48 of file FunctionCallGraph.h.

Constructor & Destructor Documentation

Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::FunctionCallGraph ( )

Constructs an empty function call graph.

Member Function Documentation

const Graph& Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::graph ( ) const
inline

Underlying function call graph.

This returns the Sawyer::Container::Graph representing inter-function edges. It is read-only since modifying the graph must be done in conjunction with updating the function-to-vertex index.

Definition at line 58 of file FunctionCallGraph.h.

boost::iterator_range<Graph::ConstVertexValueIterator> Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::functions ( )
inline

Return all functions in the call graph.

Definition at line 66 of file FunctionCallGraph.h.

References Sawyer::Container::Graph< V, E, VKey, EKey, Alloc >::vertexValues().

Graph::ConstVertexIterator Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::findFunction ( const FunctionPtr function) const

Find function in call graph.

Returns the call graph vertex (as an iterator) for the specified function, or the end vertex iterator if the function does not exist in the call graph. The function can be specified by its pointer or entry address.

Graph::ConstVertexIterator Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::findFunction ( rose_addr_t  entryVa) const

Find function in call graph.

Returns the call graph vertex (as an iterator) for the specified function, or the end vertex iterator if the function does not exist in the call graph. The function can be specified by its pointer or entry address.

bool Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::exists ( const FunctionPtr function) const

Determine if a function exists in the call graph.

Returns true if the function is a member of the call graph and false otherwise. A function can be a member of a call graph even if it has no incident edges.

bool Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::exists ( rose_addr_t  entryVa) const

Determine if a function exists in the call graph.

Returns true if the function is a member of the call graph and false otherwise. A function can be a member of a call graph even if it has no incident edges.

Graph::VertexIterator Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::insertFunction ( const FunctionPtr function)

Insert a function vertex.

Inserts the specified function into the call graph if it is not a member of the call graph, otherwise does nothing. In any case, it returns the vertex for the function.

Graph::EdgeIterator Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::insertCall ( const FunctionPtr source,
const FunctionPtr target,
EdgeType  type = E_FUNCTION_CALL,
size_t  edgeCount = 0 
)

Insert a call edge.

Inserts an edge representing a call from source (caller) to target (callee). The type can be E_FUNCTION_CALL or E_FUNCTION_XFER.

If edgeCount is non-zero and an edge of the correct type already exists between the source and target, then the count on that edge is incremented instead. Otherwise, when edgeCount is zero, a new edge with unit count is inserted even if it means creating an edge parallel to an existing edge.

Returns the edge that was inserted or incremented.

Graph::EdgeIterator Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::insertCall ( const Graph::VertexIterator &  source,
const Graph::VertexIterator &  target,
EdgeType  type = E_FUNCTION_CALL,
size_t  edgeCount = 0 
)

Insert a call edge.

Inserts an edge representing a call from source (caller) to target (callee). The type can be E_FUNCTION_CALL or E_FUNCTION_XFER.

If edgeCount is non-zero and an edge of the correct type already exists between the source and target, then the count on that edge is incremented instead. Otherwise, when edgeCount is zero, a new edge with unit count is inserted even if it means creating an edge parallel to an existing edge.

Returns the edge that was inserted or incremented.

std::vector<FunctionPtr> Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::callers ( const FunctionPtr target) const

List of all functions that call the specified function.

Returns a sorted list of distinct functions that call the specified function.

std::vector<FunctionPtr> Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::callers ( const Graph::ConstVertexIterator &  target) const

List of all functions that call the specified function.

Returns a sorted list of distinct functions that call the specified function.

size_t Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::nCallers ( const FunctionPtr target) const

Number of functions that call the specified function.

This is the number of distinct functions that call the specified target function.

size_t Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::nCallers ( const Graph::ConstVertexIterator &  target) const

Number of functions that call the specified function.

This is the number of distinct functions that call the specified target function.

std::vector<FunctionPtr> Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::callees ( const FunctionPtr source) const

List of all functions called by the specified function.

Returns a sorted list of distinct functions that call the function specified by entry address or call graph vertex. If the specified function does not exist in the call graph then an empty list is returned.

std::vector<FunctionPtr> Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::callees ( const Graph::ConstVertexIterator &  source) const

List of all functions called by the specified function.

Returns a sorted list of distinct functions that call the function specified by entry address or call graph vertex. If the specified function does not exist in the call graph then an empty list is returned.

size_t Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::nCallees ( const FunctionPtr source) const

Number of functions that the specified function calls.

This is the number of distinct functions called from the specified source function.

size_t Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::nCallees ( const Graph::ConstVertexIterator &  source) const

Number of functions that the specified function calls.

This is the number of distinct functions called from the specified source function.

size_t Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::nCallsIn ( const FunctionPtr target) const

Total number of calls to a function.

Returns the total number of calls to the specified function, counting each call when a single function calls more than once. I.e., it is the sum of the count fields of all the incoming edges for target.

size_t Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::nCallsIn ( const Graph::ConstVertexIterator &  target) const

Total number of calls to a function.

Returns the total number of calls to the specified function, counting each call when a single function calls more than once. I.e., it is the sum of the count fields of all the incoming edges for target.

size_t Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::nCallsOut ( const FunctionPtr source) const

Total number of calls from a function.

Returns the total number of calls from the specified function, counting each call when a single function is called more than once. I.e., it is the sum of the count fields of all the outgoing edges for source.

size_t Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::nCallsOut ( const Graph::ConstVertexIterator &  source) const

Total number of calls from a function.

Returns the total number of calls from the specified function, counting each call when a single function is called more than once. I.e., it is the sum of the count fields of all the outgoing edges for source.

size_t Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::nCalls ( const FunctionPtr source,
const FunctionPtr target 
) const

Number of calls between two specific functions.

This is the sum of the count fields for all edges between source and target.

size_t Rose::BinaryAnalysis::Partitioner2::FunctionCallGraph::nCalls ( const Graph::ConstVertexIterator &  source,
const Graph::ConstVertexIterator &  target 
) const

Number of calls between two specific functions.

This is the sum of the count fields for all edges between source and target.


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