Esempio n. 1
0
        public static void Main(string[] args)
        {
            Contract.Requires(cce.NonNullElements(args));

            CommandLineOptions.Install(new WhoopEngineCommandLineOptions());

            try
            {
                WhoopEngineCommandLineOptions.Get().RunningBoogieFromCommandLine = true;
                WhoopEngineCommandLineOptions.Get().PrintUnstructured            = 2;

                if (!WhoopEngineCommandLineOptions.Get().Parse(args))
                {
                    Environment.Exit((int)Outcome.FatalError);
                }

                if (WhoopEngineCommandLineOptions.Get().Files.Count == 0)
                {
                    Whoop.IO.Reporter.ErrorWriteLine("Whoop: error: no input files were specified");
                    Environment.Exit((int)Outcome.FatalError);
                }

                foreach (string file in WhoopEngineCommandLineOptions.Get().Files)
                {
                    string extension = Path.GetExtension(file);
                    if (extension != null)
                    {
                        extension = extension.ToLower();
                    }
                    Program.FileList.Add(file);
                }

                foreach (string file in Program.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(Program.FileList);
                FunctionPointerInformation.ParseAndInitialize(Program.FileList);

                if (WhoopEngineCommandLineOptions.Get().PrintPairs)
                {
                    DeviceDriver.EmitEntryPointPairs(Program.FileList);
                }

                Program.RunParsingEngine();
                Program.RunStaticLocksetAnalysisInstrumentationEngine();
                Program.RunSummaryGenerationEngine();
                Program.RunPairWiseCheckingInstrumentationEngine();

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