Beispiel #1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="fingerprint">Fingerprint</param>
 /// <param name="enabledMachines">Enabled machines</param>
 /// <param name="monitorStatus">Monitor status</param>
 internal State(Fingerprint fingerprint, HashSet<AbstractMachine> enabledMachines,
     Dictionary<Monitor, MonitorStatus> monitorStatus)
 {
     this.Fingerprint = fingerprint;
     this.EnabledMachines = enabledMachines;
     this.MonitorStatus = monitorStatus;
 }
Beispiel #2
0
        /// <summary>
        /// Checks liveness at a trace cycle.
        /// </summary>
        /// <param name="root">Cycle start</param>
        /// <param name="stateMap">Map of states</param>
        internal void CheckLivenessAtTraceCycle(Fingerprint root, Dictionary<TraceStep, State> stateMap)
        {
            var cycle = new Dictionary<TraceStep, State>();

            do
            {
                var traceStep = this.Runtime.ProgramTrace.Pop();
                var state = stateMap[traceStep];
                cycle.Add(traceStep, state);

                IO.Debug("<LivenessDebug> Cycle contains {0} with {1}.",
                    traceStep.Type, state.Fingerprint.ToString());
                
                // The state can be safely removed, because the liveness detection
                // algorithm currently removes cycles, so a specific state can only
                // appear once in the trace.
                stateMap.Remove(traceStep);
            }
            while (this.Runtime.ProgramTrace.Peek() != null && !stateMap[
                this.Runtime.ProgramTrace.Peek()].Fingerprint.Equals(root));
            
            if (!this.IsSchedulingFair(cycle))
            {
                IO.Debug("<LivenessDebug> Scheduling in cycle is unfair.");
                return;
            }
            else if (!this.IsNondeterminismFair(cycle))
            {
                IO.Debug("<LivenessDebug> Nondeterminism in cycle is unfair.");
                return;
            }

            IO.Debug("<LivenessDebug> Cycle execution is fair.");

            var hotMonitors = this.GetHotMonitors(cycle);
            foreach (var monitor in hotMonitors)
            {
                string message = IO.Format("Monitor '{0}' detected infinite execution that " +
                    "violates a liveness property.", monitor.GetType().Name);
                this.Runtime.BugFinder.NotifyAssertionFailure(message, false);
            }

            if (this.Runtime.Configuration.DepthBound == 0 || hotMonitors.Count > 0)
            {
                this.Runtime.BugFinder.Stop();
            }
        }