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>
<data name="MainWindow.Windows.Debug.CallStack.ShowExternalMethods" xml:space="preserve"> <data name="MainWindow.Windows.Debug.CallStack.ShowExternalMethods" xml:space="preserve">
<value>Show external methods</value> <value>Show external methods</value>
</data> </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"> <data name="MainWindow.Windows.Debug.Conditional.Breakpoints.Ask" xml:space="preserve">
<value>Ask</value> <value>Ask</value>
</data> </data>
@ -5937,6 +5946,9 @@ Shows the full callstack of the error.</comment>
<data name="MainWindow.Windows.Debug.ObjectGraph" xml:space="preserve"> <data name="MainWindow.Windows.Debug.ObjectGraph" xml:space="preserve">
<value>Object Graph</value> <value>Object Graph</value>
</data> </data>
<data name="MainWindow.Windows.Debug.ParallelStack" xml:space="preserve">
<value>Parallel Stack</value>
</data>
<data name="MainWindow.Windows.Debug.RunToCursor" xml:space="preserve"> <data name="MainWindow.Windows.Debug.RunToCursor" xml:space="preserve">
<value>Run to cursor</value> <value>Run to cursor</value>
</data> </data>

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

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

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

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

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

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

Loading…
Cancel
Save