Browse Source

Numeric values in debugger tooltips can be shown in hexadecimal

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1164 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
0fa3296466
  1. 29
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs
  2. 21
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs

29
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs

@ -37,6 +37,15 @@ namespace ICSharpCode.SharpDevelop.Services
} }
} }
public bool ShowValuesInHexadecimal {
get {
return ((WindowsDebugger)DebuggerService.CurrentDebugger).Properties.Get("ShowValuesInHexadecimal", false);
}
set {
((WindowsDebugger)DebuggerService.CurrentDebugger).Properties.Set("ShowValuesInHexadecimal", value);
}
}
public DynamicTreeDebuggerRow() public DynamicTreeDebuggerRow()
{ {
} }
@ -68,10 +77,15 @@ namespace ICSharpCode.SharpDevelop.Services
image = DebuggerIcons.GetImage(variable); image = DebuggerIcons.GetImage(variable);
this[1].Text = ""; // Icon this[1].Text = ""; // Icon
this[2].Text = variable.Name; this[2].Text = variable.Name;
this[3].Text = variable.Value.AsString; if (ShowValuesInHexadecimal && variable.Value is PrimitiveValue && variable.Value.IsInteger) {
this[3].Text = String.Format("0x{0:X}", (variable.Value as PrimitiveValue).Primitive);
} else {
this[3].Text = variable.Value.AsString;
}
this[3].AllowLabelEdit = variable.Value is PrimitiveValue && this[3].AllowLabelEdit = variable.Value is PrimitiveValue &&
variable.Value.ManagedType != typeof(string) && variable.Value.ManagedType != typeof(string) &&
!(variable is PropertyVariable); !(variable is PropertyVariable) &&
!ShowValuesInHexadecimal;
this.ShowPlus = variable.Value.MayHaveSubVariables; this.ShowPlus = variable.Value.MayHaveSubVariables;
this.ShowMinusWhileExpanded = true; this.ShowMinusWhileExpanded = true;
@ -108,8 +122,17 @@ namespace ICSharpCode.SharpDevelop.Services
ClipboardWrapper.SetText(((DynamicListItem)sender).Text); ClipboardWrapper.SetText(((DynamicListItem)sender).Text);
}; };
ToolStripMenuItem hewView;
hewView = new ToolStripMenuItem();
hewView.Text = "Show values in hexadecimal";
hewView.Checked = ShowValuesInHexadecimal;
hewView.Click += delegate {
ShowValuesInHexadecimal = !ShowValuesInHexadecimal;
};
menu.Items.AddRange(new ToolStripItem[] { menu.Items.AddRange(new ToolStripItem[] {
copyItem copyItem,
hewView
}); });
menu.Show(e.List, e.Location); menu.Show(e.List, e.Location);

21
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs

@ -147,7 +147,26 @@ namespace Debugger
default: return null; default: return null;
} }
} }
/// <summary>
/// Returns true if the value is signed or unsigned integer of any siz
/// </summary>
public bool IsInteger {
get {
CorElementType corType = CorType;
return corType == CorElementType.I1 ||
corType == CorElementType.U1 ||
corType == CorElementType.I2 ||
corType == CorElementType.U2 ||
corType == CorElementType.I4 ||
corType == CorElementType.U4 ||
corType == CorElementType.I8 ||
corType == CorElementType.U8 ||
corType == CorElementType.I ||
corType == CorElementType.U;
}
}
internal static string CorTypeToString(CorElementType corType) internal static string CorTypeToString(CorElementType corType)
{ {
Type manType = CorTypeToManagedType(corType); Type manType = CorTypeToManagedType(corType);

Loading…
Cancel
Save