public void Run() { if (WhoopRaceCheckerCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine(" |------ [{0} :: {1}]", this.EP1.Name, this.EP2.Name); Console.WriteLine(" | |"); this.Timer = new ExecutionTimer(); this.Timer.Start(); } Instrumentation.Factory.CreateAsyncCheckingInstrumentation(this.AC, this.Pair).Run(); Instrumentation.Factory.CreateYieldInstrumentation(this.AC, this.RaceCheckedAC, this.Pair, this.ErrorReporter).Run(); if (WhoopRaceCheckerCommandLineOptions.Get().MeasurePassExecutionTime) { this.Timer.Stop(); Console.WriteLine(" | |"); Console.WriteLine(" | |--- [Total] {0}", this.Timer.Result()); Console.WriteLine(" |"); } Whoop.IO.BoogieProgramEmitter.Emit(this.AC.TopLevelDeclarations, WhoopRaceCheckerCommandLineOptions.Get().Files[ WhoopRaceCheckerCommandLineOptions.Get().Files.Count - 1], "check_racy_" + this.EP1.Name + "_" + this.EP2.Name, "bpl"); }
private static void StartTimer(string engineName) { if (WhoopEngineCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine("\n[" + engineName + "] runtime"); Console.WriteLine(" |"); Program.Timer = new ExecutionTimer(); Program.Timer.Start(); } }
public void Run() { if (WhoopEngineCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine(" |------ [{0} :: {1}]", this.Pair.EntryPoint1.Name, this.Pair.EntryPoint2.Name); Console.WriteLine(" | |"); this.Timer = new ExecutionTimer(); this.Timer.Start(); } Analysis.Factory.CreateLockAbstraction(this.AC).Run(); if (this.Pair.EntryPoint1.Name.Equals(this.Pair.EntryPoint2.Name)) { Instrumentation.Factory.CreateGlobalRaceCheckingInstrumentation(this.AC, this.Pair.EntryPoint1).Run(); } else { Instrumentation.Factory.CreateGlobalRaceCheckingInstrumentation(this.AC, this.Pair.EntryPoint1).Run(); Instrumentation.Factory.CreateGlobalRaceCheckingInstrumentation(this.AC, this.Pair.EntryPoint2).Run(); } Instrumentation.Factory.CreatePairInstrumentation(this.AC, this.Pair).Run(); Analysis.Factory.CreatePairParameterAliasAnalysis(this.AC, this.Pair).Run(); ModelCleaner.RemoveOriginalInitFunc(this.AC); ModelCleaner.RemoveEntryPointSpecificTopLevelDeclerations(this.AC); ModelCleaner.RemoveUnusedTopLevelDeclerations(this.AC); ModelCleaner.RemoveUnecesseryInfoFromSpecialFunctions(this.AC); // ModelCleaner.RemoveNonPairMemoryRegions(this.AC, pair.Item1, pair.Item2); ModelCleaner.RemoveCorralFunctions(this.AC); if (WhoopEngineCommandLineOptions.Get().MeasurePassExecutionTime) { this.Timer.Stop(); Console.WriteLine(" | |"); Console.WriteLine(" | |--- [Total] {0}", this.Timer.Result()); Console.WriteLine(" |"); } Whoop.IO.BoogieProgramEmitter.Emit(this.AC.TopLevelDeclarations, WhoopEngineCommandLineOptions.Get().Files[ WhoopEngineCommandLineOptions.Get().Files.Count - 1], "check_" + this.Pair.EntryPoint1.Name + "_" + this.Pair.EntryPoint2.Name, "wbpl"); }
public void Run() { this.AC.EliminateDeadVariables(); this.AC.Inline(); if (WhoopCruncherCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine(" |------ [{0}]", this.EP.Name); Console.WriteLine(" | |"); this.Timer = new ExecutionTimer(); this.Timer.Start(); } HoudiniOutcome outcome = null; this.PerformHoudini(ref outcome); this.ApplyInvariants(ref outcome); this.AC.ResetToProgramTopLevelDeclarations(); ModelCleaner.RemoveGenericTopLevelDeclerations(this.PostAC, this.EP); ModelCleaner.RemoveUnusedTopLevelDeclerations(this.AC); ModelCleaner.RemoveGlobalLocksets(this.PostAC); ModelCleaner.RemoveExistentials(this.PostAC); if (!(WhoopCruncherCommandLineOptions.Get().InliningBound > 0 && this.AC.GetNumOfEntryPointRelatedFunctions(this.EP.Name) <= WhoopCruncherCommandLineOptions.Get().InliningBound)) { ModelCleaner.RemoveWhoopFunctions(this.PostAC); ModelCleaner.RemoveConstants(this.PostAC); ModelCleaner.RemoveImplementations(this.PostAC); } if (WhoopCruncherCommandLineOptions.Get().MeasurePassExecutionTime) { this.Timer.Stop(); Console.WriteLine(" | |"); Console.WriteLine(" | |--- [Total] {0}", this.Timer.Result()); Console.WriteLine(" |"); } Whoop.IO.BoogieProgramEmitter.Emit(this.PostAC.TopLevelDeclarations, WhoopCruncherCommandLineOptions.Get().Files[ WhoopCruncherCommandLineOptions.Get().Files.Count - 1], this.EP.Name + "$summarised", "wbpl"); }
public void Run() { if (WhoopEngineCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine(" |------ [{0}]", this.EP.Name); Console.WriteLine(" | |"); this.Timer = new ExecutionTimer(); this.Timer.Start(); } Analysis.Factory.CreateFunctionPointerUseAnalysis(this.AC, this.EP).Run(); Analysis.Factory.CreateWatchdogInformationAnalysis(this.AC, this.EP).Run(); if (WhoopEngineCommandLineOptions.Get().MeasurePassExecutionTime) { this.Timer.Stop(); Console.WriteLine(" | |"); Console.WriteLine(" | |--- [Total] {0}", this.Timer.Result()); Console.WriteLine(" |"); } }
public void Run() { if (ParsingEngine.AlreadyParsed.Contains(this.EP.Name)) { return; } if (WhoopEngineCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine(" |------ [{0}]", this.EP.Name); Console.WriteLine(" | |"); this.Timer = new ExecutionTimer(); this.Timer.Start(); } Analysis.Factory.CreateLockAbstraction(this.AC).Run(); Refactoring.Factory.CreateLockRefactoring(this.AC, this.EP).Run(); Refactoring.Factory.CreateFunctionPointerRefactoring(this.AC, this.EP).Run(); Refactoring.Factory.CreateEntryPointRefactoring(this.AC, this.EP).Run(); ModelCleaner.RemoveCorralFunctions(this.AC); ModelCleaner.RemoveModelledProcedureBodies(this.AC); if (WhoopEngineCommandLineOptions.Get().MeasurePassExecutionTime) { this.Timer.Stop(); Console.WriteLine(" | |"); Console.WriteLine(" | |--- [Total] {0}", this.Timer.Result()); Console.WriteLine(" |"); } Whoop.IO.BoogieProgramEmitter.Emit(this.AC.TopLevelDeclarations, WhoopEngineCommandLineOptions.Get().Files[ WhoopEngineCommandLineOptions.Get().Files.Count - 1], this.EP.Name, "wbpl"); ParsingEngine.AlreadyParsed.Add(this.EP.Name); }
public void Run() { if (WhoopEngineCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine(" |------ [{0}]", this.EP.Name); Console.WriteLine(" | |"); this.Timer = new ExecutionTimer(); this.Timer.Start(); } // Analysis.Factory.CreatePairWatchdogInformationAnalysis(this.AC, this.EP).Run(); if (!WhoopEngineCommandLineOptions.Get().CheckInParamAliasing) { Analysis.Factory.CreateParameterAliasAnalysis(this.AC, this.EP).Run(); } Summarisation.Factory.CreateLocksetSummaryGeneration(this.AC, this.EP).Run(); Summarisation.Factory.CreateAccessCheckingSummaryGeneration(this.AC, this.EP).Run(); // Summarisation.Factory.CreateDomainKnowledgeSummaryGeneration(this.AC, this.EP).Run(); Summarisation.SummaryInformationParser.RegisterSummaryName(this.EP.Name); ModelCleaner.RemoveCorralFunctions(this.AC); if (WhoopEngineCommandLineOptions.Get().MeasurePassExecutionTime) { this.Timer.Stop(); Console.WriteLine(" | |"); Console.WriteLine(" | |--- [Total] {0}", this.Timer.Result()); Console.WriteLine(" |"); } Whoop.IO.BoogieProgramEmitter.Emit(this.AC.TopLevelDeclarations, WhoopEngineCommandLineOptions.Get().Files[ WhoopEngineCommandLineOptions.Get().Files.Count - 1], this.EP.Name + "$instrumented", "wbpl"); }
public static void Main(string[] args) { Contract.Requires(cce.NonNullElements(args)); CommandLineOptions.Install(new WhoopRaceCheckerCommandLineOptions()); try { WhoopRaceCheckerCommandLineOptions.Get().RunningBoogieFromCommandLine = true; if (!WhoopRaceCheckerCommandLineOptions.Get().Parse(args)) { Environment.Exit((int)Outcome.FatalError); } if (WhoopRaceCheckerCommandLineOptions.Get().Files.Count == 0) { Whoop.IO.Reporter.ErrorWriteLine("Whoop: error: no input files were specified"); Environment.Exit((int)Outcome.FatalError); } List <string> fileList = new List <string>(); foreach (string file in WhoopRaceCheckerCommandLineOptions.Get().Files) { string extension = Path.GetExtension(file); if (extension != null) { extension = extension.ToLower(); } fileList.Add(file); } foreach (string file in fileList) { Contract.Assert(file != null); string extension = Path.GetExtension(file); if (extension != null) { extension = extension.ToLower(); } if (extension != ".bpl") { Whoop.IO.Reporter.ErrorWriteLine("Whoop: error: {0} is not a .bpl file", file); Environment.Exit((int)Outcome.FatalError); } } DeviceDriver.ParseAndInitialize(fileList); Summarisation.SummaryInformationParser.FromFile(fileList); PipelineStatistics stats = new PipelineStatistics(); ExecutionTimer timer = null; if (WhoopRaceCheckerCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine("\n[RaceChecker] runtime"); Console.WriteLine(" |"); timer = new ExecutionTimer(); timer.Start(); } var pairMap = new Dictionary <EntryPointPair, Tuple <AnalysisContext, ErrorReporter> >(); foreach (var pair in DeviceDriver.EntryPointPairs) { AnalysisContext ac = null; var parser = new AnalysisContextParser(fileList[fileList.Count - 1], "wbpl"); var errorReporter = new ErrorReporter(pair); if (pair.EntryPoint1.Name.Equals(pair.EntryPoint2.Name)) { string extension = null; if (Summarisation.SummaryInformationParser.AvailableSummaries.Contains(pair.EntryPoint1.Name)) { extension = "$summarised"; } else { extension = "$instrumented"; } parser.TryParseNew(ref ac, new List <string> { "check_" + pair.EntryPoint1.Name + "_" + pair.EntryPoint2.Name, pair.EntryPoint1.Name + extension }); } else { string extension1 = null; if (Summarisation.SummaryInformationParser.AvailableSummaries.Contains(pair.EntryPoint1.Name)) { extension1 = "$summarised"; } else { extension1 = "$instrumented"; } string extension2 = null; if (Summarisation.SummaryInformationParser.AvailableSummaries.Contains(pair.EntryPoint2.Name)) { extension2 = "$summarised"; } else { extension2 = "$instrumented"; } parser.TryParseNew(ref ac, new List <string> { "check_" + pair.EntryPoint1.Name + "_" + pair.EntryPoint2.Name, pair.EntryPoint1.Name + extension1, pair.EntryPoint2.Name + extension2 }); } new StaticLocksetAnalyser(ac, pair, errorReporter, stats).Run(); pairMap.Add(pair, new Tuple <AnalysisContext, ErrorReporter>(ac, errorReporter)); } if (WhoopRaceCheckerCommandLineOptions.Get().FindBugs) { foreach (var pair in pairMap) { if (!WhoopRaceCheckerCommandLineOptions.Get().YieldAll&& WhoopRaceCheckerCommandLineOptions.Get().SkipRaceFreePairs&& !pair.Value.Item2.FoundErrors) { continue; } AnalysisContext ac = null; new AnalysisContextParser(fileList[fileList.Count - 1], "wbpl").TryParseNew(ref ac); new YieldInstrumentationEngine(ac, pair.Key, pair.Value.Item1, pair.Value.Item2).Run(); } } if (WhoopRaceCheckerCommandLineOptions.Get().MeasurePassExecutionTime) { timer.Stop(); Console.WriteLine(" |"); Console.WriteLine(" |--- [Total] {0}", timer.Result()); } Whoop.IO.Reporter.WriteTrailer(stats); Outcome oc = Outcome.Done; if ((stats.ErrorCount + stats.InconclusiveCount + stats.TimeoutCount + stats.OutOfMemoryCount) > 0) { oc = Outcome.LocksetAnalysisError; } Environment.Exit((int)oc); } catch (Exception e) { Console.Error.Write("Exception thrown in Whoop: "); Console.Error.WriteLine(e); Environment.Exit((int)Outcome.FatalError); } }
public static void Main(string[] args) { Contract.Requires(cce.NonNullElements(args)); CommandLineOptions.Install(new WhoopCruncherCommandLineOptions()); WhoopCruncherCommandLineOptions.Get().PrintUnstructured = 2; try { WhoopCruncherCommandLineOptions.Get().RunningBoogieFromCommandLine = true; if (!WhoopCruncherCommandLineOptions.Get().Parse(args)) { Environment.Exit((int)Outcome.FatalError); } if (WhoopCruncherCommandLineOptions.Get().Files.Count == 0) { Whoop.IO.Reporter.ErrorWriteLine("Whoop: error: no input files were specified"); Environment.Exit((int)Outcome.FatalError); } List <string> fileList = new List <string>(); foreach (string file in WhoopCruncherCommandLineOptions.Get().Files) { string extension = Path.GetExtension(file); if (extension != null) { extension = extension.ToLower(); } fileList.Add(file); } foreach (string file in fileList) { Contract.Assert(file != null); string extension = Path.GetExtension(file); if (extension != null) { extension = extension.ToLower(); } if (extension != ".bpl") { Whoop.IO.Reporter.ErrorWriteLine("Whoop: error: {0} is not a .bpl file", file); Environment.Exit((int)Outcome.FatalError); } } DeviceDriver.ParseAndInitialize(fileList); Summarisation.SummaryInformationParser.FromFile(fileList); ExecutionTimer timer = null; if (WhoopCruncherCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine("\n[Cruncher] runtime"); Console.WriteLine(" |"); timer = new ExecutionTimer(); timer.Start(); } var alreadyCrunched = new HashSet <string>(); foreach (var ep in DeviceDriver.EntryPoints) { if (!Summarisation.SummaryInformationParser.AvailableSummaries.Contains(ep.Name)) { continue; } if (alreadyCrunched.Contains(ep.Name)) { continue; } AnalysisContext ac = null; AnalysisContext acPost = null; new AnalysisContextParser(fileList[fileList.Count - 1], "wbpl").TryParseNew( ref ac, new List <string> { ep.Name + "$instrumented" }); new AnalysisContextParser(fileList[fileList.Count - 1], "wbpl").TryParseNew( ref acPost, new List <string> { ep.Name + "$instrumented" }); new InvariantInferrer(ac, acPost, ep).Run(); alreadyCrunched.Add(ep.Name); } if (WhoopCruncherCommandLineOptions.Get().MeasurePassExecutionTime) { timer.Stop(); Console.WriteLine(" |"); Console.WriteLine(" |--- [Total] {0}", timer.Result()); } Environment.Exit((int)Outcome.Done); } catch (Exception e) { Console.Error.Write("Exception thrown in Whoop: "); Console.Error.WriteLine(e); Environment.Exit((int)Outcome.FatalError); } }
public void Run() { if (WhoopEngineCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine(" |------ [{0}]", this.EP.Name); Console.WriteLine(" | |"); this.Timer = new ExecutionTimer(); this.Timer.Start(); } SharedStateAnalyser.AnalyseMemoryRegionsWithPairInformation(this.AC, this.EP); Instrumentation.Factory.CreateInstrumentationRegionsConstructor(this.AC, this.EP).Run(); Instrumentation.Factory.CreateGlobalRaceCheckingInstrumentation(this.AC, this.EP).Run(); Instrumentation.Factory.CreateLocksetInstrumentation(this.AC, this.EP).Run(); Instrumentation.Factory.CreateDomainKnowledgeInstrumentation(this.AC, this.EP).Run(); Instrumentation.Factory.CreateRaceInstrumentation(this.AC, this.EP).Run(); Analysis.Factory.CreateSharedStateAbstraction(this.AC).Run(); if (this.EP.IsEnablingDevice) { Refactoring.Factory.CreateDeviceEnableProgramSlicing(this.AC, this.EP).Run(); } else if (this.EP.IsDisablingDevice) { Refactoring.Factory.CreateDeviceDisableProgramSlicing(this.AC, this.EP).Run(); } if (this.EP.IsClone && this.EP.IsGoingToDisableNetwork) { Refactoring.Factory.CreateNetDisableProgramSlicing(this.AC, this.EP).Run(); } else if (this.EP.IsClone && this.EP.IsCalledWithNetworkDisabled) { Refactoring.Factory.CreateNetEnableProgramSlicing(this.AC, this.EP).Run(); } Instrumentation.Factory.CreateErrorReportingInstrumentation(this.AC, this.EP).Run(); if (WhoopEngineCommandLineOptions.Get().SkipInference) { ModelCleaner.RemoveGenericTopLevelDeclerations(this.AC, this.EP); ModelCleaner.RemoveUnusedTopLevelDeclerations(this.AC); ModelCleaner.RemoveGlobalLocksets(this.AC); ModelCleaner.RemoveInlineFromHelperFunctions(this.AC, this.EP); } else if (WhoopEngineCommandLineOptions.Get().InliningBound > 0 && this.AC.GetNumOfEntryPointRelatedFunctions(this.EP.Name) <= WhoopEngineCommandLineOptions.Get().InliningBound) { this.AC.InlineEntryPoint(this.EP); } else { ModelCleaner.RemoveInlineFromHelperFunctions(this.AC, this.EP); } ModelCleaner.RemoveUnecesseryInfoFromSpecialFunctions(this.AC); ModelCleaner.RemoveCorralFunctions(this.AC); if (WhoopEngineCommandLineOptions.Get().MeasurePassExecutionTime) { this.Timer.Stop(); Console.WriteLine(" | |"); Console.WriteLine(" | |--- [Total] {0}", this.Timer.Result()); Console.WriteLine(" |"); } if (WhoopEngineCommandLineOptions.Get().SkipInference) { Whoop.IO.BoogieProgramEmitter.Emit(this.AC.TopLevelDeclarations, WhoopEngineCommandLineOptions.Get().Files[ WhoopEngineCommandLineOptions.Get().Files.Count - 1], this.EP.Name + "$instrumented", "wbpl"); } }
public void Run() { if (WhoopRaceCheckerCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine(" |------ [{0} :: {1}]", this.EP1.Name, this.EP2.Name); Console.WriteLine(" | |"); this.Timer = new ExecutionTimer(); this.Timer.Start(); } this.AC.EliminateDeadVariables(); this.AC.Inline(); if (WhoopRaceCheckerCommandLineOptions.Get().LoopUnrollCount != -1) { this.AC.Program.UnrollLoops(WhoopRaceCheckerCommandLineOptions.Get().LoopUnrollCount, WhoopRaceCheckerCommandLineOptions.Get().SoundLoopUnrolling); } string checkerName = "check$" + this.EP1.Name + "$" + this.EP2.Name; Implementation checker = this.AC.TopLevelDeclarations.OfType <Implementation>().ToList(). Find(val => val.Name.Equals(checkerName)); Contract.Assert(checker != null); VC.ConditionGeneration vcgen = null; try { vcgen = new VC.VCGen(this.AC.Program, WhoopRaceCheckerCommandLineOptions.Get().SimplifyLogFilePath, WhoopRaceCheckerCommandLineOptions.Get().SimplifyLogFileAppend, new List <Checker>()); } catch (ProverException e) { Whoop.IO.Reporter.ErrorWriteLine("Fatal Error: ProverException: {0}", e); Environment.Exit((int)Outcome.FatalError); } int prevAssertionCount = vcgen.CumulativeAssertionCount; List <Counterexample> errors; DateTime start = new DateTime(); if (WhoopRaceCheckerCommandLineOptions.Get().Trace) { start = DateTime.UtcNow; if (WhoopRaceCheckerCommandLineOptions.Get().Trace) { Console.WriteLine(""); Console.WriteLine("Verifying {0} ...", checker.Name.Substring(5)); } } VC.VCGen.Outcome vcOutcome; try { vcOutcome = vcgen.VerifyImplementation(checker, out errors); } catch (VC.VCGenException e) { Whoop.IO.Reporter.ReportBplError(checker, String.Format("Error BP5010: {0} Encountered in implementation {1}.", e.Message, checker.Name), true, true); errors = null; vcOutcome = VC.VCGen.Outcome.Inconclusive; } catch (UnexpectedProverOutputException e) { Whoop.IO.Reporter.AdvisoryWriteLine("Advisory: {0} SKIPPED because of internal error: unexpected prover output: {1}", checker.Name, e.Message); errors = null; vcOutcome = VC.VCGen.Outcome.Inconclusive; } string timeIndication = ""; DateTime end = DateTime.UtcNow; TimeSpan elapsed = end - start; if (WhoopRaceCheckerCommandLineOptions.Get().Trace) { int poCount = vcgen.CumulativeAssertionCount - prevAssertionCount; timeIndication = string.Format(" [{0:F3} s, {1} proof obligation{2}] ", elapsed.TotalSeconds, poCount, poCount == 1 ? "" : "s"); } this.ProcessOutcome(checker, vcOutcome, errors, timeIndication, this.Stats); if (vcOutcome == VC.VCGen.Outcome.Errors || WhoopRaceCheckerCommandLineOptions.Get().Trace) { Console.Out.Flush(); } WhoopRaceCheckerCommandLineOptions.Get().TheProverFactory.Close(); // cce.NonNull(WhoopRaceCheckerCommandLineOptions.Get().TheProverFactory).Close(); vcgen.Dispose(); if (WhoopRaceCheckerCommandLineOptions.Get().MeasurePassExecutionTime) { this.Timer.Stop(); Console.WriteLine(" | |------ [StaticLocksetAnalyser] {0}", this.Timer.Result()); Console.WriteLine(" |"); } }