Browse Source

Argument names and values can be show/hidden using callstack context menu

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@404 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 21 years ago
parent
commit
0eb74d009e
  1. 78
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs
  2. 18
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

78
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs

@ -56,8 +56,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -56,8 +56,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
callStackList.Columns.AddRange(new ColumnHeader[] {name, language} );
callStackList.ContextMenuStrip = CreateContextMenuStrip();
callStackList.ItemActivate += new EventHandler(CallStackListItemActivate);
name.Width = 300;
language.Width = 400;
name.Width = 500;
language.Width = 50;
RedrawContent();
@ -86,6 +86,24 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -86,6 +86,24 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
language.Text = "Language";
}
public bool ShowArgumentNames {
get {
return debugger.Properties.Get("ShowArgumentNames", true);
}
set {
debugger.Properties.Set("ShowArgumentNames", value);
}
}
public bool ShowArgumentValues {
get {
return debugger.Properties.Get("ShowArgumentValues", true);
}
set {
debugger.Properties.Set("ShowArgumentValues", value);
}
}
public bool ShowExternalMethods {
get {
return debugger.Properties.Get("ShowExternalMethods", false);
@ -107,6 +125,26 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -107,6 +125,26 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
ContextMenuStrip menu = sender as ContextMenuStrip;
menu.Items.Clear();
ToolStripMenuItem argNamesItem;
argNamesItem = new ToolStripMenuItem();
argNamesItem.Text = "Show argument names";
argNamesItem.Checked = ShowArgumentNames;
argNamesItem.Click +=
delegate {
ShowArgumentNames = !ShowArgumentNames;
RefreshList();
};
ToolStripMenuItem argValuesItem;
argValuesItem = new ToolStripMenuItem();
argValuesItem.Text = "Show argument values";
argValuesItem.Checked = ShowArgumentValues;
argValuesItem.Click +=
delegate {
ShowArgumentValues = !ShowArgumentValues;
RefreshList();
};
ToolStripMenuItem extMethodsItem;
extMethodsItem = new ToolStripMenuItem();
extMethodsItem.Text = "Show external methods";
@ -117,7 +155,11 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -117,7 +155,11 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
RefreshList();
};
menu.Items.Add(extMethodsItem);
menu.Items.AddRange(new ToolStripItem[] {
argNamesItem,
argValuesItem,
extMethodsItem
});
e.Cancel = false;
}
@ -150,6 +192,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -150,6 +192,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
public void RefreshList()
{
bool showArgumentNames = ShowArgumentNames;
bool showArgumentValues = ShowArgumentValues;
bool showExternalMethods = ShowExternalMethods;
bool lastItemIsExternalMethod = false;
@ -160,7 +204,33 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -160,7 +204,33 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
ListViewItem item;
if (f.HasSymbols || showExternalMethods) {
// Show the method in the list
item = new ListViewItem(new string[] { f.Name, "" });
string name = f.Name;
if (showArgumentNames || showArgumentValues) {
name += "(";
for (int i = 0; i < f.ArgumentCount; i++) {
if (showArgumentNames) {
name += f.GetParameterName(i);
}
if (showArgumentValues) {
try {
string argValue = f.GetArgumentVariable(i).Value.ToString();
if (showArgumentNames) {
name += "=";
}
name += argValue;
} catch {
if (!showArgumentNames) {
name += "n/a";
}
}
}
if (i < f.ArgumentCount - 1) {
name += ", ";
}
}
name += ")";
}
item = new ListViewItem(new string[] { name, "" });
lastItemIsExternalMethod = false;
} else {
// Show [External methods] in the list

18
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -370,12 +370,15 @@ namespace DebuggerLibrary @@ -370,12 +370,15 @@ namespace DebuggerLibrary
return module.MetaData.GetParamForMethodIndex(methodProps.Token, (uint)index + 1).Name;
}
public int GetArgumentCount {
public int ArgumentCount {
get {
ICorDebugValueEnum argumentEnum;
corILFrame.EnumerateArguments(out argumentEnum);
uint argCount;
argumentEnum.GetCount(out argCount);
if (!IsStatic) {
argCount--; // Remove 'this' from count
}
return (int)argCount;
}
}
@ -388,18 +391,19 @@ namespace DebuggerLibrary @@ -388,18 +391,19 @@ namespace DebuggerLibrary
return arg;
}
public Variable GetArgumentVariable(int index)
{
return VariableFactory.CreateVariable(debugger, GetArgumentValue(index), GetParameterName(index));
}
public VariableCollection GetArgumentVariables()
{
VariableCollection arguments = new VariableCollection();
int argCount = GetArgumentCount;
if (!IsStatic) {
argCount--; // Remove 'this' from count
}
int argCount = ArgumentCount;
for (int i = 0; i < argCount; i++) {
arguments.Add(VariableFactory.CreateVariable(debugger, GetArgumentValue(i), GetParameterName(i)));
arguments.Add(GetArgumentVariable(i));
}
return arguments;

Loading…
Cancel
Save