private string SerializeDebuggerOptions(string jsonDebugOptions) { try { NLogService.TraceEnteringMethod(Logger); var debugOptions = DebugOptions.DeserializeFromJson(jsonDebugOptions); _session = new MonoDebugSession(); LogMonoDebuggerAssemblyPaths(); if (debugOptions.UserSettings.EnableVerboseDebugLogging) { RegisterEventHandlers(); } var connectionTimeout = 30000; var evaluationTimeout = 30000; var startupProject = StartupProject; XamarinEngine.DebugOptions = debugOptions; var softDebuggerConnectArgs = new SoftDebuggerConnectArgs(debugOptions.TargetExeFileName, debugOptions.GetHostIP(), debugOptions.GetMonoDebugPort()); // TODO implement programm output via stream //softDebuggerConnectArgs.RedirectOutput = true; //softDebuggerConnectArgs.OutputPort = ???; //_session.VirtualMachine.StandardOutput ??? softDebuggerConnectArgs.TimeBetweenConnectionAttempts = (int)debugOptions.UserSettings.TimeBetweenConnectionAttemptsInMs; softDebuggerConnectArgs.MaxConnectionAttempts = (int)debugOptions.UserSettings.MaxConnectionAttempts; _startInfo = new StartInfo( softDebuggerConnectArgs, 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) { Logger.Error(ex); throw; } }
// Token: 0x06000012 RID: 18 RVA: 0x0000229C File Offset: 0x0000049C public bool StartDebugger(SoftDebuggerSession session, StartInfo startInfo) { DebugLauncher.tracer.Verbose("Entering Launch for: {0}", new object[] { this }); IVsDebugger4 service = ServiceProvider.GlobalProvider.GetService <SVsShellDebugger, IVsDebugger4>(); SessionMarshalling obj = new SessionMarshalling(session, startInfo); VsDebugTargetInfo4 vsDebugTargetInfo = default(VsDebugTargetInfo4); vsDebugTargetInfo.dlo = 1U; vsDebugTargetInfo.bstrExe = "Mono"; vsDebugTargetInfo.bstrCurDir = ""; vsDebugTargetInfo.bstrArg = null; vsDebugTargetInfo.bstrRemoteMachine = null; vsDebugTargetInfo.fSendToOutputWindow = 0; vsDebugTargetInfo.guidPortSupplier = Guids.PortSupplierGuid; vsDebugTargetInfo.guidLaunchDebugEngine = Guids.EngineGuid; vsDebugTargetInfo.bstrPortName = "Mono"; using (MemoryStream memoryStream = new MemoryStream()) { BinaryFormatter binaryFormatter = new BinaryFormatter(); ObjRef graph = RemotingServices.Marshal(obj); binaryFormatter.Serialize(memoryStream, graph); vsDebugTargetInfo.bstrOptions = Convert.ToBase64String(memoryStream.ToArray()); } bool result; try { VsDebugTargetProcessInfo[] array = new VsDebugTargetProcessInfo[1]; service.LaunchDebugTargets4(1U, new VsDebugTargetInfo4[] { vsDebugTargetInfo }, array); result = true; } catch (Exception ex) { DebugLauncher.tracer.Error("Controller.Launch ()", new object[] { ex }); throw; } return(result); }
// Token: 0x0600005A RID: 90 RVA: 0x000033EC File Offset: 0x000015EC public int LaunchSuspended(string pszServer, IDebugPort2 pPort, string pszExe, string pszArgs, string pszDir, string bstrEnv, string pszOptions, enum_LAUNCH_FLAGS dwLaunchFlags, uint hStdInput, uint hStdOutput, uint hStdError, IDebugEventCallback2 pCallback, out IDebugProcess2 ppProcess) { StartInfo startInfo; using (MemoryStream memoryStream = new MemoryStream(Convert.FromBase64String(pszOptions))) { BinaryFormatter binaryFormatter = new BinaryFormatter(); SessionMarshalling sessionMarshalling = (SessionMarshalling)binaryFormatter.Deserialize(memoryStream); this.session = sessionMarshalling.Session; startInfo = sessionMarshalling.StartInfo; } this.eventSender = new EventSender(pCallback, this); Process process = new Process((Port)pPort, this, this.eventSender, this.session, startInfo, pszExe); ppProcess = process; this.processes.Add(process); this.eventSender.SendEvent(new ProcessCreateEvent(process)); return(0); }
private string SerializeDebuggerOptions(string jsonDebugOptions) { DebugHelper.TraceEnteringMethod(); var debugOptions = DebugOptions.DeserializeFromJson(jsonDebugOptions); _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 startupProject = StartupProject; _startInfo = new StartInfo( new SoftDebuggerConnectArgs(debugOptions.TargetExeFileName, debugOptions.GetHostIP(), debugOptions.GetMonoDebugPort()), new DebuggingOptions() { EvaluationTimeout = 30000, MemberEvaluationTimeout = 30000, ModificationTimeout = 30000, SocketTimeout = 30000 }, 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())); } }
private string SerializeDebuggerOptions(string jsonDebugOptions) { try { NLogService.TraceEnteringMethod(); var debugOptions = DebugOptions.DeserializeFromJson(jsonDebugOptions); _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; var softDebuggerConnectArgs = new SoftDebuggerConnectArgs(debugOptions.TargetExeFileName, debugOptions.GetHostIP(), debugOptions.GetMonoDebugPort()); // TODO implement programm output via stream //softDebuggerConnectArgs.RedirectOutput = true; //softDebuggerConnectArgs.OutputPort = ???; //_session.VirtualMachine.StandardOutput ??? softDebuggerConnectArgs.TimeBetweenConnectionAttempts = (int)debugOptions.UserSettings.TimeBetweenConnectionAttemptsInMs; softDebuggerConnectArgs.MaxConnectionAttempts = (int)debugOptions.UserSettings.MaxConnectionAttempts; _startInfo = new StartInfo( softDebuggerConnectArgs, 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 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; } }