Пример #1
0
        public override void StackTrace(Response response, dynamic arguments)
        {
            var firstFrameIdx = (int?)arguments.startFrame ?? 0;
            var limit         = (int?)arguments.levels ?? 0;

            var processFrames = _process.GetStackTrace(firstFrameIdx, limit);
            var frames        = new VSCodeDebug.StackFrame[processFrames.Length];

            for (int i = 0; i < processFrames.Length; i++)
            {
                frames[i] = new VSCodeDebug.StackFrame(
                    _framesHandles.Create(processFrames[i]),
                    processFrames[i].MethodName,
                    new Source(processFrames[i].Source),
                    processFrames[i].LineNumber, 0);
            }

            SendResponse(response, new StackTraceResponseBody(frames));
        }
Пример #2
0
        public override void StackTrace(Response response, dynamic arguments)
        {
            SessionLog.WriteLine("Stacktrace request accepted");
            SessionLog.WriteLine(arguments.ToString());
            var firstFrameIdx = (int?)arguments.startFrame ?? 0;
            var limit         = (int?)arguments.levels ?? 0;
            var threadId      = (int)arguments.threadId;
            var processFrames = _process.GetStackTrace(threadId, firstFrameIdx, limit);
            var frames        = new VSCodeDebug.StackFrame[processFrames.Length];

            for (int i = 0; i < processFrames.Length; i++)
            {
                frames[i] = new VSCodeDebug.StackFrame(
                    _framesHandles.Create(processFrames[i]),
                    processFrames[i].MethodName,
                    processFrames[i].GetSource(),
                    processFrames[i].LineNumber, 0);
            }

            SendResponse(response, new StackTraceResponseBody(frames));
        }
Пример #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);
                }
            }
        }
Пример #4
0
 public StackTraceResponseBody(List<StackFrame> frames = null)
 {
     if (frames == null)
         stackFrames = new StackFrame[0];
     else
         stackFrames = frames.ToArray<StackFrame>();
 }