Browse Source

add module names and line number to callstack

pull/15/head
Eusebiu Marcu 15 years ago committed by Daniel Grunwald
parent
commit
614ed865a7
  1. 12
      data/resources/StringResources.resx
  2. 2
      src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptions.cs
  3. 54
      src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs
  4. 2
      src/AddIns/Debugger/Debugger.Core/StackFrame.cs

12
data/resources/StringResources.resx

@ -5741,6 +5741,15 @@ Unable to find 'WelcomeDialogId' in Dialogs.wxs</comment> @@ -5741,6 +5741,15 @@ Unable to find 'WelcomeDialogId' in Dialogs.wxs</comment>
<data name="MainWindow.Windows.Debug.CallStack.ShowExternalMethods" xml:space="preserve">
<value>Show external methods</value>
</data>
<data name="MainWindow.Windows.Debug.CallStack.ShowLineNumber" xml:space="preserve">
<value>Show line numbers</value>
</data>
<data name="MainWindow.Windows.Debug.CallStack.ShowModuleNames" xml:space="preserve">
<value>Show module names</value>
</data>
<data name="MainWindow.Windows.Debug.CallStack.LineString" xml:space="preserve">
<value> Line </value>
</data>
<data name="MainWindow.Windows.Debug.Conditional.Breakpoints.Ask" xml:space="preserve">
<value>Ask</value>
</data>
@ -5937,6 +5946,9 @@ Shows the full callstack of the error.</comment> @@ -5937,6 +5946,9 @@ Shows the full callstack of the error.</comment>
<data name="MainWindow.Windows.Debug.ObjectGraph" xml:space="preserve">
<value>Object Graph</value>
</data>
<data name="MainWindow.Windows.Debug.ParallelStack" xml:space="preserve">
<value>Parallel Stack</value>
</data>
<data name="MainWindow.Windows.Debug.RunToCursor" xml:space="preserve">
<value>Run to cursor</value>
</data>

2
src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptions.cs

@ -23,6 +23,8 @@ namespace ICSharpCode.SharpDevelop.Services @@ -23,6 +23,8 @@ namespace ICSharpCode.SharpDevelop.Services
public bool ShowArgumentNames;
public bool ShowArgumentValues;
public bool ShowExternalMethods;
public bool ShowLineNumbers;
public bool ShowModuleNames;
// Properties for the DebuggerExceptionForm
public FormWindowState DebuggerEventWindowState = FormWindowState.Normal;

54
src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.xaml.cs

@ -32,6 +32,22 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -32,6 +32,22 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
ContextMenu CreateMenu()
{
MenuItem extMethodsItem = new MenuItem();
extMethodsItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowExternalMethods");
extMethodsItem.IsChecked = DebuggingOptions.Instance.ShowExternalMethods;
extMethodsItem.Click += delegate {
extMethodsItem.IsChecked = DebuggingOptions.Instance.ShowExternalMethods = !DebuggingOptions.Instance.ShowExternalMethods;
RefreshPad();
};
MenuItem moduleItem = new MenuItem();
moduleItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowModuleNames");
moduleItem.IsChecked = DebuggingOptions.Instance.ShowModuleNames;
moduleItem.Click += delegate {
moduleItem.IsChecked = DebuggingOptions.Instance.ShowModuleNames = !DebuggingOptions.Instance.ShowModuleNames;
RefreshPad();
};
MenuItem argNamesItem = new MenuItem();
argNamesItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowArgumentNames");
argNamesItem.IsChecked = DebuggingOptions.Instance.ShowArgumentNames;
@ -48,19 +64,22 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -48,19 +64,22 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
RefreshPad();
};
MenuItem extMethodsItem = new MenuItem();
extMethodsItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowExternalMethods");
extMethodsItem.IsChecked = DebuggingOptions.Instance.ShowExternalMethods;
extMethodsItem.Click += delegate {
extMethodsItem.IsChecked = DebuggingOptions.Instance.ShowExternalMethods = !DebuggingOptions.Instance.ShowExternalMethods;
MenuItem lineItem = new MenuItem();
lineItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowLineNumber");
lineItem.IsChecked = DebuggingOptions.Instance.ShowLineNumbers;
lineItem.Click += delegate {
lineItem.IsChecked = DebuggingOptions.Instance.ShowLineNumbers = !DebuggingOptions.Instance.ShowLineNumbers;
RefreshPad();
};
return new ContextMenu() {
Items = {
extMethodsItem,
new Separator(),
moduleItem,
argNamesItem,
argValuesItem,
extMethodsItem
lineItem
}
};
}
@ -164,12 +183,21 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -164,12 +183,21 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
}
}
string GetFullName(StackFrame frame)
internal static string GetFullName(StackFrame frame)
{
bool showArgumentNames = DebuggingOptions.Instance.ShowArgumentNames;
bool showArgumentValues = DebuggingOptions.Instance.ShowArgumentValues;
bool showLineNumber = DebuggingOptions.Instance.ShowLineNumbers;
bool showModuleNames = DebuggingOptions.Instance.ShowModuleNames;
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('.');
name.Append(frame.MethodInfo.Name);
@ -209,6 +237,18 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -209,6 +237,18 @@ 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();
}
}

2
src/AddIns/Debugger/Debugger.Core/StackFrame.cs

@ -139,7 +139,7 @@ namespace Debugger @@ -139,7 +139,7 @@ namespace Debugger
}
}
SourcecodeSegment GetSegmentForOffet(int offset)
public SourcecodeSegment GetSegmentForOffet(int offset)
{
return SourcecodeSegment.Resolve(this.MethodInfo.DebugModule, corFunction, offset);
}

Loading…
Cancel
Save