Exemplo n.º 1
0
        internal Explorer(
            ExplorationContext explorationContext,
            IContextFactory smtContextFactory,
            StartingNodeInfo startingNode,
            IEntryPointRecognizer finalNodeRecognizer,
            ISymbolicHeapFactory heapFactory,
            Action <ExplorationResult> resultCallback)
        {
            // TODO: Solve this marginal case directly in the ExplorationContext
            Contract.Requires(!finalNodeRecognizer.IsFinalNode(startingNode.Node));

            this.context             = explorationContext;
            this.startingNode        = startingNode;
            this.finalNodeRecognizer = finalNodeRecognizer;
            this.heapFactory         = heapFactory;
            this.resultCallback      = resultCallback;

            this.smtContextHandler = new SmtContextHandler(smtContextFactory);

            var rootPath = new Path(
                ImmutableArray <Path> .Empty,
                0,
                this.startingNode.Node,
                ImmutableArray <FlowEdge> .Empty);
            var rootState = new ExplorationState(
                rootPath,
                CallSiteStack.Empty,
                this.smtContextHandler.CreateEmptySolver(rootPath, this.startingNode, heapFactory));

            this.AddState(rootState);
        }
Exemplo n.º 2
0
        internal SmtSolverHandler(
            SmtContextHandler contextHandler,
            ISolver smtSolver,
            Path path,
            StartingNodeInfo startingNode,
            ISymbolicHeapFactory heapFactory)
            : this(
                contextHandler,
                smtSolver,
                null)
        {
            var heap = heapFactory.Create(new SolverSymbolicHeapContext(this));

            this.pathConditionHandler = new PathConditionHandler(contextHandler, smtSolver, path, startingNode, heap);
            this.pathConditionHandler.ProcessStartingNode();
        }
Exemplo n.º 3
0
        public SmtSolverHandler CreateEmptySolver(Path rootPath, StartingNodeInfo startingNode, ISymbolicHeapFactory heapFactory)
        {
            Contract.Requires(rootPath != null);
            Contract.Requires(startingNode != null);
            Contract.Requires(rootPath.Depth == 0);
            Contract.Requires(rootPath.Node == startingNode.Node);

            var solver = this.context.CreateSolver(areDeclarationsGlobal: true, isUnsatisfiableCoreProduced: true);

            return(new SmtSolverHandler(this, solver, rootPath, startingNode, heapFactory));
        }