Ejemplo n.º 1
0
        public static void WasEntryPointHit()
        {
            // TODO: Implement API for comfortable searching
            // of out-of-band records
            var records = MIDebugger.Receive();

            foreach (MIOutOfBandRecord record in records)
            {
                if (!IsStoppedEvent(record))
                {
                    continue;
                }

                var output = ((MIAsyncRecord)record).Output;

                // Currently let's believe that all *stopped events have
                // a reason of stopping
                var reason = (MIConst)output["reason"];

                if (reason.CString != "entry-point-hit")
                {
                    continue;
                }

                var frame = (MITuple)(output["frame"]);
                var func  = (MIConst)(frame["func"]);
                if (func.CString == DebuggeeInfo.TestName + ".Program.Main()")
                {
                    return;
                }
            }

            throw new NetcoreDbgTestCore.ResultNotSuccessException();
        }
Ejemplo n.º 2
0
        public static void WasBreakpointHit(Breakpoint breakpoint)
        {
            var records = MIDebugger.Receive();
            var bp      = (LineBreakpoint)breakpoint;

            foreach (MIOutOfBandRecord record in records)
            {
                if (!IsStoppedEvent(record))
                {
                    continue;
                }

                var output = ((MIAsyncRecord)record).Output;
                var reason = (MIConst)output["reason"];

                if (reason.CString != "breakpoint-hit")
                {
                    continue;
                }

                var frame    = (MITuple)(output["frame"]);
                var fileName = (MIConst)(frame["file"]);
                var numLine  = (MIConst)(frame["line"]);

                if (fileName.CString == bp.FileName &&
                    numLine.CString == bp.NumLine.ToString())
                {
                    return;
                }
            }

            throw new NetcoreDbgTestCore.ResultNotSuccessException();
        }
Ejemplo n.º 3
0
        public static void WasExit()
        {
            var records = MIDebugger.Receive();

            foreach (MIOutOfBandRecord record in records)
            {
                if (!IsStoppedEvent(record))
                {
                    continue;
                }

                var output = ((MIAsyncRecord)record).Output;
                var reason = (MIConst)output["reason"];

                if (reason.CString != "exited")
                {
                    continue;
                }

                var exitCode = (MIConst)output["exit-code"];

                if (exitCode.CString == "0")
                {
                    return;
                }
                else
                {
                    throw new NetcoreDbgTestCore.ResultNotSuccessException();
                }
            }

            throw new NetcoreDbgTestCore.ResultNotSuccessException();
        }