public DependencyVisitor(string filename, Program program, List <Tuple <string, string, int> > changeLog, int timeOut, bool prune = true, bool dataOnly = false) { this.filename = filename; this.program = program; this.callGraph = CallGraphHelper.ComputeCallGraph(program); this.nodeToImpl = Utils.ComputeNodeToImpl(program); this.ProcDependencies = new Dictionary <Procedure, Dependencies>(); this.dominatedBy = new Dictionary <Block, HashSet <Block> >(); this.branchCondVars = new Dictionary <Block, VarSet>(); this.worklist = new WorkList <Dependencies>(); this.procEntryTDTaint = new Dictionary <Procedure, Dependencies>(); this.procExitTDTaint = new Dictionary <Procedure, Dependencies>(); // populate changedProcs,changedBlock from changedLines this.changedBlocks = Utils.ComputeChangedBlocks(program, changeLog); this.changedProcs = Utils.ComputeChangedProcs(program, changeLog); this.prune = prune; this.dataOnly = dataOnly; this.taintOnly = false; this.timeOut = timeOut * 1000; // change to ms }
public BottomUpTaintVisitor(string filename, Program program, Dictionary <Procedure, Dependencies> procDependencies, List <Tuple <string, string, int> > changeLog, bool dataOnly = false) { this.filename = filename; this.program = program; this.callGraph = Utils.CallGraphHelper.ComputeCallGraph(program); this.nodeToImpl = Utils.ComputeNodeToImpl(program); this.ProcTaint = new Dictionary <Procedure, TaintSet>(); this.procDependencies = procDependencies; this.dominatedBy = new Dictionary <Block, HashSet <Block> >(); this.branchCondVars = new Dictionary <Block, HashSet <Variable> >(); this.worklist = new WorkList <TaintSet>(); // populate changedProcs,changedBlock from changedLines this.changedProcs = new HashSet <Procedure>(); this.changedBlocks = new HashSet <Block>(); foreach (var changesPerFile in changeLog.GroupBy(t => t.Item1)) { foreach (var changesPerProc in changesPerFile.GroupBy(t => t.Item2)) { var impl = program.Implementations().FirstOrDefault(i => i.Proc.Name == changesPerProc.Key); if (changesPerProc.FirstOrDefault(t => t.Item3 == Utils.AttributeUtils.WholeProcChangeAttributeVal) != null) { this.changedProcs.Add(impl.Proc); // whole procedure changed } else { foreach (var procChange in changesPerProc) { // add in the block pertaining to the changed line impl.Blocks.Where(b => b.Cmds.Count > 0 && b.Cmds[0] is AssertCmd && Utils.AttributeUtils.GetSourceLine(b.Cmds[0] as AssertCmd) == procChange.Item3) .Iter(b => changedBlocks.Add(b)); } } } } this.dataOnly = dataOnly; }