internal ScriptDebugger(bool overrideExecutionPolicy, IPowerShellDebuggingService debuggingServiceTestHook) { OverrideExecutionPolicy = overrideExecutionPolicy; _debuggingServiceTest = debuggingServiceTestHook; DebuggingService.SetRunspace(overrideExecutionPolicy); //TODO: remove once user prompt work is finished for debugging _runspace = RunspaceFactory.CreateRunspace(); _runspace.Open(); HostUi = new HostUi(); BreakpointManager = new BreakpointManager(); NativeMethods.SetForegroundWindow(); }
/// <summary> /// Debugger stopped handler /// </summary> /// <param name="e"></param> public void DebuggerStop(DebuggerStoppedEventArgs e) { Log.InfoFormat("Debugger stopped"); try { if (e.OpenScript) { OpenFileInVS(e.ScriptFullPath); } RefreshScopedVariables(); RefreshCallStack(); if (!BreakpointManager.ProcessLineBreakpoints(e.ScriptFullPath, e.Line, e.Column)) { if (DebuggerPaused != null) { var scriptLocation = new ScriptLocation(e.ScriptFullPath, e.Line, 0); DebuggerPaused(this, new EventArgs <ScriptLocation>(scriptLocation)); } } } catch (DebugEngineInternalException dbgEx) { Log.Debug(dbgEx.Message); DebuggingService.SetDebuggerResumeAction(DebugEngineConstants.Debugger_Stop); IsDebuggingCommandReady = false; } catch (Exception ex) { Log.Debug(ex.Message); DebuggingService.SetDebuggerResumeAction(DebugEngineConstants.Debugger_Stop); IsDebuggingCommandReady = false; throw; } finally { Log.Debug("Waiting for debuggee to resume."); IsDebuggingCommandReady = true; RefreshPrompt(); } }