当前位置: 首页>>代码示例>>C#>>正文


C# IProcessorArchitecture.Stub方法代码示例

本文整理汇总了C#中IProcessorArchitecture.Stub方法的典型用法代码示例。如果您正苦于以下问题:C# IProcessorArchitecture.Stub方法的具体用法?C# IProcessorArchitecture.Stub怎么用?C# IProcessorArchitecture.Stub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProcessorArchitecture的用法示例。


在下文中一共展示了IProcessorArchitecture.Stub方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

 public void Setup()
 {
     mr = new MockRepository();
     program = new Program();
     proc = new Procedure("testProc", new Frame(PrimitiveType.Word32));
     block = proc.AddBlock("l00100000");
     trace = new RtlTrace(0x00100000);
     r0 = new Identifier("r0", PrimitiveType.Word32, new RegisterStorage("r0", 0, 0, PrimitiveType.Word32));
     r1 = new Identifier("r1", PrimitiveType.Word32, new RegisterStorage("r1", 1, 0, PrimitiveType.Word32));
     r2 = new Identifier("r2", PrimitiveType.Word32, new RegisterStorage("r2", 2, 0, PrimitiveType.Word32));
     sp = new Identifier("sp", PrimitiveType.Word32, new RegisterStorage("sp", 15, 0, PrimitiveType.Word32));
     grf = proc.Frame.EnsureFlagGroup(Registers.eflags, 3, "SCZ", PrimitiveType.Byte);
     var sc = new ServiceContainer();
     var listener = mr.Stub<DecompilerEventListener>();
     scanner = mr.StrictMock<IScanner>();
     arch = mr.Stub<IProcessorArchitecture>();
     program.Architecture = arch;
     program.SegmentMap = new SegmentMap(
         Address.Ptr32(0x00100000),
         new ImageSegment(
             ".text",
             new MemoryArea(Address.Ptr32(0x00100000), new byte[0x20000]),
             AccessMode.ReadExecute));
     arch.Replay();
     program.Platform = new DefaultPlatform(null, arch);
     arch.BackToRecord();
     arch.Stub(s => s.StackRegister).Return((RegisterStorage)sp.Storage);
     arch.Stub(s => s.PointerType).Return(PrimitiveType.Pointer32);
     scanner.Stub(s => s.Services).Return(sc);
     sc.AddService<DecompilerEventListener>(listener);
 }
开发者ID:relaxar,项目名称:reko,代码行数:31,代码来源:BlockWorkitemTests.cs

示例2: Given_i386_Architecture

 private void Given_i386_Architecture()
 {
     this.arch_386 = mr.StrictMock<IProcessorArchitecture>();
     arch_386.Stub(a => a.CreateFrame()).Return(new Frame(PrimitiveType.Pointer32));
     arch_386.Stub(a => a.WordWidth).Return(PrimitiveType.Word32);
     var state = mr.Stub<ProcessorState>();
     arch_386.Stub(a => a.CreateProcessorState()).Return(state);
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:8,代码来源:PeImageLoaderTests.cs

示例3: Setup

 public void Setup()
 {
     this.mr = new MockRepository();
     this.sc = new ServiceContainer();
     loader = mr.Stub<ILoader>();
     arch = mr.StrictMock<IProcessorArchitecture>();
     Address dummy;
     arch.Stub(a => a.TryParseAddress(null, out dummy)).IgnoreArguments().WhenCalled(m =>
     {
         Address addr;
         var sAddr = (string)m.Arguments[0];
         var iColon = sAddr.IndexOf(':');
         if (iColon > 0)
         {
             addr = Address.SegPtr(
                 Convert.ToUInt16(sAddr.Remove(iColon)),
                 Convert.ToUInt16(sAddr.Substring(iColon+1)));
             m.ReturnValue = true;
         }
         else
         {
             m.ReturnValue = Address32.TryParse32((string)m.Arguments[0], out addr);
         }
         m.Arguments[1] = addr;
     }).Return(false);
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:26,代码来源:ProjectSerializerTests.cs

示例4: Given_ArchitectureStub

 private void Given_ArchitectureStub()
 {
     arch = mr.DynamicMock<IProcessorArchitecture>();
     var procSer = mr.StrictMock<ProcedureSerializer>(null, null, null);
     arch.Stub(a => a.CreateProcedureSerializer(null, null)).IgnoreArguments().Return(procSer);
     procSer.Stub(p => p.Deserialize(null, null)).IgnoreArguments().Return(new ProcedureSignature());
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:7,代码来源:TypeLibraryLoaderTests.cs

示例5: Setup

        public void Setup()
        {
            mr = new MockRepository();
            prog = new Program();
            proc = new Procedure("testProc", new Frame(PrimitiveType.Word32));
            block = proc.AddBlock("l00100000");
            trace = new RtlTrace(0x00100000);
            r0 = new Identifier("r0", PrimitiveType.Word32, new RegisterStorage("r0", 0, PrimitiveType.Word32));
            r1 = new Identifier("r1", PrimitiveType.Word32, new RegisterStorage("r1", 0, PrimitiveType.Word32));
            r2 = new Identifier("r2", PrimitiveType.Word32, new RegisterStorage("r2", 0, PrimitiveType.Word32));
            grf = proc.Frame.EnsureFlagGroup(3, "SCZ", PrimitiveType.Byte);

            scanner = mr.StrictMock<IScanner>();
            arch = mr.DynamicMock<IProcessorArchitecture>();
            arch.Stub(s => s.PointerType).Return(PrimitiveType.Pointer32);
            arch.Stub(s => s.CreateRegisterBitset()).Return(new BitSet(32));
            prog.Architecture = arch;
            arch.Replay();
            prog.Platform = new DefaultPlatform(null, arch);
            arch.BackToRecord();
        }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:21,代码来源:BlockWorkitemTests.cs

示例6: Given_Program

 private void Given_Program(byte [] bytes)
 {
     this.arch = mr.Stub<IProcessorArchitecture>();
     arch.Stub(a => a.ReadCodeAddress(0, null, null)).IgnoreArguments()
         .Do(new Func<int, ImageReader, ProcessorState, Address>(
             (s, r, st) => Address.Ptr32(r.ReadLeUInt32())));
     mem = new MemoryArea(Address.Ptr32(0x00010000), bytes);
     this.program = new Program(
         new SegmentMap(mem.BaseAddress,
             new ImageSegment(".text", mem, AccessMode.ReadExecute)),
         arch,
         null);
 }
开发者ID:relaxar,项目名称:reko,代码行数:13,代码来源:VectorBuilderTests.cs

示例7: Given_32bit_Program

        private void Given_32bit_Program()
        {
            this.arch = mr.Stub<IProcessorArchitecture>();
            this.arch.Stub(a => a.FramePointerType).Return(PrimitiveType.Pointer32);
            this.platform = mr.Stub<IPlatform>();
            this.program = new Program(
                new SegmentMap(
                    Address.Ptr32(0x00010000),
                    new ImageSegment(
                        ".text",
                        new MemoryArea(
                            Address.Ptr32(0x00010000),
                            Enumerable.Range(0, 32)
                                .Select(i => (byte)i)
                                .ToArray()),
                        AccessMode.ReadWrite)),
                arch,
                platform);
            arch.Stub(a => a.CreateFrame()).Do(
                new Func<Frame>(
                    () => new Frame(PrimitiveType.Pointer32)));
            arch.Stub(a => a.CreateImageReader(null, null)).IgnoreArguments()
                .Do(new Func<MemoryArea, Address, ImageReader>(
                    (m, a) => new LeImageReader(m, a)));
            arch.Stub(a => a.CreateDisassembler(null)).IgnoreArguments()
                .Return(new[]
                {
                    Operation.Add,
                    Operation.Mul,
                    Operation.Add,
                    Operation.Ret
                }.Select((m, i) => new FakeInstruction(m)
                {
                    Address = Address.Ptr32(0x00010010 + 2 * (uint)i)
                }));

            arch.Replay();
        }
开发者ID:relaxar,项目名称:reko,代码行数:38,代码来源:DumperTests.cs

示例8: Setup

 public void Setup()
 {
     mr = new MockRepository();
     programHeaders = new List<Elf32_PHdr>();
     sections = new List<ElfSection>();
     platform = mr.Stub<IPlatform>();
     this.sc = new ServiceContainer();
     var cfgSvc = mr.Stub<IConfigurationService>();
     this.arch = mr.Stub<IProcessorArchitecture>();
     arch.Stub(a => a.PointerType).Return(PrimitiveType.Pointer32);
     cfgSvc.Stub(c => c.GetArchitecture("x86-protected-32")).Return(arch);
     cfgSvc.Stub(c => c.GetArchitecture("mips-be-32")).Return(arch);
     sc.AddService<IConfigurationService>(cfgSvc);
 }
开发者ID:uxmal,项目名称:reko,代码行数:14,代码来源:ElfLoader32Tests.cs

示例9: Setup

        public void Setup()
        {
            mr = new MockRepository();
            arch = mr.Stub<IProcessorArchitecture>();
            arch.Stub(a => a.CreateImageReader(null, 0u)).IgnoreArguments().Do(new Func<LoadedImage, ulong, ImageReader>((i, o) => i.CreateLeReader(o)));
            arch.Replay();
            globalStruct = new StructureType
            {
            };
            globals_t = new TypeVariable("globals_t", 1) { DataType = globalStruct };
            globals = new Identifier("globals", PrimitiveType.Pointer32, null);

            eqLink = new EquivalenceClass(new TypeVariable(2));
            StructureType str = new StructureType
            {
                Fields = {
                    { 0, new Pointer(eqLink, 4)},
                    { 4, PrimitiveType.Int32 }
                }
            };
            eqLink.DataType = str;
        }
开发者ID:gitter-badger,项目名称:reko,代码行数:22,代码来源:ConstantPointerTraversalTests.cs

示例10: Given_MsDosRawFileFormat

 private void Given_MsDosRawFileFormat()
 {
     this.x86arch = mr.Stub<IProcessorArchitecture>();
     var env = mr.Stub<OperatingEnvironment>();
     this.msdosPlatform = mr.Stub<IPlatform>();
     var state = mr.Stub<ProcessorState>();
     var rawFile = new RawFileElementImpl
     {
         BaseAddress = "0C00:0100",
         Environment = "ms-dos",
         Architecture = "x86-real-16",
     };
     rawFile.EntryPoint.Address = null;
     rawFile.EntryPoint.Name = "Start_Here";
     cfgSvc.Stub(d => d.GetRawFile("ms-dos-com")).Return(rawFile);
     cfgSvc.Stub(d => d.GetArchitecture("x86-real-16")).Return(x86arch);
     cfgSvc.Stub(d => d.GetEnvironment("ms-dos")).Return(env);
     env.Stub(e => e.Load(null, null)).IgnoreArguments().Return(msdosPlatform);
     x86arch.Stub(a => a.TryParseAddress(
         Arg<string>.Is.Equal("0C00:0100"),
         out Arg<Address>.Out(Address.SegPtr(0x0C00, 0x0100)).Dummy))
         .Return(true);
     x86arch.Stub(a => a.CreateProcessorState()).Return(state);
 }
开发者ID:relaxar,项目名称:reko,代码行数:24,代码来源:LoaderTests.cs

示例11: Given_Architecture

 private void Given_Architecture()
 {
     arch = mr.Stub<IProcessorArchitecture>();
     var dasm = mr.Stub<IEnumerable<MachineInstruction>>();
     var e = mr.Stub<IEnumerator<MachineInstruction>>();
     arch.Stub(a => a.InstructionBitSize).Return(8);
     arch.Stub(a => a.PointerType).Return(PrimitiveType.Pointer32);
     arch.Stub(a => a.CreateRegisterBitset()).Return(new BitSet(32));
     arch.Stub(a => a.CreateImageReader(null, null))
         .IgnoreArguments()
         .Do(new Func<LoadedImage, Address, ImageReader>((i, a) => new LeImageReader(i, a)));
     arch.Stub(a => a.CreateDisassembler(
         Arg<ImageReader>.Is.NotNull)).Return(dasm);
     Address dummy;
     arch.Stub(a => a.TryParseAddress(null, out dummy)).IgnoreArguments().WhenCalled(m =>
         {
             Address addr;
             bool ret = Address.TryParse32((string)m.Arguments[0], out addr);
             m.Arguments[1] = addr;
             m.ReturnValue = ret;
         }).Return(false);
     dasm.Stub(d => d.GetEnumerator()).Return(e);
     arch.Replay();
     dasm.Replay();
     e.Replay();
 }
开发者ID:nemerle,项目名称:reko,代码行数:26,代码来源:LowLevelViewInteractorTests.cs


注:本文中的IProcessorArchitecture.Stub方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。