Static Value-Flow Analysis
|
#include <PTACallGraph.h>
Public Member Functions | |
PTACallGraph (CGEK k=NormCallGraph) | |
Constructor. More... | |
PTACallGraph (const PTACallGraph &other) | |
Copy constructor. More... | |
void | addCallGraphNode (const SVFFunction *fun) |
virtual | ~PTACallGraph () |
Destructor. More... | |
CGEK | getKind () const |
Return type of this callgraph. More... | |
CallEdgeMap & | getIndCallMap () |
Get callees from an indirect callsite. More... | |
bool | hasIndCSCallees (const CallICFGNode *cs) const |
const FunctionSet & | getIndCSCallees (const CallICFGNode *cs) const |
u32_t | getTotalCallSiteNumber () const |
u32_t | getNumOfResolvedIndCallEdge () const |
const CallInstToCallGraphEdgesMap & | getCallInstToCallGraphEdgesMap () const |
void | verifyCallGraph () |
Issue a warning if the function which has indirect call sites can not be reached from program entry. More... | |
PTACallGraphNode * | getCallGraphNode (NodeID id) const |
Get call graph node. More... | |
PTACallGraphNode * | getCallGraphNode (const SVFFunction *fun) const |
CallSiteID | addCallSite (const CallICFGNode *cs, const SVFFunction *callee) |
Add/Get CallSiteID. More... | |
CallSiteID | getCallSiteID (const CallICFGNode *cs, const SVFFunction *callee) const |
bool | hasCallSiteID (const CallICFGNode *cs, const SVFFunction *callee) const |
const CallSitePair & | getCallSitePair (CallSiteID id) const |
const CallICFGNode * | getCallSite (CallSiteID id) const |
const SVFFunction * | getCallerOfCallSite (CallSiteID id) const |
const SVFFunction * | getCalleeOfCallSite (CallSiteID id) const |
PTACallGraphEdge * | hasGraphEdge (PTACallGraphNode *src, PTACallGraphNode *dst, PTACallGraphEdge::CEDGEK kind, CallSiteID csId) const |
Whether we have already created this call graph edge. More... | |
PTACallGraphEdge * | getGraphEdge (PTACallGraphNode *src, PTACallGraphNode *dst, PTACallGraphEdge::CEDGEK kind, CallSiteID csId) |
Get call graph edge via nodes. More... | |
void | getCallees (const CallICFGNode *cs, FunctionSet &callees) |
Get all callees for a callsite. More... | |
bool | hasCallGraphEdge (const CallICFGNode *inst) const |
Get call graph edge via call instruction. More... | |
CallGraphEdgeSet::const_iterator | getCallEdgeBegin (const CallICFGNode *inst) const |
CallGraphEdgeSet::const_iterator | getCallEdgeEnd (const CallICFGNode *inst) const |
void | addEdge (PTACallGraphEdge *edge) |
Add call graph edge. More... | |
void | addDirectCallGraphEdge (const CallICFGNode *call, const SVFFunction *callerFun, const SVFFunction *calleeFun) |
Add direct/indirect call edges. More... | |
void | addIndirectCallGraphEdge (const CallICFGNode *cs, const SVFFunction *callerFun, const SVFFunction *calleeFun) |
void | getAllCallSitesInvokingCallee (const SVFFunction *callee, PTACallGraphEdge::CallInstSet &csSet) |
Get callsites invoking the callee. More... | |
void | getDirCallSitesInvokingCallee (const SVFFunction *callee, PTACallGraphEdge::CallInstSet &csSet) |
void | getIndCallSitesInvokingCallee (const SVFFunction *callee, PTACallGraphEdge::CallInstSet &csSet) |
bool | isReachableBetweenFunctions (const SVFFunction *srcFn, const SVFFunction *dstFn) const |
Whether its reachable between two functions. More... | |
void | dump (const std::string &filename) |
Dump the graph. More... | |
void | view () |
View the graph from the debugger. More... | |
Public Member Functions inherited from SVF::GenericGraph< NodeTy, EdgeTy > | |
GenericGraph () | |
Constructor. More... | |
virtual | ~GenericGraph () |
Destructor. More... | |
void | destroy () |
Release memory. More... | |
iterator | begin () |
Iterators. More... | |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
void | addGNode (NodeID id, NodeType *node) |
Add a Node. More... | |
NodeType * | getGNode (NodeID id) const |
Get a node. More... | |
bool | hasGNode (NodeID id) const |
Has a node. More... | |
void | removeGNode (NodeType *node) |
Delete a node. More... | |
u32_t | getTotalNodeNum () const |
Get total number of node/edge. More... | |
u32_t | getTotalEdgeNum () const |
void | incNodeNum () |
Increase number of node/edge. More... | |
void | incEdgeNum () |
Protected Member Functions | |
void | destroy () |
Clean up memory. More... | |
Protected Attributes | |
FunToCallGraphNodeMap | funToCallGraphNodeMap |
Call Graph node map. More... | |
CallInstToCallGraphEdgesMap | callinstToCallGraphEdgesMap |
Map a call instruction to its corresponding call edges. More... | |
NodeID | callGraphNodeNum |
u32_t | numOfResolvedIndCallEdge |
CGEK | kind |
Protected Attributes inherited from SVF::GenericGraph< NodeTy, EdgeTy > | |
IDToNodeMapTy | IDToNodeMap |
node map More... | |
Private Attributes | |
CallEdgeMap | indirectCallMap |
Indirect call map. More... | |
Static Private Attributes | |
static CallSiteToIdMap | csToIdMap |
Call site information. More... | |
static IdToCallSiteMap | idToCSMap |
Map a callsite ID to a pair of call instruction and callee. More... | |
static CallSiteID | totalCallSiteNum = 1 |
CallSiteIDs, start from 1;. More... | |
Additional Inherited Members | |
Public Attributes inherited from SVF::GenericGraph< NodeTy, EdgeTy > | |
u32_t | edgeNum |
total num of node More... | |
u32_t | nodeNum |
total num of edge More... | |
Definition at line 241 of file PTACallGraph.h.
typedef OrderedMap<const CallICFGNode*, FunctionSet> SVF::PTACallGraph::CallEdgeMap |
Definition at line 252 of file PTACallGraph.h.
typedef CallGraphEdgeSet::const_iterator SVF::PTACallGraph::CallGraphEdgeConstIter |
Definition at line 254 of file PTACallGraph.h.
typedef CallGraphEdgeSet::iterator SVF::PTACallGraph::CallGraphEdgeIter |
Definition at line 253 of file PTACallGraph.h.
Definition at line 245 of file PTACallGraph.h.
typedef Map<const CallICFGNode*, CallGraphEdgeSet> SVF::PTACallGraph::CallInstToCallGraphEdgesMap |
Definition at line 247 of file PTACallGraph.h.
typedef std::pair<const CallICFGNode*, const SVFFunction*> SVF::PTACallGraph::CallSitePair |
Definition at line 248 of file PTACallGraph.h.
Definition at line 249 of file PTACallGraph.h.
typedef Set<const SVFFunction*> SVF::PTACallGraph::FunctionSet |
Definition at line 251 of file PTACallGraph.h.
typedef Map<const SVFFunction*, PTACallGraphNode*> SVF::PTACallGraph::FunToCallGraphNodeMap |
Definition at line 246 of file PTACallGraph.h.
Definition at line 250 of file PTACallGraph.h.
PTACallGraph::PTACallGraph | ( | CGEK | k = NormCallGraph | ) |
Constructor.
Definition at line 109 of file PTACallGraph.cpp.
PTACallGraph::PTACallGraph | ( | const PTACallGraph & | other | ) |
Copy constructor.
copy call graph nodes
copy edges
Definition at line 116 of file PTACallGraph.cpp.
|
inlinevirtual |
void PTACallGraph::addCallGraphNode | ( | const SVFFunction * | fun | ) |
|
inline |
Add/Get CallSiteID.
Definition at line 354 of file PTACallGraph.h.
void PTACallGraph::addDirectCallGraphEdge | ( | const CallICFGNode * | cs, |
const SVFFunction * | callerFun, | ||
const SVFFunction * | calleeFun | ||
) |
Add direct/indirect call edges.
Add direct call edges
Definition at line 206 of file PTACallGraph.cpp.
|
inline |
Add call graph edge.
Definition at line 443 of file PTACallGraph.h.
void PTACallGraph::addIndirectCallGraphEdge | ( | const CallICFGNode * | cs, |
const SVFFunction * | callerFun, | ||
const SVFFunction * | calleeFun | ||
) |
Add indirect call edge to update call graph
Definition at line 226 of file PTACallGraph.cpp.
|
protected |
Clean up memory.
Memory has been cleaned up at GenericGraph
Definition at line 151 of file PTACallGraph.cpp.
void PTACallGraph::dump | ( | const std::string & | filename | ) |
Dump the graph.
Dump call graph into dot file
Definition at line 355 of file PTACallGraph.cpp.
void PTACallGraph::getAllCallSitesInvokingCallee | ( | const SVFFunction * | callee, |
PTACallGraphEdge::CallInstSet & | csSet | ||
) |
Get callsites invoking the callee.
Get all callsite invoking this callee
Definition at line 248 of file PTACallGraph.cpp.
|
inline |
Definition at line 427 of file PTACallGraph.h.
|
inline |
Definition at line 434 of file PTACallGraph.h.
|
inline |
Definition at line 395 of file PTACallGraph.h.
|
inline |
Get all callees for a callsite.
Definition at line 408 of file PTACallGraph.h.
|
inline |
Definition at line 391 of file PTACallGraph.h.
|
inline |
Definition at line 343 of file PTACallGraph.h.
|
inline |
Get call graph node.
Definition at line 339 of file PTACallGraph.h.
|
inline |
Definition at line 329 of file PTACallGraph.h.
|
inline |
Definition at line 387 of file PTACallGraph.h.
|
inline |
Definition at line 368 of file PTACallGraph.h.
|
inline |
Definition at line 381 of file PTACallGraph.h.
void PTACallGraph::getDirCallSitesInvokingCallee | ( | const SVFFunction * | callee, |
PTACallGraphEdge::CallInstSet & | csSet | ||
) |
Get direct callsite invoking this callee
Definition at line 270 of file PTACallGraph.cpp.
PTACallGraphEdge * PTACallGraph::getGraphEdge | ( | PTACallGraphNode * | src, |
PTACallGraphNode * | dst, | ||
PTACallGraphEdge::CEDGEK | kind, | ||
CallSiteID | csId | ||
) |
Get call graph edge via nodes.
get PTACallGraph edge via nodes
Definition at line 189 of file PTACallGraph.cpp.
|
inline |
Get callees from an indirect callsite.
Definition at line 304 of file PTACallGraph.h.
void PTACallGraph::getIndCallSitesInvokingCallee | ( | const SVFFunction * | callee, |
PTACallGraphEdge::CallInstSet & | csSet | ||
) |
Get indirect callsite invoking this callee
Definition at line 287 of file PTACallGraph.cpp.
|
inline |
Definition at line 312 of file PTACallGraph.h.
|
inline |
Return type of this callgraph.
Definition at line 297 of file PTACallGraph.h.
|
inline |
Definition at line 324 of file PTACallGraph.h.
|
inline |
Definition at line 319 of file PTACallGraph.h.
|
inline |
Get call graph edge via call instruction.
whether this call instruction has a valid call graph edge
Definition at line 423 of file PTACallGraph.h.
|
inline |
Definition at line 375 of file PTACallGraph.h.
PTACallGraphEdge * PTACallGraph::hasGraphEdge | ( | PTACallGraphNode * | src, |
PTACallGraphNode * | dst, | ||
PTACallGraphEdge::CEDGEK | kind, | ||
CallSiteID | csId | ||
) | const |
Whether we have already created this call graph edge.
Whether we have already created this call graph edge
Definition at line 170 of file PTACallGraph.cpp.
|
inline |
Definition at line 308 of file PTACallGraph.h.
bool PTACallGraph::isReachableBetweenFunctions | ( | const SVFFunction * | srcFn, |
const SVFFunction * | dstFn | ||
) | const |
Whether its reachable between two functions.
Whether its reachable between two functions
Definition at line 324 of file PTACallGraph.cpp.
void PTACallGraph::verifyCallGraph | ( | ) |
Issue a warning if the function which has indirect call sites can not be reached from program entry.
Issue a warning if the function which has indirect call sites can not be reached from program entry.
Definition at line 304 of file PTACallGraph.cpp.
void PTACallGraph::view | ( | ) |
View the graph from the debugger.
Definition at line 360 of file PTACallGraph.cpp.
|
protected |
Definition at line 274 of file PTACallGraph.h.
|
protected |
Map a call instruction to its corresponding call edges.
Definition at line 272 of file PTACallGraph.h.
|
staticprivate |
Call site information.
Map a pair of call instruction and callee to a callsite ID
Definition at line 266 of file PTACallGraph.h.
|
protected |
Call Graph node map.
Definition at line 271 of file PTACallGraph.h.
|
staticprivate |
Map a callsite ID to a pair of call instruction and callee.
Definition at line 267 of file PTACallGraph.h.
|
private |
Indirect call map.
Definition at line 263 of file PTACallGraph.h.
|
protected |
Definition at line 276 of file PTACallGraph.h.
|
protected |
Definition at line 275 of file PTACallGraph.h.
|
staticprivate |
CallSiteIDs, start from 1;.
Definition at line 268 of file PTACallGraph.h.