Exemplo n.º 1
0
        void IDebuggeeListener.X_DebuggeeArrived(IDebuggeeSender toDebuggee)
        {
            lock (this)
            {
                if (fakeBreakpointMode != null)
                {
                    return;
                }
                this.toDebuggee = toDebuggee;

                Program.WaitingUI.BeginInvoke(new Action(() => {
                    Program.WaitingUI.Hide();
                }));

                var welcome = new
                {
                    command            = "welcome",
                    sourceBasePath     = sourceBasePath,
                    directorySeperator = Path.DirectorySeparatorChar,
                };
                toDebuggee.Send(JsonConvert.SerializeObject(welcome));

                SendResponse(startCommand, startSeq, null);
                toVSCode.SendMessage(new InitializedEvent());
            }
        }
Exemplo n.º 2
0
        void IDebuggeeListener.X_DebuggeeArrived(IDebuggeeSender toDebuggee)
        {
            lock (this)
            {
                if (fakeBreakpointMode != null)
                {
                    return;
                }
                this.toDebuggee = toDebuggee;
                Program.WaitingUI.Hide();
                var welcome = new
                {
                    command        = "welcome",
                    sourceBasePath = sourceBasePath
                };
                toDebuggee.Send(JsonConvert.SerializeObject(welcome));

                SendResponse(startCommand, startSeq, null);
                toVSCode.SendMessage(new InitializedEvent());
                startCommand = null;
            }
        }
Exemplo n.º 3
0
        void ICDPListener.X_FromVSCode(string command, int seq, dynamic args, string reqText)
        {
            lock (this)
            {
                //MessageBox.OK(reqText);
                if (args == null)
                {
                    args = new { };
                }

                if (fakeBreakpointMode != null)
                {
                    if (command == "configurationDone")
                    {
                        SendResponse(command, seq, null);
                    }
                    else if (command == "threads")
                    {
                        SendResponse(command, seq, new ThreadsResponseBody(
                                         new List <Thread>()
                        {
                            new Thread(999, "fake-thread")
                        }));
                    }
                    else if (command == "stackTrace")
                    {
                        var src = new Source(Path.Combine(sourceBasePath, fakeBreakpointMode.Item1));
                        var f   = new StackFrame(9999, "fake-frame", src, fakeBreakpointMode.Item2, 0);
                        SendResponse(command, seq, new StackTraceResponseBody(
                                         new List <StackFrame>()
                        {
                            f
                        }));
                    }
                    else if (command == "scopes")
                    {
                        SendResponse(command, seq, new ScopesResponseBody(
                                         new List <Scope>()));

                        System.Threading.Thread.Sleep(1000);
                        toVSCode.SendMessage(new TerminatedEvent());
                    }
                    else
                    {
                        SendErrorResponse(command, seq, 999, "", new { });
                    }
                    return;
                }

                try
                {
                    switch (command)
                    {
                    case "initialize":
                        Initialize(command, seq, args);
                        break;

                    case "launch":
                        Launch(command, seq, args);
                        break;

                    case "attach":
                        Attach(command, seq, args);
                        break;

                    case "disconnect":
                        Disconnect(command, seq, args);
                        break;

                    case "next":
                    case "continue":
                    case "stepIn":
                    case "stepOut":
                    case "stackTrace":
                    case "scopes":
                    case "variables":
                    case "threads":
                    case "setBreakpoints":
                    case "configurationDone":
                    case "evaluate":
                    case "pause":
                        if (toDebuggee != null)
                        {
                            toDebuggee.Send(reqText);
                        }
                        break;

                    case "source":
                        SendErrorResponse(command, seq, 1020, "command not supported: " + command);
                        break;

                    default:
                        SendErrorResponse(command, seq, 1014, "unrecognized request: {_request}", new { _request = command });
                        break;
                    }
                }
                catch (Exception e)
                {
                    MessageBox.WTF(e.ToString());
                    SendErrorResponse(command, seq, 1104, "error while processing request '{_request}' (exception: {_exception})", new { _request = command, _exception = e.Message });
                    Environment.Exit(1);
                }
            }
        }