/////////////////////////////////////////////////////////////////////// #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(); } } }