public IGDBStubInstance StartGDBStub(IDebugStartService startService, DebugStartContext context) { var settings = (RISCVOpenOCDSettings)context.Configuration; OpenOCDCommandLine cmdLine = OpenOCDCommandLine.Parse(settings.CommandLine, startService.CommandLineHelper); if (context.ResolvedDevices?.Interface != null) { if (context.ResolvedDevices.AllCompatibleDevices.Length > 1 || settings.AlwaysPassSerialNumber) { var db = new QuickSetupDatabase(false, context.Method.Directory); var matchingIface = db.AllInterfaces.FirstOrDefault(i => i.ID == context.ResolvedDevices.Interface.ID); if (matchingIface?.SerialNumberCommand != null) { cmdLine.InsertAfterInterfaceScript(new OpenOCDCommandLine.CommandItem { Command = $"{matchingIface.SerialNumberCommand} {EscapeSerialNumber(context.ResolvedDevices.BestMatch.Device.SerialNumber)}" }); } } } if (startService.Mode == EmbeddedDebugMode.Attach) { for (; ;) { var item = cmdLine.Items.OfType <OpenOCDCommandLine.CommandItem>().FirstOrDefault(c => c.Command.StartsWith("reset")); if (item == null) { break; } cmdLine.Items.Remove(item); } } int gdbPort, telnetPort; using (var allocator = startService.BeginAllocatingTCPPorts()) { gdbPort = PortAllocationHelper.AllocateUnusedTCPPort(allocator, "SYS:GDB_PORT", settings.PreferredGDBPort); telnetPort = PortAllocationHelper.AllocateUnusedTCPPort(allocator, "com.sysprogs.openocd.telnet_port", settings.PreferredTelnetPort); } cmdLine.Items.Insert(0, new OpenOCDCommandLine.CommandItem { Command = "gdb_port " + gdbPort }); cmdLine.Items.Insert(1, new OpenOCDCommandLine.CommandItem { Command = "telnet_port " + telnetPort }); cmdLine.Items.Add(new OpenOCDCommandLine.CommandItem { Command = "echo VisualGDB_OpenOCD_Ready" }); var tool = startService.LaunchCommandLineTool(new CommandLineToolLaunchInfo { Command = Path.Combine(GetOpenOCDDirectory(context.Method.Directory), "bin\\openocd.exe"), Arguments = cmdLine.ToString(), WorkingDirectory = Path.Combine(GetOpenOCDDirectory(context.Method.Directory), "share\\openocd\\scripts") }); return(CreateStub(context, settings, cmdLine, gdbPort, telnetPort, null, tool)); }
public OpenOCDGDBStub(OpenOCDCommandLine cmdLine, IExternalToolInstance tool, RISCVOpenOCDSettings settings, int gdbPort, int telnetPort, string temporaryScript) { _CmdLine = cmdLine; Tool = tool; _GDBPort = gdbPort; _TelnetPort = telnetPort; _Settings = settings; _TemporaryScript = temporaryScript; }
public ESP8266GDBStub(ESP8266DebugController controller, DebugStartContext context, OpenOCDCommandLine cmdLine, IExternalToolInstance tool, ESPxxOpenOCDSettings settings, int gdbPort, int telnetPort, string temporaryScript) : base(cmdLine, tool, settings, gdbPort, telnetPort, temporaryScript) { _Controller = controller; _Context = context; }
protected override IGDBStubInstance CreateStub(DebugStartContext context, OpenOCDSettings settings, OpenOCDCommandLine cmdLine, int gdbPort, int telnetPort, string temporaryScript, IExternalToolInstance tool) { return(new ESP8266GDBStub(this, context, cmdLine, tool, (ESP8266OpenOCDSettings)settings, gdbPort, telnetPort, temporaryScript)); }
protected override abstract IGDBStubInstance CreateStub(DebugStartContext context, OpenOCDSettings settings, OpenOCDCommandLine cmdLine, int gdbPort, int telnetPort, string temporaryScript, IExternalToolInstance tool);
protected virtual IGDBStubInstance CreateStub(DebugStartContext context, RISCVOpenOCDSettings settings, OpenOCDCommandLine cmdLine, int gdbPort, int telnetPort, string temporaryScript, IExternalToolInstance tool) { return(new OpenOCDGDBStub(cmdLine, tool, settings, gdbPort, telnetPort, temporaryScript)); }
protected override void ApplyCommandLine(OpenOCDCommandLine cmdLine) { base.ApplyCommandLine(cmdLine); OnPropertyChanged(nameof(FLASHVoltage)); }