internal void PushRunning(string path, ScriptBlock running, bool fromScript) { this._runningScriptStack.Push(new Debugger.ScriptBlockInfo(running)); if (!this.IsOn) { return; } ScriptDebugInfo scriptDebugInfo = (ScriptDebugInfo)null; if (this._scriptPathToDebugInfo.TryGetValue(path, out scriptDebugInfo)) { ++scriptDebugInfo.NumReferences; if (fromScript) { scriptDebugInfo.IsRecursive = true; scriptDebugInfo.SetBreakpoints(running); } } else { scriptDebugInfo = new ScriptDebugInfo(this.GetScriptBreakpointInfo(path), running, fromScript); if (fromScript) { this._scriptPathToDebugInfo.Add(path, scriptDebugInfo); } } this._runningScriptStack.Peek().DebugInfo = this._currentScriptDebugInfo = scriptDebugInfo; }
internal Debugger(ExecutionContext context) { this._context = context; this._runningScriptStack = new Stack <Debugger.ScriptBlockInfo>(); this._scriptPathToBreakpointInfo = new Dictionary <string, ScriptBreakpointInfo>((IEqualityComparer <string>)StringComparer.OrdinalIgnoreCase); this._scriptPathToDebugInfo = new Dictionary <string, ScriptDebugInfo>((IEqualityComparer <string>)StringComparer.OrdinalIgnoreCase); this._statementStack = new Stack <ParseTreeNode>(); this._globalScriptBreakpointInfo = new ScriptBreakpointInfo(context, (string)null); this._currentScriptDebugInfo = (ScriptDebugInfo)null; this._inBreakpoint = false; this._idToBreakpoint = new Dictionary <int, Breakpoint>(); this._steppingMode = Debugger.SteppingMode.None; this._callStack = new Stack <Debugger.CallStackInfo>(); this._evaluatingBreakpointAction = false; }
internal void PopRunning() { Debugger.ScriptBlockInfo scriptBlockInfo1 = this._runningScriptStack.Pop(); if (scriptBlockInfo1.DebugInfo != null) { --scriptBlockInfo1.DebugInfo.NumReferences; if (scriptBlockInfo1.DebugInfo.NumReferences == 0) { if (scriptBlockInfo1.DebugInfo.FromScript) { this._scriptPathToDebugInfo.Remove(scriptBlockInfo1.DebugInfo.BreakpointInfo.ScriptPath); } if (scriptBlockInfo1.DebugInfo.BreakpointInfo.NumBreakpoints == 0) { this._scriptPathToBreakpointInfo.Remove(scriptBlockInfo1.DebugInfo.BreakpointInfo.ScriptPath); } } } if (!this.IsOn) { return; } if (this._runningScriptStack.Count > 0) { Debugger.ScriptBlockInfo scriptBlockInfo2 = this._runningScriptStack.Peek(); if (scriptBlockInfo2.DebugInfo != null && scriptBlockInfo2.DebugInfo.IsRecursive) { scriptBlockInfo2.DebugInfo.SetBreakpoints(scriptBlockInfo2.ScriptBlock); } this._currentScriptDebugInfo = scriptBlockInfo2.DebugInfo; } else { this._currentScriptDebugInfo = (ScriptDebugInfo)null; this._steppingMode = Debugger.SteppingMode.None; } }