예제 #1
0
        public static int Main(string[] args, IVerySimpleLineWriterWithEncoding lineWriter)
        {
            Contract.Requires(lineWriter != null);

            string[] dummy;
            return(ClousotViaService.Main2(args, lineWriter, out dummy));
        }
        public static int Main(string[] args)
        {
            // Make sure the Windows Service is running
            EnsureWindowsService();

            // Call the WCF Service hosted by the Windows Service, assuming it is now running
            return(ClousotViaService.Main(args));
        }
예제 #3
0
 /// <summary>
 /// Entry point for Clousot
 /// </summary>
 public static int Main(string[] args)
 {
     try
     {
         return(ClousotViaService.Main(args));
     }
     catch (Exception)
     {
         Console.WriteLine("Process terminated with an exception".PrefixWithCurrentTime());
         return(-1);
     }
 }
예제 #4
0
        public static int Main(string[] args, IOutputFullResultsFactory <MethodReferenceAdaptor, IAssemblyReference> outputFactory, IEnumerable <Caching.IClousotCacheFactory> cacheAccessorFactories)
        {
            Contract.Requires(args != null);

            if (args.Length > 0 && args[0] == "-cloudot")
            {
                try
                {
                    return(ClousotViaService.Main(args));
                }
                catch (Exception)
                {
                    Console.WriteLine("Process terminated with an exception".PrefixWithCurrentTime());
                    return(-1);
                }
            }
            else
            {
                var cciilProvider   = CciILCodeProvider.CreateCodeProvider();
                var metadataDecoder = cciilProvider.MetaDataDecoder;
                var contractDecoder = cciilProvider.ContractDecoder;
                var assemblyCache   = new System.Collections.Hashtable();

                try
                {
                    int returnCode = Clousot.ClousotMain(args,
                                                         metadataDecoder,
                                                         contractDecoder,
                                                         assemblyCache,
                                                         outputFactory: outputFactory,
                                                         cacheAccessorFactories: cacheAccessorFactories
                                                         );

                    return(returnCode); // important for regressions
                }
                catch (ExitRequestedException e)
                {
                    return(e.ExitCode);
                }
                finally
                {
                    cciilProvider.Dispose();
                }
            }
        }
예제 #5
0
        public static int Main(string[] args, IOutputFullResultsFactory <System.Compiler.Method, System.Compiler.AssemblyNode> outputFactory, IEnumerable <Caching.IClousotCacheFactory> cacheAccessorFactories)
        {
            Contract.Requires(args != null);

#if USECLOUDOT
            if (OptionsHelper.UseCloudot(args))
            {
                // Just an horrible shortcut to invoke the debugger
                if (args.Contains("-break"))
                {
                    System.Diagnostics.Debugger.Launch();
                }

                for (var i = 0; i < CloudotAnalysesRetry; i++)
                {
                    string[] clousotArgs = null;
                    try
                    {
                        return(ClousotViaService.Main(args, out clousotArgs));
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Connection to Cloudot terminated with an exception".PrefixWithCurrentTime());
                        Console.WriteLine("Exception details: {0}", e.ToString());

                        if (i == CloudotAnalysesRetry - 1)
                        {
                            Console.WriteLine("We gave up with the service. Reverting to local execution");
                        }
                        else
                        {
                            Console.WriteLine("Try to use the Cloudot again (remaining {0})", CloudotAnalysesRetry - (i - 1));
                        }

                        args = clousotArgs; // We use the service specific options in the case we revert to local execution
                    }
                }
            }
#endif
            var assemblyCache = new Hashtable();
            try
            {
#if DEBUG
#if USECLOUDOT
                if (args != null)
#endif
                {
                    args = args.Where(s => s != StringConstants.DoNotUseCloudot).ToArray();
                }
#endif
                return(Clousot.ClousotMain(args, CCIMDDecoder.Value, CCIContractDecoder.Value, assemblyCache, outputFactory, cacheAccessorFactories));
            }
            catch (ExitRequestedException e)
            {
                return(e.ExitCode);
            }
            finally
            {
                DisposeAssemblies(assemblyCache.Values);
            }
        }
예제 #6
0
 // Here we invoke the remote service
 protected override int CallClousotMain(string[] args, TextWriter output)
 {
     string[] dummy;
     return(ClousotViaService.Main2(args, output, out dummy));
 }