Esempio n. 1
0
        ///////////////////////////////////////////////////////////////////////

        #region Debugger Watchpoint Support Methods
#if DEBUGGER
        public static ReturnCode Watchpoint(
            IDebugger debugger,
            Interpreter interpreter,
            InteractiveLoopData loopData,
            ref Result result
            )
        {
            return(Breakpoint(debugger, interpreter, loopData, ref result));
        }
Esempio n. 2
0
        ///////////////////////////////////////////////////////////////////////

        public ReturnCode Breakpoint(
            Interpreter interpreter,
            InteractiveLoopData loopData,
            ref Result result
            )
        {
            CheckDisposed();

            return(DebuggerOps.Breakpoint(
                       this, interpreter, loopData, ref result));
        }
Esempio n. 3
0
        ///////////////////////////////////////////////////////////////////////

        private /* protected virtual */ void Dispose(
            bool disposing
            )
        {
            TraceOps.DebugTrace(String.Format(
                                    "Dispose: disposing = {0}, interpreter = {1}, disposed = {2}",
                                    disposing, FormatOps.InterpreterNoThrow(interpreter), disposed),
                                typeof(InteractiveContext).Name, TracePriority.CleanupDebug);

            if (!disposed)
            {
                if (disposing)
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    interpreter = null; /* NOT OWNED: Do not dispose. */
                    threadId    = 0;

                    ///////////////////////////////////////////////////////////

                    interactive              = false;
                    interactiveInput         = null;
                    previousInteractiveInput = null;
                    interactiveMode          = null;
                    activeInteractiveLoops   = 0;
                    totalInteractiveLoops    = 0;

                    interactiveLoopData        = null;
                    interactiveCommandCallback = null;

#if HISTORY
                    historyLoadData = null;
                    historySaveData = null;

                    historyInfoFilter = null;
                    historyLoadFilter = null;
                    historySaveFilter = null;

                    historyFileName = null;
#endif
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                disposed = true;
            }
        }
Esempio n. 4
0
        ///////////////////////////////////////////////////////////////////////

        #region Debugger Breakpoint Support Methods
#if DEBUGGER
        public static ReturnCode Breakpoint(
            IDebugger debugger,
            Interpreter interpreter,
            InteractiveLoopData loopData,
            ref Result result
            )
        {
            if (interpreter == null)
            {
                result = "invalid interpreter";
                return(ReturnCode.Error);
            }

            if (!interpreter.Interactive)
            {
                result = "cannot break into interactive loop";
                return(ReturnCode.Error);
            }

            if (debugger != null)
            {
                /* IGNORED */
                debugger.EnterLoop();
            }

            try
            {
                ReturnCode code;

                InteractiveLoopCallback interactiveLoopCallback =
                    interpreter.InteractiveLoopCallback;

                if (interactiveLoopCallback != null)
                {
                    code = interactiveLoopCallback(
                        interpreter, new InteractiveLoopData(loopData, true),
                        ref result);
                }
                else
                {
#if SHELL
                    //
                    // NOTE: This is the only place in the debugger subsystem
                    //       where the InteractiveLoop method may be called.
                    //       All other methods in the Debugger class and/or
                    //       any external classes that desire the interactive
                    //       debugging functionality should call this method.
                    //
                    code = Interpreter.InteractiveLoop(
                        interpreter, new InteractiveLoopData(loopData, true),
                        ref result);
#else
                    result = "not implemented";
                    code   = ReturnCode.Error;
#endif
                }

                //
                // NOTE: Only check (or update) the interpreter state at this
                //       point if the interpreter is still usable (i.e. it is
                //       not disposed) -AND- the interactive loop returned a
                //       successful result.
                //
                if ((code == ReturnCode.Ok) && Engine.IsUsable(interpreter))
                {
                    //
                    // NOTE: Upon exiting the interactive loop, temporarily
                    //       prevent the engine from checking interpreter
                    //       readiness.  This is used to avoid potentially
                    //       breaking back into the interactive loop due to
                    //       breakpoints caused by script cancellation, etc.
                    //
                    interpreter.IsDebuggerExiting = true;
                }

                return(code);
            }
            finally
            {
                if (debugger != null)
                {
                    /* IGNORED */
                    debugger.ExitLoop();
                }
            }
        }
Esempio n. 5
0
 private static ReturnCode InteractiveLoopCallback(Interpreter interpreter, InteractiveLoopData loopData, ref Result result)
 {
     return(ReturnCode.Ok);
 }