Exemplo n.º 1
0
		protected override void RunTest(Program prog, TextWriter writer)
		{
			var eventListener = new FakeDecompilerEventListener();
			var dfa = new DataFlowAnalysis(prog, eventListener);
			var trf = new TrashedRegisterFinder(prog, prog.Procedures.Values, dfa.ProgramDataFlow, eventListener);
			trf.Compute();
			trf.RewriteBasicBlocks();
			var rl = RegisterLiveness.Compute(prog, dfa.ProgramDataFlow, eventListener);
			DumpProcedureFlows(prog, dfa, rl, writer);
		}
Exemplo n.º 2
0
 public void Setup()
 {
     mr = new MockRepository();
     sc = new ServiceContainer();
     eventListener = new FakeDecompilerEventListener();
     cfgSvc = mr.Stub<IConfigurationService>();
     signatureFiles = new List<SignatureFileElement>();
     sc.AddService<DecompilerEventListener>(eventListener);
     sc.AddService<IConfigurationService>(cfgSvc);
     cfgSvc.Stub(d => d.GetSignatureFiles()).Return(signatureFiles);
 }
Exemplo n.º 3
0
 protected override void RunTest(Program prog, TextWriter writer)
 {
     var dfa = new DataFlowAnalysis(prog, new FakeDecompilerEventListener());
     var eventListener = new FakeDecompilerEventListener();
     var trf = new TrashedRegisterFinder(prog, prog.Procedures.Values, dfa.ProgramDataFlow, eventListener);
     trf.Compute();
     trf.RewriteBasicBlocks();
     RegisterLiveness rl = RegisterLiveness.Compute(prog, dfa.ProgramDataFlow, eventListener);
     foreach (Procedure proc in prog.Procedures.Values)
     {
         LongAddRewriter larw = new LongAddRewriter(proc, prog.Architecture);
         larw.Transform();
         proc.Write(false, writer);
         writer.WriteLine();
     }
 }
Exemplo n.º 4
0
		protected override void RunTest(Program prog, TextWriter writer)
		{
            var flow = new ProgramDataFlow(prog);
            var eventListener = new FakeDecompilerEventListener();
            var trf = new TrashedRegisterFinder(prog, prog.Procedures.Values, flow, eventListener);
            trf.Compute();
            trf.RewriteBasicBlocks();
            Dump(prog.CallGraph);
            var rl = RegisterLiveness.Compute(prog, flow, eventListener);
            GlobalCallRewriter.Rewrite(prog, flow);

			foreach (Procedure proc in prog.Procedures.Values)
			{
				Aliases alias = new Aliases(proc, prog.Architecture);
				alias.Transform();
				var gr = proc.CreateBlockDominatorGraph();
				SsaTransform sst = new SsaTransform(flow, proc, gr);
				ssa = sst.SsaState;
				ssa.Write(writer);
				proc.Write(false, true, writer);
				writer.WriteLine();
			}
		}
Exemplo n.º 5
0
        private Program RewriteProgram()
        {
            var project = new Project { Programs = { program } };
            var scan = new Scanner(
                program,
                new Dictionary<Address, ProcedureSignature>(),
                new ImportResolver(project),
                new FakeDecompilerEventListener());
            foreach (EntryPoint ep in program.EntryPoints)
            {
                scan.EnqueueEntryPoint(ep);
            }
            scan.ScanImage();

            DecompilerEventListener eventListener = new FakeDecompilerEventListener();
            DataFlowAnalysis da = new DataFlowAnalysis(program, eventListener);
            da.AnalyzeProgram();

            return program;
        }