Exemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="program">Program</param>
        internal AbstractEngine(Program program)
        {
            Contract.Requires(program != null);
            this.Program = program;

            if (ToolCommandLineOptions.Get().MeasureTime)
            {
                this.Timer = new ExecutionTimer();
            }
        }
Exemplo n.º 2
0
        internal static void Main(string[] args)
        {
            Contract.Requires(cce.NonNullElements(args));
            Driver.InstallCommandLineOptions(args);

            var program = new Program();

            try
            {
                ExecutionTimer timer = null;
                if (ToolCommandLineOptions.Get().MeasureTime)
                {
                    timer = new ExecutionTimer();
                    timer.Start();
                }

                Driver.ParseFiles(program);

                try
                {
                    Driver.ParseAnalyzeAndSequentialize(program);
                    Driver.RunSummarizationEngine(program);
                    Driver.RunReachabilityAnalysisEngine(program);
                }
                catch (AnalysisFailedException)
                {
                    Lockpwn.IO.Reporter.WarningWriteLine("Warning: Failed fast");
                }

                if (ToolCommandLineOptions.Get().MeasureTime)
                {
                    timer.Stop();
                    Output.PrintLine(". Done [{0}]", timer.Result());
                }
                else if (ToolCommandLineOptions.Get().VerboseMode)
                {
                    Output.PrintLine(". Done");
                }

                Driver.CleanUpTemporaryFiles(program);
                Environment.Exit((int)Outcome.Done);
            }
            catch (Exception e)
            {
                Console.Error.Write("Exception thrown in lockpwn: ");
                Console.Error.WriteLine(e);
                Driver.CleanUpTemporaryFiles(program);
                Environment.Exit((int)Outcome.FatalError);
            }
        }