public int DebugLaunch(uint grfLaunch) { bool noDebug = ((__VSDBGLAUNCHFLAGS)grfLaunch & __VSDBGLAUNCHFLAGS.DBGLAUNCH_NoDebug) != 0; _ = noDebug; // TODO: Run without Debugging Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(); var random = new Random(DateTime.Now.Millisecond); var port = 8800 + random.Next(0, 100); var startArgs = new SoftDebuggerListenArgs(_baseProject.Name, IPAddress.Loopback, port) { MaxConnectionAttempts = 3 }; var startInfo = new GodotStartInfo(startArgs, null, _baseProject) { WorkingDirectory = GodotPackage.Instance.GodotSolutionEventsListener?.SolutionDir }; var session = new GodotDebuggerSession(); var launcher = new MonoDebuggerLauncher(new Progress <string>()); launcher.StartSession(startInfo, session); return(VSConstants.S_OK); }
private void StartListening(IPAddress address, int port) { SoftDebuggerListenArgs listenArgs = new SoftDebuggerListenArgs(string.Empty, address, port); SoftDebuggerStartInfo startInfo = new SoftDebuggerStartInfo(listenArgs); StartListening(startInfo); }
void StartProcess(MonoBrickSoftDebuggerStartInfo dsi) { SoftDebuggerListenArgs args = (SoftDebuggerListenArgs)dsi.StartArgs; string EV3IPAddress = UserSettings.Instance.IPAddress; string debugOptions = string.Format("transport=dt_socket,address=0.0.0.0:{0},server=y", args.DebugPort); bool EV3Verbose = UserSettings.Instance.Verbose; process = MonoBrickUtility.ExecuteCommand(EV3IPAddress, dsi.ExecutionCommand, debugOptions, dsi.ExecutionCommand.Console, EV3Verbose); process.Execute(); process.WaitForExecuted(); }
public int DebugLaunch(uint grfLaunch) {//if launch with debug; else just run var random = new Random(DateTime.Now.Millisecond); var port = 8800 + random.Next(0, 100); var startArgs = new SoftDebuggerListenArgs(baseProject.Name, IPAddress.Loopback, port); var startInfo = new XamarinWindowsStartInfo(startArgs, null, baseProject); var session = new XamarinWindowsDebuggerSession(); var launcher = new MonoDebuggerLauncher(new Progress <string>(), new XamarinWindowsDebugLauncher()); launcher.StartSession(startInfo, session); return(VSConstants.S_OK); }
protected override string GetConnectingMessage(DebuggerStartInfo dsi) { SoftDebuggerStartInfo startInfo = dsi as SoftDebuggerStartInfo; SoftDebuggerListenArgs listenArgs = startInfo?.StartArgs as SoftDebuggerListenArgs; if (listenArgs != null) { return($"{DubrovnikDebuggerUtils.LISTEN_MESSAGE_PREFIX}{listenArgs.Address}:{listenArgs.DebugPort}..."); } SoftDebuggerConnectArgs connectArgs = startInfo?.StartArgs as SoftDebuggerConnectArgs; if (connectArgs != null) { return($"{DubrovnikDebuggerUtils.ATTACH_MESSAGE_PREFIX}{connectArgs.Address}:{connectArgs.DebugPort}..."); } return(base.GetConnectingMessage(dsi)); }
public override DebuggerStartInfo CreateDebuggerStartInfo(ExecutionCommand cmd) { var godotCmd = (GodotExecutionCommand)cmd; var godotProjectPath = godotCmd.GodotProjectPath; //TODO: Read "mono/debugger_agent/port" under [mono] from project.godot file SoftDebuggerRemoteArgs args; if (godotCmd.ExecutionType == ExecutionType.Launch) { args = new SoftDebuggerListenArgs("Godot", IPAddress.Loopback, 0); } else { args = new SoftDebuggerConnectArgs("Godot", IPAddress.Loopback, 23685); } return(new GodotDebuggerStartInfo(godotCmd, args) { WorkingDirectory = godotCmd.WorkingDirectory }); }
public static void Listen(IPAddress address, int port) { lock (_lock) { EnsureCreated(); CurrentExecutable = null; CurrentAddress = address; CurrentPort = port; _debuggeeKilled = false; _kind = SessionKind.Listening; var args = new SoftDebuggerListenArgs(string.Empty, address, port); _session.Run(new SoftDebuggerStartInfo(args), Options); CommandLine.InferiorExecuting = true; } }
public override DebuggerStartInfo CreateDebuggerStartInfo(ExecutionCommand cmd) { var godotCmd = (GodotExecutionCommand)cmd; var godotProjectPath = godotCmd.GodotProjectPath; int attachPort = 23685; // Default if not modified // Try read the debugger agent port from the 'project.godot' file if (File.Exists(godotProjectPath)) { // [mono] "debugger_agent/port" var regex = new Regex(@"debugger_agent/port=([0-9]+)"); foreach (string line in File.ReadAllLines(godotProjectPath)) { var match = regex.Match(line); if (match.Success) { attachPort = int.Parse(match.Groups[1].Value); break; } } } SoftDebuggerRemoteArgs args; if (godotCmd.ExecutionType != ExecutionType.Attach) { args = new SoftDebuggerListenArgs("Godot", IPAddress.Loopback, 0); } else { args = new SoftDebuggerConnectArgs("Godot", IPAddress.Loopback, attachPort); } return(new GodotDebuggerStartInfo(godotCmd, args) { WorkingDirectory = godotCmd.WorkingDirectory }); }
private string SerializeDebuggerOptions(string jsonDebugOptions) { try { NLogService.TraceEnteringMethod(); var debugOptions = DebugOptions.DeserializeFromJson(jsonDebugOptions, null); _session = new SoftDebuggerSession(); _session.TargetReady += (sender, eventArgs) => { Debug.WriteLine("TargetReady!"); }; _session.ExceptionHandler = exception => true; _session.TargetExited += (sender, x) => { Debug.WriteLine("TargetExited!"); }; _session.TargetUnhandledException += (sender, x) => { Debug.WriteLine("TargetUnhandledException!"); }; _session.LogWriter = (stderr, text) => Debug.WriteLine(text); _session.OutputWriter = (stderr, text) => Debug.WriteLine(text); _session.TargetThreadStarted += (sender, x) => Debug.WriteLine("TargetThreadStarted!"); _session.TargetThreadStopped += (sender, x) => { Debug.WriteLine("TargetThreadStopped!"); }; _session.TargetStopped += (sender, x) => Debug.WriteLine(x.Type); _session.TargetStarted += (sender, x) => Debug.WriteLine("TargetStarted"); _session.TargetSignaled += (sender, x) => Debug.WriteLine(x.Type); _session.TargetInterrupted += (sender, x) => Debug.WriteLine(x.Type); _session.TargetExceptionThrown += (sender, x) => { Debug.WriteLine("TargetExceptionThrown!"); }; _session.TargetHitBreakpoint += (sender, x) => { Debug.WriteLine("TargetHitBreakpoint!"); }; _session.TargetEvent += _session_TargetEvent; var connectionTimeout = 30000; var evaluationTimeout = 30000; var startupProject = StartupProject; SoftDebuggerRemoteArgs softDebuggerArgs; if (debugOptions.RunAsDebugServer) { softDebuggerArgs = new SoftDebuggerListenArgs(debugOptions.AppName, debugOptions.HostIPAddress, debugOptions.DebugPort) { TimeBetweenConnectionAttempts = debugOptions.TimeBetweenConnectionAttemptsMs, MaxConnectionAttempts = debugOptions.MaxConnectionAttempts }; } else { softDebuggerArgs = new SoftDebuggerConnectArgs(debugOptions.AppName, debugOptions.HostIPAddress, debugOptions.DebugPort) { TimeBetweenConnectionAttempts = debugOptions.TimeBetweenConnectionAttemptsMs, MaxConnectionAttempts = debugOptions.MaxConnectionAttempts }; } _startInfo = new StartInfo( softDebuggerArgs, new DebuggingOptions() { EvaluationTimeout = evaluationTimeout, MemberEvaluationTimeout = evaluationTimeout, ModificationTimeout = evaluationTimeout, SocketTimeout = connectionTimeout }, startupProject ); SessionMarshalling sessionMarshalling = new SessionMarshalling(_session, _startInfo); using (MemoryStream ms = new MemoryStream()) { BinaryFormatter bf = new BinaryFormatter(); ObjRef oref = RemotingServices.Marshal(sessionMarshalling); bf.Serialize(ms, oref); return(Convert.ToBase64String(ms.ToArray())); } } catch (Exception ex) { NLogService.Logger.Error(ex); throw; } }
private void RunImpl(Response response, dynamic args, ExecutionType executionType) { lock (_lock) { _attachMode = executionType == ExecutionType.Attach; SetExceptionBreakpoints(args.__exceptionOptions); SoftDebuggerRemoteArgs listenArgs; if (executionType == ExecutionType.Attach) { // validate argument 'address' string host = getString(args, "address"); if (host == null) { SendErrorResponse(response, 3007, "Property 'address' is missing or empty."); return; } // validate argument 'port' int port = getInt(args, "port", -1); if (port == -1) { SendErrorResponse(response, 3008, "Property 'port' is missing."); return; } IPAddress address = Utilities.ResolveIPAddress(host); if (address == null) { SendErrorResponse(response, 3013, "Invalid address '{host}'.", new { host }); return; } listenArgs = new SoftDebuggerConnectArgs("Godot", IPAddress.Loopback, port); } else { listenArgs = new SoftDebuggerListenArgs("Godot", IPAddress.Loopback, 0); } // ------ _debuggeeKilled = false; string godotExecutablePath = (string)args.executable; string godotProjectDir = (string)args.godotProjectDir; var startInfo = new GodotDebuggerStartInfo(executionType, godotExecutablePath, processOutputListener: this, listenArgs) { WorkingDirectory = godotProjectDir }; _session.Run(startInfo, _debuggerSessionOptions); _debuggeeExecuting = true; } }