예제 #1
0
        public void WasExceptionBreakpointHitInExternalCode(string caller_trace, string excCategory, string excMode, string excName, string extFrame)
        {
            Func <string, bool> filter = (resJSON) => {
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "stopped") &&
                    VSCodeDebugger.isResponseContainProperty(resJSON, "reason", "exception"))
                {
                    threadId = Convert.ToInt32(VSCodeDebugger.GetResponsePropertyValue(resJSON, "threadId"));
                    return(true);
                }
                return(false);
            };

            Assert.True(VSCodeDebugger.IsEventReceived(filter), @"__FILE__:__LINE__" + "\n" + caller_trace);

            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, @"__FILE__:__LINE__" + "\n" + caller_trace);

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

            if (stackTraceResponse.body.stackFrames[0].name == extFrame)
            {
                TestExceptionInfo(@"__FILE__:__LINE__" + "\n" + caller_trace, excCategory, excMode, excName);
                return;
            }

            throw new ResultNotSuccessException(@"__FILE__:__LINE__" + "\n" + caller_trace);
        }
예제 #2
0
        public void WasEntryPointHit(string caller_trace)
        {
            Func <string, bool> filter = (resJSON) => {
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "stopped") &&
                    VSCodeDebugger.isResponseContainProperty(resJSON, "reason", "entry"))
                {
                    threadId = Convert.ToInt32(VSCodeDebugger.GetResponsePropertyValue(resJSON, "threadId"));
                    return(true);
                }
                return(false);
            };

            Assert.True(VSCodeDebugger.IsEventReceived(filter), @"__FILE__:__LINE__" + "\n" + caller_trace);
        }
예제 #3
0
        public static void WasStopped(string Reason, Breakpoint breakpoint)
        {
            Func <string, bool> filter = (resJSON) => {
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "stopped") &&
                    VSCodeDebugger.isResponseContainProperty(resJSON, "reason", Reason))
                {
                    if (Reason == "breakpoint")
                    {
                        threadId = Convert.ToInt32(VSCodeDebugger.GetResponsePropertyValue(resJSON, "threadId"));
                    }

                    return(true);
                }
                return(false);
            };

            if (!VSCodeDebugger.IsEventReceived(filter))
            {
                throw new NetcoreDbgTestCore.ResultNotSuccessException();
            }

            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();
        }
예제 #4
0
        public void WasBreakpointHitWithProperThreadID(string caller_trace, string bpName)
        {
            Func <string, bool> filter = (resJSON) => {
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "stopped") &&
                    VSCodeDebugger.isResponseContainProperty(resJSON, "reason", "breakpoint"))
                {
                    threadId = Convert.ToInt32(VSCodeDebugger.GetResponsePropertyValue(resJSON, "threadId"));
                    return(true);
                }
                return(false);
            };

            threadId = -1;
            Assert.True(VSCodeDebugger.IsEventReceived(filter), @"__FILE__:__LINE__" + "\n" + caller_trace);

            Assert.True(isThredInThreadsList(@"__FILE__:__LINE__" + "\n" + caller_trace, threadId),
                        @"__FILE__:__LINE__" + "\n" + caller_trace);

            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, @"__FILE__:__LINE__" + "\n" + caller_trace);

            Breakpoint breakpoint = ControlInfo.Breakpoints[bpName];

            Assert.Equal(BreakpointType.Line, breakpoint.Type, @"__FILE__:__LINE__" + "\n" + caller_trace);
            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 == ControlInfo.SourceFilesPath)
                {
                    return;
                }
            }

            throw new ResultNotSuccessException(@"__FILE__:__LINE__" + "\n" + caller_trace);
        }
예제 #5
0
        public static void WasEntryPointHit()
        {
            Func <string, bool> filter = (resJSON) => {
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "stopped") &&
                    VSCodeDebugger.isResponseContainProperty(resJSON, "reason", "entry"))
                {
                    threadId = Convert.ToInt32(VSCodeDebugger.GetResponsePropertyValue(resJSON, "threadId"));
                    return(true);
                }
                return(false);
            };

            if (!VSCodeDebugger.IsEventReceived(filter))
            {
                throw new NetcoreDbgTestCore.ResultNotSuccessException();
            }
        }
예제 #6
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;
                }
            }
        }