Esempio n. 1
0
        public double PerformIdentification(ClarifierContext ctx)
        {
            SherlockNode loadStage = new SherlockNode(ctx.ILLanguage["ArgumentLoad"].Childs)
            {
                Name      = "LoadStage",
                MaxNumber = null,
                MinNumber = 1,
                Mode      = TestMode.InRange
            };
            SherlockNode callStage = new SherlockNode(ctx.ILLanguage["Call"].Childs)
            {
                Name      = "CallStage",
                MaxNumber = 1,
                MinNumber = 1,
                Mode      = TestMode.InRange
            };
            SherlockNode returnStage = new SherlockNode(ctx.ILLanguage["Return"].Childs)
            {
                Name      = "ReturnStage",
                MaxNumber = 1,
                MinNumber = 1,
                Mode      = TestMode.InRange
            };

            SherlockNode proxyCall = new SherlockNode(new SherlockNode[] { loadStage, callStage, returnStage })
            {
                Name      = "ProxyCall",
                MinNumber = 1,
                MaxNumber = 1,
                Mode      = TestMode.MatchEverything
            };

            foreach (var method in ctx.CurrentModule.GetMethods())
            {
                if (!method.HasBody)
                {
                    continue;
                }

                ComparisonContext compCtx = new ComparisonContext()
                {
                    InstructionList = method.Body.Instructions.ToList()
                };

                if (proxyCall.Test(compCtx) == ConditionOutcome.Matched)
                {
                    referenceProxyMethods[method] = null;
                }
            }

            if (referenceProxyMethods.Count != 0)
            {
                return(1.0);
            }
            return(0.0);
        }
Esempio n. 2
0
 void InitCompiler()
 {
     language = loader.LoadLanguage();
 }