예제 #1
0
        public static void WasExit()
        {
            string resJSON = VSCodeDebugger.Receive(-1);

            Assert.True(VSCodeDebugger.isResponseContainProperty(resJSON, "event", "terminated"));

            DisconnectRequest disconnectRequest = new DisconnectRequest();

            disconnectRequest.arguments         = new DisconnectArguments();
            disconnectRequest.arguments.restart = false;
            Assert.True(VSCodeDebugger.Request(disconnectRequest).Success);
        }
예제 #2
0
        public static void WasEntryPointHit()
        {
            string resJSON = VSCodeDebugger.Receive(-1);

            Assert.True(VSCodeDebugger.isResponseContainProperty(resJSON, "event", "stopped") &&
                        VSCodeDebugger.isResponseContainProperty(resJSON, "reason", "entry"));

            foreach (var Event in VSCodeDebugger.EventList)
            {
                if (VSCodeDebugger.isResponseContainProperty(Event, "event", "stopped") &&
                    VSCodeDebugger.isResponseContainProperty(Event, "reason", "entry"))
                {
                    threadId = Convert.ToInt32(VSCodeDebugger.GetResponsePropertyValue(Event, "threadId"));
                    break;
                }
            }
        }
예제 #3
0
        public static void WasBreakpointHit(Breakpoint breakpoint)
        {
            string resJSON = VSCodeDebugger.Receive(-1);

            Assert.True(VSCodeDebugger.isResponseContainProperty(resJSON, "event", "stopped") &&
                        VSCodeDebugger.isResponseContainProperty(resJSON, "reason", "breakpoint"));

            foreach (var Event in VSCodeDebugger.EventList)
            {
                if (VSCodeDebugger.isResponseContainProperty(Event, "event", "stopped") &&
                    VSCodeDebugger.isResponseContainProperty(Event, "reason", "breakpoint"))
                {
                    threadId = Convert.ToInt32(VSCodeDebugger.GetResponsePropertyValue(Event, "threadId"));
                }
            }

            StackTraceRequest stackTraceRequest = new StackTraceRequest();

            stackTraceRequest.arguments.threadId   = threadId;
            stackTraceRequest.arguments.startFrame = 0;
            stackTraceRequest.arguments.levels     = 20;
            var ret = VSCodeDebugger.Request(stackTraceRequest);

            Assert.True(ret.Success);

            Assert.Equal(BreakpointType.Line, breakpoint.Type);
            var lbp = (LineBreakpoint)breakpoint;

            StackTraceResponse stackTraceResponse =
                JsonConvert.DeserializeObject <StackTraceResponse>(ret.ResponseStr);

            foreach (var Frame in stackTraceResponse.body.stackFrames)
            {
                if (Frame.line == lbp.NumLine &&
                    Frame.source.name == lbp.FileName
                    // NOTE this code works only with one source file
                    && Frame.source.path == DebuggeeInfo.SourceFilesPath)
                {
                    return;
                }
            }

            throw new NetcoreDbgTestCore.ResultNotSuccessException();
        }