public void Setup() { this.sc = new ServiceContainer(); var cfg = new Mock <IConfigurationService>(); var env = new Mock <PlatformDefinition>(); cfg.Setup(c => c.GetEnvironment(It.IsAny <string>())).Returns(env.Object); env.Setup(e => e.Architectures).Returns(new List <PlatformArchitectureDefinition>()); sc.AddService <IConfigurationService>(cfg.Object); sc.AddService <IPluginLoaderService>(new PluginLoaderService()); this.win32 = new Win32Platform(sc, new X86ArchitectureFlat32(sc, "x86-protected-32", new Dictionary <string, object>())); this.win_x86_64 = new Win_x86_64_Platform(sc, new X86ArchitectureFlat64(sc, "x86-protected-64", new Dictionary <string, object>())); this.sysV_ppc = new SysVPlatform(sc, new PowerPcBe32Architecture(sc, "ppc-be-32", new Dictionary <string, object>())); this.m = new ProcedureBuilder(); this.printfChr = new ProcedureCharacteristics() { VarargsParserClass = "Reko.Libraries.Libc.PrintfFormatParser,Reko.Libraries.Libc" }; this.x86PrintfSig = new FunctionType( null, StackId(null, 4, CStringType32())) { IsVariadic = true }; this.x86SprintfSig = new FunctionType( null, StackId(null, 4, CStringType32()), StackId(null, 8, CStringType32())) { IsVariadic = true }; this.win_x86_64PrintfSig = new FunctionType( null, RegId(null, win_x86_64, "rcx", CStringType64())) { IsVariadic = true }; this.ppcPrintfSig = new FunctionType( null, RegId(null, sysV_ppc, "r3", CStringType32())) { IsVariadic = true }; this.addrInstr = Address.Ptr32(0x123400); this.listener = new FakeDecompilerEventListener(); sc.AddService <DecompilerEventListener>(listener); this.dummyPc = new ProcedureConstant(PrimitiveType.Ptr32, new ExternalProcedure("dummy", x86PrintfSig)); }
public void Setup() { this.mr = new MockRepository(); this.sc = new ServiceContainer(); var cfg = mr.Stub <IConfigurationService>(); var env = mr.Stub <OperatingEnvironment>(); cfg.Stub(c => c.GetEnvironment("")).IgnoreArguments().Return(env); env.Stub(e => e.Architectures).Return(new List <IPlatformArchitectureElement>()); cfg.Replay(); env.Replay(); sc.AddService <IConfigurationService>(cfg); this.win32 = new Win32Platform(sc, new X86ArchitectureFlat32()); this.win_x86_64 = new Win_x86_64_Platform(sc, new X86ArchitectureFlat64()); this.sysV_ppc = new SysVPlatform(sc, new PowerPcBe32Architecture { Name = "ppc-be-32" }); this.m = new ProcedureBuilder(); this.printfChr = new ProcedureCharacteristics() { VarargsParserClass = "Reko.Libraries.Libc.PrintfFormatParser,Reko.Libraries.Libc" }; this.x86PrintfSig = new FunctionType( null, StackId(null, 4, CStringType32()), StackId("...", 8, new UnknownType())); this.x86SprintfSig = new FunctionType( null, StackId(null, 4, CStringType32()), StackId(null, 8, CStringType32()), StackId("...", 12, new UnknownType())); this.win_x86_64PrintfSig = new FunctionType( null, RegId(null, win_x86_64, "rcx", CStringType64()), RegId("...", win_x86_64, "rdx", new UnknownType())); this.ppcPrintfSig = new FunctionType( null, RegId(null, sysV_ppc, "r3", CStringType32()), RegId("...", sysV_ppc, "r4", new UnknownType())); this.addrInstr = Address.Ptr32(0x123400); var listener = new FakeDecompilerEventListener(); sc.AddService <DecompilerEventListener>(listener); }