Exemplo n.º 1
0
 public CodeLayer(IDecodeMSIL <APC, Local, Parameter, Method, Field, Type, Expression, Variable, ContextData, EdgeData> ildecoder, IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder, IDecodeContracts <Local, Parameter, Method, Field, Type> ctDecoder,
                  Converter <Expression, string> expression2String, Converter <Variable, string> variable2String,
                  ILPrinter <APC> printer, Func <Variable, Variable, bool> newerThan)
     : this(ildecoder, mdDecoder, ctDecoder, expression2String, variable2String, newerThan)
 {
     this.printer = printer;
 }
Exemplo n.º 2
0
        public static ForwardAnalysisSolver <AState, Type, EdgeData> Make <Local, Parameter, Method, Field, Source, Dest, Context>(
            IDecodeMSIL <APC, Local, Parameter, Method, Field, Type, Source, Dest, Context, EdgeData> decoder,
            IAnalysis <APC, AState, IVisitMSIL <APC, Local, Parameter, Method, Field, Type, Source, Dest, AState, AState>, EdgeData> driver,
            ILPrinter <APC> printer
            )
            where Context : IMethodContext <Field, Method>
        {
            Contract.Requires(decoder != null);
            Contract.Requires(driver != null);

            IVisitMSIL <APC, Local, Parameter, Method, Field, Type, Source, Dest, AState, AState> visitor = driver.Visitor();
            var result = new ForwardAnalysisSolver <AState, Type, EdgeData>(
                decoder.Context.MethodContext.CFG,
                delegate(APC pc, AState state) { return(decoder.ForwardDecode <AState, AState, IVisitMSIL <APC, Local, Parameter, Method, Field, Type, Source, Dest, AState, AState> >(pc, visitor, state)); },
                driver.EdgeConversion,
                driver.Join,
                driver.ImmutableVersion,
                driver.MutableVersion,
                driver.Dump,
                delegate(APC pc, AState state) { return(decoder.IsUnreachable(pc) || driver.IsBottom(pc, state)); },
                delegate(APC pc, AState state) { return(driver.IsTop(pc, state)); },
                printer,
                decoder.Display,
                decoder.EdgeData
                );

            result.CachePolicy = driver.CacheStates(result);
            return(result);
        }
Exemplo n.º 3
0
 public static AssumptionFinder <Label> Create <Label, Local, Parameter, Method, Field, Property, Event, Type, Source, Dest, Context, Attribute, Assembly, EdgeData>(
     IDecodeMSIL <Label, Local, Parameter, Method, Field, Type, Source, Dest, Context, EdgeData> ilDecoder,
     IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder,
     Converter <Source, string> sourceName,
     Converter <Dest, string> destName
     )
 {
     return(new SearchAssumptions <Label, Local, Parameter, Method, Field, Property, Event, Type, Source, Dest, Context, Attribute, Assembly, EdgeData>(ilDecoder, mdDecoder, sourceName, destName).SearchAssumptionAt);
 }
Exemplo n.º 4
0
 public CodeLayer(IDecodeMSIL <APC, Local, Parameter, Method, Field, Type, Expression, Variable, ContextData, EdgeData> ildecoder, IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder, IDecodeContracts <Local, Parameter, Method, Field, Type> ctDecoder,
                  Converter <Expression, string> expression2String, Converter <Variable, string> variable2String,
                  Func <Variable, Variable, bool> newerThan)
 {
     this.ildecoder         = ildecoder;
     this.mdDecoder         = mdDecoder;
     this.ctDecoder         = ctDecoder;
     this.expression2String = expression2String;
     this.variable2String   = variable2String;
     this.newerThan         = newerThan;
 }
Exemplo n.º 5
0
 public SearchAssumptions(
     IDecodeMSIL <Label, Local, Parameter, Method, Field, Type, Source, Dest, Context, EdgeData> ilDecoder,
     IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder,
     Converter <Source, string> sourceName,
     Converter <Dest, string> destName
     )
 {
     this.ilDecoder  = ilDecoder;
     this.mdDecoder  = mdDecoder;
     this.sourceName = sourceName;
     this.destName   = destName;
 }
Exemplo n.º 6
0
        public static ILPrinter <Label> Create <Label, Local, Parameter, Method, Field, Property, Event, Type, Source, Dest, Context, Attribute, Assembly, EdgeData>(
            IDecodeMSIL <Label, Local, Parameter, Method, Field, Type, Source, Dest, Context, EdgeData> ilDecoder,
            IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder,
            Converter <Source, string> sourceName,
            Converter <Dest, string> destName
            )
        {
            Contract.Requires(ilDecoder != null);// F: Added as of Clousot suggestion

            ILPrinter <Label> printer = new Printer <Label, Local, Parameter, Method, Field, Property, Event, Type, Source, Dest, Context, Attribute, Assembly, EdgeData>(ilDecoder, mdDecoder, sourceName, destName).PrintCodeAt;

            return(printer);
        }
Exemplo n.º 7
0
            public Printer(
                IDecodeMSIL <Label, Local, Parameter, Method, Field, Type, Source, Dest, Context, EdgeData> ilDecoder,
                IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder,
                Converter <Source, string> sourceName,
                Converter <Dest, string> destName
                )
            {
                Contract.Requires(ilDecoder != null);// F: As of Clousot suggestion

                this.ilDecoder  = ilDecoder;
                this.mdDecoder  = mdDecoder;
                this.sourceName = sourceName;
                this.destName   = destName;
            }
Exemplo n.º 8
0
 Create <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ContextData, EdgeData>(
     IDecodeMSIL <APC, Local, Parameter, Method, Field, Type, Expression, Variable, ContextData, EdgeData> ildecoder,
     IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdDecoder,
     IDecodeContracts <Local, Parameter, Method, Field, Type> ctDecoder,
     Converter <Expression, string> expression2String,
     Converter <Variable, string> variable2String,
     Func <Variable, Variable, bool> newerThan
     )
     where Type : IEquatable <Type>
     where ContextData : IMethodContext <Field, Method>
 {
     return(new CodeLayer <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ContextData, EdgeData>(
                ildecoder, mdDecoder, ctDecoder,
                expression2String, variable2String,
                newerThan
                ));
 }