ROSE 0.11.145.147
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.
 

Public Member Functions

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

Member Typedef Documentation

◆ Graph

Function call graph.

Definition at line 48 of file FunctionCallGraph.h.

Member Function Documentation

◆ graph()

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.

◆ functions()

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().

◆ findFunction() [1/2]

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.

◆ findFunction() [2/2]

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.

◆ exists() [1/2]

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.

◆ exists() [2/2]

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.

◆ insertFunction()

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.

◆ insertCall() [1/2]

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.

◆ insertCall() [2/2]

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.

◆ callers() [1/2]

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.

◆ callers() [2/2]

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.

◆ nCallers() [1/2]

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.

◆ nCallers() [2/2]

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.

◆ callees() [1/2]

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.

◆ callees() [2/2]

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.

◆ nCallees() [1/2]

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.

◆ nCallees() [2/2]

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.

◆ nCallsIn() [1/2]

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.

◆ nCallsIn() [2/2]

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.

◆ nCallsOut() [1/2]

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.

◆ nCallsOut() [2/2]

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.

◆ nCalls() [1/2]

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.

◆ nCalls() [2/2]

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: