/// <summary> /// Creates a new static graph builder using the provided instruction successor resolver. /// </summary> /// <param name="instructions">The instructions to traverse.</param> /// <param name="successorResolver">The object used to determine the successors of a single instruction.</param> /// <exception cref="ArgumentNullException">Occurs when any of the arguments is <c>null</c>.</exception> public StaticFlowGraphBuilder( IStaticInstructionProvider <TInstruction> instructions, IStaticSuccessorResolver <TInstruction> successorResolver) { Instructions = instructions ?? throw new ArgumentNullException(nameof(instructions)); SuccessorResolver = successorResolver ?? throw new ArgumentNullException(nameof(successorResolver)); }
/// <summary> /// Creates a new symbolic control flow graph builder using the provided program state transition resolver. /// </summary> /// <param name="instructions">The instructions to traverse.</param> /// <param name="transitionResolver">The transition resolver to use for inferring branch targets.</param> public SymbolicFlowGraphBuilder( IStaticInstructionProvider <TInstruction> instructions, IStateTransitionResolver <TInstruction> transitionResolver) { Instructions = new StaticToSymbolicAdapter <TInstruction>( instructions ?? throw new ArgumentNullException(nameof(instructions))); TransitionResolver = transitionResolver ?? throw new ArgumentNullException(nameof(transitionResolver)); }
/// <summary> /// Creates a new instance of the <see cref="CilVirtualMachine"/>. /// </summary> /// <param name="module">The module in which the CIL runs in.</param> /// <param name="instructions">The instructions to emulate..</param> /// <param name="is32Bit">Indicates whether the virtual machine should run in 32-bit mode or in 64-bit mode.</param> public CilVirtualMachine(ModuleDefinition module, IStaticInstructionProvider<CilInstruction> instructions, bool is32Bit) { Module = module; Instructions = instructions; Architecture = instructions.Architecture; Is32Bit = is32Bit; Status = VirtualMachineStatus.Idle; CurrentState = new CilProgramState(); Dispatcher = new DefaultCilDispatcher(); CliMarshaller = new DefaultCliMarshaller(this); MemoryAllocator = new DefaultMemoryAllocator(module, is32Bit); MethodInvoker = new ReturnUnknownMethodInvoker(new UnknownValueFactory(this)); StaticFieldFactory = new StaticFieldFactory(); _services[typeof(ICilRuntimeEnvironment)] = this; }
/// <summary> /// Creates a new instance of the <see cref="CilVirtualMachine"/>. /// </summary> /// <param name="module">The module in which the CIL runs in.</param> /// <param name="instructions">The instructions to emulate..</param> /// <param name="is32Bit">Indicates whether the virtual machine should run in 32-bit mode or in 64-bit mode.</param> public CilVirtualMachine(ModuleDefinition module, IStaticInstructionProvider <CilInstruction> instructions, bool is32Bit) { Module = module ?? throw new ArgumentNullException(nameof(module)); Instructions = instructions ?? throw new ArgumentNullException(nameof(instructions)); Architecture = instructions.Architecture; ValueFactory = new DefaultValueFactory(module, is32Bit); Is32Bit = is32Bit; Status = VirtualMachineStatus.Idle; CurrentState = new CilProgramState(ValueFactory); Dispatcher = new DefaultCilDispatcher(); CliMarshaller = new DefaultCliMarshaller(this); MethodInvoker = new ReturnUnknownMethodInvoker(ValueFactory); StaticFieldFactory = new StaticFieldFactory(ValueFactory); _services[typeof(ICilRuntimeEnvironment)] = this; }
/// <summary> /// Creates a new instance of the <see cref="StaticToSymbolicAdapter{TInstruction}"/> adapter. /// </summary> /// <param name="instructions">The instructions.</param> public StaticToSymbolicAdapter(IStaticInstructionProvider <TInstruction> instructions) { Instructions = instructions ?? throw new ArgumentNullException(nameof(instructions)); }
/// <summary> /// Creates a new instance of the <see cref="StaticToSymbolicAdapter{TInstruction}"/> adapter. /// </summary> /// <param name="instructions">The instructions.</param> public StaticToSymbolicAdapter(IStaticInstructionProvider <TInstruction> instructions) { Instructions = instructions; }