diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj index 0997b3efa3..bf10bba06b 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj @@ -57,7 +57,7 @@ ExceptionForm.cs - + @@ -151,4 +151,4 @@ - + \ No newline at end of file diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs index 4501da9d35..5a19b0f873 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs @@ -232,7 +232,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads try { localVarList.BeginUpdate(); Utils.DoEvents(debuggedProcess.DebuggeeState); - TreeViewNode.SetContentRecursive(this, localVarList.Root.Children, new StackFrameNode(debuggedProcess.SelectedStackFrame).ChildNodes); + TreeViewNode.SetContentRecursive(debuggedProcess, LocalVarList, new StackFrameNode(debuggedProcess.SelectedStackFrame).ChildNodes); } catch(AbortedBecauseDebuggeeResumedException) { } finally { localVarList.EndUpdate(); diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/TreeViewNode.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/TreeViewNode.cs index 2686aafdd3..7630e782c9 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/TreeViewNode.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/TreeViewNode.cs @@ -23,7 +23,8 @@ namespace Debugger.AddIn.TreeModel { static Dictionary expandedNodes = new Dictionary(); - LocalVarPad localVarPad; + TreeViewAdv localVarList; + Debugger.Process process; AbstractNode content; bool childsLoaded; @@ -47,16 +48,32 @@ namespace Debugger.AddIn.TreeModel } } + public TreeViewNode(Debugger.Process process, TreeViewAdv localVarList, AbstractNode content): base(localVarList, new object()) + { + this.process = process; + this.localVarList = localVarList; + SetContentRecursive(content); + } + + //TODO: Eliminate the need to associate with a LocalVarPad public TreeViewNode(LocalVarPad localVarPad, AbstractNode content): base(localVarPad.LocalVarList, new object()) { - this.localVarPad = localVarPad; + this.process = localVarPad.Process; + this.localVarList = localVarPad.LocalVarList; SetContentRecursive(content); } static TimeSpan workTime = TimeSpan.FromMilliseconds(40); static DateTime nextRepaintTime = DateTime.MinValue; - public void SetContentRecursive(AbstractNode content) + + /// + /// A simple form of SetContentRecursive that changes the current ChildViewNode to + /// display the data proviced by content. If the node had any children and is expanded, + /// it will recureively set those as well. + /// + /// Contains the name value and type of the variable stored in this particular TreeViewNode. + private void SetContentRecursive(AbstractNode content) { this.textChanged = this.content != null && @@ -65,22 +82,22 @@ namespace Debugger.AddIn.TreeModel this.content = content; this.IsLeaf = (content.ChildNodes == null); childsLoaded = false; - this.IsExpandedOnce = false; + this.IsExpandedOnce = false; if (!IsLeaf && expandedNodes.ContainsKey(this.FullName) && expandedNodes[this.FullName]) { - LoadChilds(); + LoadChildren(); this.Expand(); } else { this.Children.Clear(); this.Collapse(); } // Process user commands - Utils.DoEvents(localVarPad.Process.DebuggeeState); + Utils.DoEvents(process.DebuggeeState); // Repaint if (HighPrecisionTimer.Now > nextRepaintTime) { using(new PrintTime("Repainting Local Variables Pad")) { try { this.Tree.EndUpdate(); // Enable painting - Utils.DoEvents(localVarPad.Process.DebuggeeState); // Paint + Utils.DoEvents(process.DebuggeeState); // Paint } finally { this.Tree.BeginUpdate(); // Disable painting nextRepaintTime = HighPrecisionTimer.Now + workTime; @@ -89,7 +106,27 @@ namespace Debugger.AddIn.TreeModel } } - public static void SetContentRecursive(LocalVarPad localVarPad, IList childNodes, IEnumerable contentEnum) + /// + /// Function for setting the root treenode of a TreeViewAdv ment to display debugger variables. + /// + /// The process that contains the stackframe with the given variables. + /// A list of local variables. + /// A list of local variables. + public static void SetContentRecursive(Debugger.Process process, TreeViewAdv localVarList, IEnumerable contentEnum) { + IList childNodes = localVarList.Root.Children; + SetContentRecursive(process, localVarList, childNodes, contentEnum); + } + + + /// + /// Private form of SetContentRecursive. This form contains an extra parameter used by LoadChildren. + /// This adds the childNodes parameter, which can be set to the children of a particular child element. + /// + /// + /// + /// + /// + private static void SetContentRecursive(Debugger.Process process, TreeViewAdv localVarList, IList childNodes, IEnumerable contentEnum) { contentEnum = contentEnum ?? new AbstractNode[0]; @@ -101,7 +138,7 @@ namespace Debugger.AddIn.TreeModel ((TreeViewNode)childNodes[index]).SetContentRecursive(content); } else { // Add - childNodes.Add(new TreeViewNode(localVarPad, content)); + childNodes.Add(new TreeViewNode(process, localVarList, content)); } index++; } @@ -117,20 +154,28 @@ namespace Debugger.AddIn.TreeModel base.OnExpanding(); } - void LoadChilds() + + /// + /// This displays all the immediate children of a TreeViewNode in its containing TreeViewAdv. + /// + void LoadChildren() { if (!childsLoaded) { childsLoaded = true; this.IsExpandedOnce = true; - SetContentRecursive(localVarPad, this.Children, this.Content.ChildNodes); + SetContentRecursive(process, this.localVarList, this.Children, this.Content.ChildNodes); } } + + /// + /// Expands the current treenode and displays all its immediate children. + /// protected override void OnExpanded() { base.OnExpanded(); expandedNodes[FullName] = true; - if (localVarPad.Process.IsRunning) { + if (process.IsRunning) { MessageService.ShowMessage( "${res:MainWindow.Windows.Debug.LocalVariables.CannotExploreVariablesWhileRunning}", "${res:MainWindow.Windows.Debug.LocalVariables}" @@ -139,7 +184,7 @@ namespace Debugger.AddIn.TreeModel } try { this.Tree.BeginUpdate(); - LoadChilds(); + LoadChildren(); } catch (AbortedBecauseDebuggeeResumedException) { } finally { this.Tree.EndUpdate(); diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Exception.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Exception.cs index 273cae06a2..fcd9dc7422 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Exception.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Exception.cs @@ -61,17 +61,6 @@ namespace Debugger } } - /// - /// The InnerException property of the exception. - /// - /// - public DebuggerInnerException InnerException { - get { - Debugger.Value exVal = this.RuntimeValue.GetMemberValue("_innerException"); - return (exVal.IsNull) ? null : new DebuggerInnerException(exVal); - } - } - /// /// The Message property of the exception. /// @@ -104,6 +93,11 @@ namespace Debugger } } + /// + /// This is the call stack as represented by the Debugger.ThreadObject. + /// + /// + /// public string Callstack { get { StringBuilder callstack = new StringBuilder();