From 47b05cc00cf2eac80c203bdbd9260dd090a05024 Mon Sep 17 00:00:00 2001 From: Eusebiu Marcu Date: Wed, 24 Nov 2010 00:43:06 +0200 Subject: [PATCH] add columns module name and line number add namespace to name --- data/resources/StringResources.resx | 3 ++ .../Debugger.AddIn/Pads/CallStackPad.xaml | 14 ++++++ .../Debugger.AddIn/Pads/CallStackPad.xaml.cs | 50 +++++++++++-------- .../Debugger/Debugger.Core/StackFrame.cs | 2 +- 4 files changed, 48 insertions(+), 21 deletions(-) diff --git a/data/resources/StringResources.resx b/data/resources/StringResources.resx index 32061a65b5..a7a6f90daf 100644 --- a/data/resources/StringResources.resx +++ b/data/resources/StringResources.resx @@ -5747,6 +5747,9 @@ Unable to find 'WelcomeDialogId' in Dialogs.wxs Show module names + + Module + Line diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml b/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml index ec0cf9aefb..d9accbd7b3 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml +++ b/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml @@ -6,6 +6,13 @@ + + + + + + + @@ -13,6 +20,13 @@ + + + + + + + diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs b/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs index 15b403f223..6da43185b1 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs @@ -28,6 +28,9 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads InitializeComponent(); view.ContextMenu = CreateMenu(); + + ((GridView)view.View).Columns[0].Width = DebuggingOptions.Instance.ShowModuleNames ? 100d : 0d; + ((GridView)view.View).Columns[2].Width = DebuggingOptions.Instance.ShowLineNumbers ? 50d : 0d; } ContextMenu CreateMenu() @@ -45,6 +48,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads moduleItem.IsChecked = DebuggingOptions.Instance.ShowModuleNames; moduleItem.Click += delegate { moduleItem.IsChecked = DebuggingOptions.Instance.ShowModuleNames = !DebuggingOptions.Instance.ShowModuleNames; + ((GridView)view.View).Columns[0].Width = DebuggingOptions.Instance.ShowModuleNames ? 100d : 0d; RefreshPad(); }; @@ -69,6 +73,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads lineItem.IsChecked = DebuggingOptions.Instance.ShowLineNumbers; lineItem.Click += delegate { lineItem.IsChecked = DebuggingOptions.Instance.ShowLineNumbers = !DebuggingOptions.Instance.ShowLineNumbers; + ((GridView)view.View).Columns[2].Width = DebuggingOptions.Instance.ShowLineNumbers ? 50d : 0d; RefreshPad(); }; @@ -166,14 +171,34 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads foreach (StackFrame frame in debuggedProcess.SelectedThread.GetCallstack(100)) { CallStackItem item; + + // line number + string lineNumber = string.Empty; + if (DebuggingOptions.Instance.ShowLineNumbers) { + if (frame.NextStatement != null) + lineNumber = frame.NextStatement.StartLine.ToString(); + } + + // show modules names + string moduleName = string.Empty; + if (DebuggingOptions.Instance.ShowModuleNames) { + moduleName = frame.MethodInfo.DebugModule.ToString(); + } + if (frame.HasSymbols || showExternalMethods) { // Show the method in the list - item = new CallStackItem() { Name = GetFullName(frame), Language = "" }; + + item = new CallStackItem() { + Name = GetFullName(frame), Language = "", Line = lineNumber, ModuleName = moduleName + }; lastItemIsExternalMethod = false; } else { // Show [External methods] in the list if (lastItemIsExternalMethod) continue; - item = new CallStackItem() { Name = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ExternalMethods"), Language = "" }; + item = new CallStackItem() { + Name = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ExternalMethods"), + Language = "" + }; lastItemIsExternalMethod = true; } item.Frame = frame; @@ -192,13 +217,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads StringBuilder name = new StringBuilder(); - // show modules names - if (showModuleNames) { - name.Append(frame.MethodInfo.DebugModule.ToString()); - name.Append("!"); - } - - name.Append(frame.MethodInfo.DeclaringType.Name); + name.Append(frame.MethodInfo.DeclaringType.FullName); name.Append('.'); name.Append(frame.MethodInfo.Name); if (showArgumentNames || showArgumentValues) { @@ -238,17 +257,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads name.Append(")"); } - // line number - if (showLineNumber) { - var segmentCode = frame.GetSegmentForOffet(0); - if (segmentCode != null) { - name.Append(ResourceService.GetString("MainWindow.Windows.Debug.CallStack.LineString")); - name.Append(segmentCode.StartLine.ToString()); - name.Append("->"); - name.Append(frame.NextStatement.StartLine.ToString()); - } - } - return name.ToString(); } } @@ -258,6 +266,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads public string Name { get; set; } public string Language { get; set; } public StackFrame Frame { get; set; } + public string Line { get; set; } + public string ModuleName { get; set; } public Brush FontColor { get { return Frame == null || Frame.HasSymbols ? Brushes.Black : Brushes.Gray; } diff --git a/src/AddIns/Debugger/Debugger.Core/StackFrame.cs b/src/AddIns/Debugger/Debugger.Core/StackFrame.cs index 44dc1c3ae6..2f0858c23f 100644 --- a/src/AddIns/Debugger/Debugger.Core/StackFrame.cs +++ b/src/AddIns/Debugger/Debugger.Core/StackFrame.cs @@ -139,7 +139,7 @@ namespace Debugger } } - public SourcecodeSegment GetSegmentForOffet(int offset) + SourcecodeSegment GetSegmentForOffet(int offset) { return SourcecodeSegment.Resolve(this.MethodInfo.DebugModule, corFunction, offset); }