Question: assignment - 2 . cpp: / / Software - Analysis - Teaching Assignment 2 : Source Sink ICFG DFS Traversal / / / / *
assignmentcpp:
SoftwareAnalysisTeaching Assignment : Source Sink ICFG DFS Traversal
#include
#include "Assignmenth
#include
using namespace SVF;
using namespace std;
TODO: print each path once this method is called, and
add each path as a string into std::set paths
Print the path in the format "STARTEND", where indicate an ICFGEdge connects two ICFGNode IDs
void ICFGTraversal::collectICFGPathstd::vector &path
TODO: Implement your contextsensitive ICFG traversal here to traverse each program path once for any loop from src to dst
void ICFGTraversal::reachabilityconst ICFGNode src const ICFGNode dst
assignmenth:
SoftwareAnalysisTeaching Assignment : Source Sink ICFG DFS Traversal
#ifndef ASSIGNMENTH
#define ASSIGNMENTH
#include SVFLLVMLLVMUtilh
#include SVFLLVMSVFIRBuilderh
using namespace SVF;
class ICFGTraversal
public:
typedef std::vector CallStack;
public:
ICFGTraversalSVFIR p : pagp
TODO: to be implemented
virtual void collectICFGPathstd::vector &path;
TODO: to be implemented context sensitive DFS
void reachabilityconst ICFGNode src const ICFGNode dst;
Identify source nodes on ICFG ie call instruction with its callee function named src
virtual std::set &identifySources
for const CallICFGNode cs : paggetCallSiteSet
const SVFFunction fun csgetCalledFunction;
if fungetName "source"
sources.insertcs;
return sources;
Identify sink nodes on ICFG ie call instruction with its callee function named 'sink'
virtual std::set &identifySinks
for const CallICFGNode cs : paggetCallSiteSet
const SVFFunction fun csgetCalledFunction;
if fungetName "sink"
sinksinsertcs;
return sinks;
std::set& getPaths
return paths;
protected:
std::set sources;
std::set sinks;
Set visited;
CallStack callstack;
SVFIR pag;
std::set paths;
std::vector path;
;
#endif
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
