public void Run(
            ICodeLayer <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ContextData, EdgeData> codeLayer, DFAController controller
            )
        {
            Contract.Requires(codeLayer != null);

            this.codeLayer = codeLayer;
            var closure = codeLayer.CreateForward <bool>(this, this.Options, controller);

            closure(true);   // Do the analysis
        }
示例#2
0
 public ILHasher(
     ICodeLayer <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Source, Dest, IStackContext <Field, Method>, Unit> codeLayer,
     StreamWriter tw,
     Func <Type, int> typeReferencer,
     Func <Method, int> inlineMethod
     )
 {
     this.codeLayer      = codeLayer;
     this.tw             = tw;
     this.typeReferencer = typeReferencer;
     this.inlineMethod   = inlineMethod;
 }
        private ICFG contractFreeCFG; // computed on demand

        protected BasicMethodDriver(
            Method method,
            IBasicAnalysisDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, LogOptions> parent
            )
        {
            Contract.Requires(parent != null);

            this.method = method;
            this.parent = parent;
            var rawCFG = this.parent.MethodCache.GetCFG(method);

            // Here we build our stack of adapters.
            //
            //  StackDepth    (Temp decoder for APC)
            //  CFG           (Unit decoder for APC, including Assume)
            //  cciilprovider (Unit decoder for PC)
            //

            rawLayer = CodeLayerFactory.Create(
                rawCFG.GetDecoder(parent.MetaDataDecoder),
                parent.MetaDataDecoder,
                parent.ContractDecoder,
                (unit) => "",
                (unit) => "",
                (v1, v2) => false);

            if (PrintIL)
            {
                Console.WriteLine("-----------------APC based CFG---------------------");
                this.RawLayer.Decoder.AssumeNotNull().Context.MethodContext.CFG.Print(Console.Out, this.RawLayer.Printer, null, null, null);
            }

            stackLayer = CodeLayerFactory.Create(
                StackDepthFactory.Create(
                    this.RawLayer.Decoder,
                    this.RawLayer.MetaDataDecoder),
                this.RawLayer.MetaDataDecoder,
                this.RawLayer.ContractDecoder,
                delegate(int i) { return("s" + i.ToString()); },
                delegate(int i) { return("s" + i.ToString()); },
                (s1, s2) => false
                );

            if (PrintIL)
            {
                Console.WriteLine("-----------------Stack based CFG---------------------");
                this.StackLayer.Decoder.AssumeNotNull().Context.MethodContext.CFG.Print(Console.Out, StackLayer.Printer, null, null, null);
            }

            // set static wp tracing option
            WeakestPreconditionProver.Trace           = parent.Options.TraceWP;
            WeakestPreconditionProver.EmitSMT2Formula = parent.Options.EmitSMT2Formula;
        }
示例#4
0
 public void Run(ICodeLayer <Expression, Variable, ContextData, EdgeData> codeLayer)
 {
     this.codeLayer = codeLayer;
     codeLayer.CreateForward(this) (true);
 }
示例#5
0
 public ExpressionAnalysisFacade(ICodeLayer <TSymValue, TSymValue, TContext, TEdgeData> valueLayer,
                                 Predicate <APC> isUnreachable)
 {
     this.ValueLayer    = valueLayer;
     this.IsUnreachable = isUnreachable;
 }
示例#6
0
 public HeapAnalysis(ICodeLayer <int, int, IStackContextProvider, Dummy> stackLayer)
 {
     this.stackLayer = stackLayer;
 }