public GdbStub(int port, ICpuSupportingGdb cpu, bool autostartEmulation) { this.cpu = cpu; Port = port; pcktBuilder = new PacketBuilder(); commands = new CommandsManager(cpu); commands.ShouldAutoStart = autostartEmulation; TypeManager.Instance.AutoLoadedType += commands.Register; terminal = new SocketServerProvider(); terminal.DataReceived += OnByteWritten; terminal.ConnectionAccepted += delegate { cpu.Halted += OnHalted; cpu.ExecutionMode = ExecutionMode.SingleStep; }; terminal.ConnectionClosed += delegate { cpu.Halted -= OnHalted; cpu.ExecutionMode = ExecutionMode.Continuous; }; terminal.Start(port); commHandler = new CommunicationHandler(this); }
private void AccessWatchpointHook(ICpuSupportingGdb cpu, ulong address, SysbusAccessWidth width, uint value) { //? I See a possible problem here. //? Here we call `Halt` event with T05 argument, but in a second we will call it once again with S05 in HandleStepping@TranlationCPU. //? It seems to work fine with GDB, but... I don't know if it is fully correct. cpu.EnterSingleStepModeSafely(new HaltArguments(HaltReason.Breakpoint, cpu.Id, address, BreakpointType.AccessWatchpoint), manager.BlockOnStep); }
public void Invoke(ICpuSupportingGdb cpu, ulong currentAddress, SysbusAccessWidth currentWidth, uint value = 0) { if ((currentWidth & width) != 0) { action(cpu, currentAddress, currentWidth, value); } }
private bool TryAddManagedCPU(ICpuSupportingGdb cpu) { if (IsCPUAttached(cpu)) { return(false); } ManagedCpus.Add(cpu.Id + 1, cpu); return(true); }
public CommandsManager(ICpuSupportingGdb cpu) { availableCommands = new HashSet<CommandDescriptor>(); activeCommands = new HashSet<Command>(); Machine machine; EmulationManager.Instance.CurrentEmulation.TryGetMachineForPeripheral(cpu, out machine); Cpu = cpu; Machine = machine; }
public void AttachCPU(ICpuSupportingGdb cpu) { if (!CanAttachCPU) { throw new RecoverableException("Cannot attach CPU because GDB is already connected."); } if (!TryAddManagedCPU(cpu)) { throw new RecoverableException("CPU already attached to this GDB server."); } }
public CommandsManager(ICpuSupportingGdb cpu) { availableCommands = new HashSet <CommandDescriptor>(); activeCommands = new HashSet <Command>(); Machine machine; EmulationManager.Instance.CurrentEmulation.TryGetMachineForPeripheral(cpu, out machine); Cpu = cpu; Machine = machine; }
public GdbStub(int port, ICpuSupportingGdb cpu) { this.cpu = cpu; Port = port; pcktBuilder = new PacketBuilder(); commands = new CommandsManager(cpu); TypeManager.Instance.AutoLoadedType += commands.Register; cpu.Halted += OnHalted; cpu.ExecutionMode = ExecutionMode.SingleStep; terminal = new SocketServerProvider(); terminal.DataReceived += OnByteWritten; terminal.Start(port); }
private void ReadWatchpointHook(ICpuSupportingGdb cpu, ulong address, SysbusAccessWidth width, uint value) { cpu.EnterSingleStepModeSafely(new HaltArguments(HaltReason.Breakpoint, cpu.Id, address, BreakpointType.ReadWatchpoint), manager.BlockOnStep); }
private void MemoryBreakpointHook(ICpuSupportingGdb cpu, ulong address) { cpu.EnterSingleStepModeSafely(new HaltArguments(HaltReason.Breakpoint, cpu.Id, breakpointType: BreakpointType.MemoryBreakpoint), manager.BlockOnStep); }
private void HardwareBreakpointHook(ICpuSupportingGdb cpu, ulong address) { cpu.EnterSingleStepModeSafely(new HaltArguments(HaltReason.Breakpoint, cpu.Id, breakpointType: BreakpointType.HardwareBreakpoint)); }
private void WriteWatchpointHook(ICpuSupportingGdb cpu, ulong address, SysbusAccessWidth width) { cpu.EnterSingleStepModeSafely(new HaltArguments(HaltReason.Breakpoint, cpu.Id, address, BreakpointType.WriteWatchpoint)); }
public bool IsCPUAttached(ICpuSupportingGdb cpu) { return(ManagedCpus.ContainsValue(cpu)); }
public bool IsCPUAttached(ICpuSupportingGdb cpu) { return(commandsManager.IsCPUAttached(cpu)); }
public void AttachCPU(ICpuSupportingGdb cpu) { commandsManager.AttachCPU(cpu); }