public int Attach(IDebugProgram2[] programs, IDebugProgramNode2[] rgpProgramNodes, uint celtPrograms, IDebugEventCallback2 pCallback, enum_ATTACH_REASON dwReason) { var program = programs[0]; IDebugProcess2 process; program.GetProcess(out process); Guid processId; process.GetProcessId(out processId); if (processId != this.processId.guidProcessId) { return(VSConstants.S_FALSE); } EngineUtils.RequireOk(program.GetProgramId(out programId)); Task.Run(() => { waiter.WaitOne(); var ipAddress = HostUtils.ResolveHostOrIPAddress(settings.Host); Session.Run(new SoftDebuggerStartInfo(new SoftDebuggerConnectArgs("", ipAddress, 6438)), new DebuggerSessionOptions { EvaluationOptions = EvaluationOptions.DefaultOptions, ProjectAssembliesOnly = false }); }); MonoEngineCreateEvent.Send(this); MonoProgramCreateEvent.Send(this); return(VSConstants.S_OK); }
public void Attach(IDebugProgram2 program) { IDebugProcess2 process; program.GetProcess(out process); Guid processId; process.GetProcessId(out processId); if (processId != _processId.guidProcessId) { throw new DebuggerInitializeException("Cannot attach to specified program."); } EngineUtils.RequireOk(program.GetProgramId(out _programId)); Task.Run(() => { _waiter.WaitOne(); var ipAddress = new IPAddress(new byte[] { 0x7f, 0x00, 0x00, 0x01 }); Session.Run(new SoftDebuggerStartInfo(new SoftDebuggerConnectArgs("samp-server", ipAddress, DebuggerAddress.Port)), new DebuggerSessionOptions { EvaluationOptions = EvaluationOptions.DefaultOptions, ProjectAssembliesOnly = false }); }); MonoEngineCreateEvent.Send(_engine); SampSharpCreateEvent.Send(_engine); }
public int Attach(IDebugProgram2[] programs, IDebugProgramNode2[] rgpProgramNodes, uint celtPrograms, IDebugEventCallback2 pCallback, enum_ATTACH_REASON dwReason) { var program = programs[0]; IDebugProcess2 process; program.GetProcess(out process); Guid processId; process.GetProcessId(out processId); if (processId != this.processId.guidProcessId) { return(VSConstants.S_FALSE); } EngineUtils.RequireOk(program.GetProgramId(out programId)); Task.Run(() => { waiter.WaitOne(); // connect to the local Mono Debugger or SSH tunnel. var localhost = IPAddress.Parse("127.0.0.1"); Session.Run(new SoftDebuggerStartInfo(new SoftDebuggerConnectArgs("", localhost, MonoDebuggerPort)), new DebuggerSessionOptions { EvaluationOptions = EvaluationOptions.DefaultOptions, ProjectAssembliesOnly = false }); }); MonoEngineCreateEvent.Send(this); MonoProgramCreateEvent.Send(this); return(VSConstants.S_OK); }
public int LaunchSuspended(string server, IDebugPort2 port, string exe, string args, string directory, string environment, string options, enum_LAUNCH_FLAGS launchFlags, uint standardInput, uint standardOutput, uint standardError, IDebugEventCallback2 callback, out IDebugProcess2 process) { processId = new AD_PROCESS_ID(); processId.ProcessIdType = (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_GUID; processId.guidProcessId = Guid.NewGuid(); EngineUtils.CheckOk(port.GetProcess(processId, out process)); this.Callback = callback; Session = new SoftDebuggerSession(); Session.TargetReady += (sender, eventArgs) => { var activeThread = Session.ActiveThread; threadManager.Add(activeThread, new MonoThread(this, activeThread)); /* * Session.Stop(); * var location = activeThread.Location; * var backtrace = activeThread.Backtrace; * var locations = Session.VirtualMachine.RootDomain.GetAssemblies().Select(x => x.Location).ToArray(); * Session.Continue(); */ MonoEngineCreateEvent.Send(this); MonoProgramCreateEvent.Send(this); }; Session.ExceptionHandler = exception => true; Session.TargetExceptionThrown += (sender, x) => Console.WriteLine(x.Type); Session.TargetExited += (sender, x) => Send(new MonoProgramDestroyEvent((uint?)x.ExitCode ?? 0), MonoProgramDestroyEvent.IID, null); Session.TargetUnhandledException += (sender, x) => Console.WriteLine(x.Type); Session.LogWriter = (stderr, text) => Console.WriteLine(text); Session.OutputWriter = (stderr, text) => Console.WriteLine(text); Session.TargetThreadStarted += (sender, x) => threadManager.Add(x.Thread, new MonoThread(this, x.Thread)); Session.TargetThreadStopped += (sender, x) => threadManager.Remove(x.Thread); Session.TargetStopped += (sender, x) => Console.WriteLine(x.Type); Session.TargetStarted += (sender, x) => Console.WriteLine(); Session.TargetSignaled += (sender, x) => Console.WriteLine(x.Type); Session.TargetInterrupted += (sender, x) => Console.WriteLine(x.Type); Session.TargetHitBreakpoint += (sender, x) => { var breakpoint = x.BreakEvent as Breakpoint; var pendingBreakpoint = breakpointManager[breakpoint]; Send(new MonoBreakpointEvent(new MonoBoundBreakpointsEnum(pendingBreakpoint.BoundBreakpoints)), MonoBreakpointEvent.IID, threadManager[x.Thread]); }; return(VSConstants.S_OK); }