コード例 #1
0
        // Given a set of candidate procedures, find out which of them can be reached
        public HashSet <string> iterateComputation(PersistentCBAProgram program, HashSet <string> candidates)
        {
            var ret = new HashSet <string>();

            // Instrument the program.
            // instrument() sets labelProcMap
            var newProg = instrument(program, candidates);

            var verifier = getVerifier();

            verifier.run(newProg);

            // Nothing more can be covered
            if (verifier.success)
            {
                return(ret);
            }

            // All these guys were covered
            foreach (var trace in verifier.traces)
            {
                // trace.getProcs().Iter(s => ret.Add(s));
                ret.UnionWith(trace.getProcs());
            }

            ret = HashSetExtras <string> .Intersection(ret, candidates);

            Log.WriteLine(Log.Normal, string.Format("Coverage: Got {0} traces and {1} procs", verifier.traces.Count, ret.Count));

            return(ret);
        }
コード例 #2
0
        // Does "from" call any proc in "to"?
        public bool calls(string from, HashSet <string> to)
        {
            if (!succEdges.ContainsKey(from))
            {
                return(false);
            }

            return(HashSetExtras <string> .Intersection(succEdges[from], to).Count > 0);
        }
コード例 #3
0
        // Given a set of candidate procedures, find out which of them lie
        // on an error path. This function is iterated until it returns the
        // empty set or the whole set of candidates
        public HashSet <string> iterateComputation(PersistentCBAProgram program, HashSet <string> candidates)
        {
            var ret = new HashSet <string>();

            // Instrument the program.
            // instrument() sets labelProcMap
            var newProg = instrument(program, candidates);

            CommandLineOptions.Clo.ProverCCLimit = 5;
            var verifier = getVerifier();

            verifier.run(newProg);

            if (verifier.success)
            {
                return(ret);
            }

            foreach (var trace in verifier.traces)
            {
                // Find the failing assert -- it must be in main
                var blkName = trace.Blocks.Last().blockName;
                if (labelProcMap.ContainsKey(blkName))
                {
                    ret.Add(labelProcMap[blkName]);
                }
            }

            foreach (var trace in verifier.traces)
            {
                // trace.getProcs().Iter(s => ret.Add(s));
                ret.UnionWith(trace.getProcs());
            }

            ret = HashSetExtras <string> .Intersection(ret, candidates);

            Log.WriteLine(Log.Normal, string.Format("EP: Got {0} traces and {1} procs", verifier.traces.Count, ret.Count));

            return(ret);
        }
コード例 #4
0
 public virtual VarSet Intersection(VarSet second)
 {
     return(new VarSet(HashSetExtras <Duple <string, string> > .Intersection(values, second.values)));
 }
コード例 #5
0
 // Does "from" call any proc in "to" transitively
 public bool callsTransitive(string from, HashSet <string> to)
 {
     return(HashSetExtras <string> .Intersection(getAllTransitiveSucc(from), to).Count > 0);
 }