本文整理汇总了C#中IProcessorArchitecture.Replay方法的典型用法代码示例。如果您正苦于以下问题:C# IProcessorArchitecture.Replay方法的具体用法?C# IProcessorArchitecture.Replay怎么用?C# IProcessorArchitecture.Replay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProcessorArchitecture
的用法示例。
在下文中一共展示了IProcessorArchitecture.Replay方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: 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));
grf = proc.Frame.EnsureFlagGroup(Registers.eflags, 3, "SCZ", PrimitiveType.Byte);
scanner = mr.StrictMock<IScanner>();
arch = mr.DynamicMock<IProcessorArchitecture>();
arch.Stub(s => s.PointerType).Return(PrimitiveType.Pointer32);
program.Architecture = arch;
arch.Replay();
program.Platform = new DefaultPlatform(null, arch);
arch.BackToRecord();
}
示例3: 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;
}
示例4: 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);
arch_386.Stub(a => a.PointerType).Return(PrimitiveType.Pointer32);
var state = mr.Stub<ProcessorState>();
arch_386.Stub(a => a.CreateProcessorState()).Return(state);
arch_386.Replay();
}
示例5: 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();
}
示例6: 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();
}