Browse Source

* Caching of Variable.CorType

* Base classes disabled in Local Variables Pad
 * Icons in subtrees of Local Variables Pad fixed

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@100 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 21 years ago
parent
commit
a99c5185e4
  1. 24
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs
  2. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/BuiltInVariable.cs
  3. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/NullRefVariable.cs
  4. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs

24
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs

@ -95,17 +95,17 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
e.Item.Items.Clear(); e.Item.Items.Clear();
ObjectVariable var = e.Item.Tag as ObjectVariable; ObjectVariable var = e.Item.Tag as ObjectVariable;
if (var != null && var.HasBaseClass && var.BaseClass.Type != "System.Object") /*if (var != null && var.HasBaseClass && var.BaseClass.Type != "System.Object")
{ {
TreeListViewItem newItem = new TreeListViewItem(); TreeListViewItem newItem = new TreeListViewItem();
newItem.Text = "<Base class>"; newItem.Text = "Base class";
newItem.SubItems.Add(var.BaseClass.Value.ToString()); newItem.SubItems.Add(var.BaseClass.Value.ToString());
newItem.SubItems.Add(var.BaseClass.Type); newItem.SubItems.Add(var.BaseClass.Type);
newItem.Tag = var.BaseClass; newItem.Tag = var.BaseClass;
newItem.ImageIndex = 0; // Class newItem.ImageIndex = 0; // Class
newItem.Items.Add(""); // Show plus icon newItem.Items.Add(""); // Show plus icon
e.Item.Items.Add(newItem); e.Item.Items.Add(newItem);
} }*/
AddVariables(e.Item.Items, ((Variable)e.Item.Tag).SubVariables); AddVariables(e.Item.Items, ((Variable)e.Item.Tag).SubVariables);
localVarList.EndUpdate(); localVarList.EndUpdate();
@ -135,18 +135,34 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
void RefreshVariable (Variable var) void RefreshVariable (Variable var)
{ {
foreach (TreeListViewItem item in localVarList.Items) { RefreshVariableInItemConnection(var, localVarList.Items);
}
void RefreshVariableInItemConnection (Variable var, TreeListViewItemCollection items)
{
foreach (TreeListViewItem item in items) {
// Refresh in sub trees
RefreshVariableInItemConnection(var, item.Items);
if (item.Tag == var) { if (item.Tag == var) {
if (item.SubItems[1].Text == null) {
item.SubItems[1].Text = var.Value.ToString(); item.SubItems[1].Text = var.Value.ToString();
}
item.SubItems[2].Text = var.Type; item.SubItems[2].Text = var.Type;
item.Items.Clear(); item.Items.Clear();
if (var is ObjectVariable && ((ObjectVariable)var).HasBaseClass) { if (var is ObjectVariable && ((ObjectVariable)var).HasBaseClass) {
// It is a class // It is a class
item.ImageIndex = 0; // Class item.ImageIndex = 0; // Class
item.Items.Add(""); // Show plus icon item.Items.Add(""); // Show plus icon
object devNull = (var as ObjectVariable).SubVariables; // Cache variables TODO: LAME
} else if (var is PropertyVariable){ } else if (var is PropertyVariable){
// It is a property // It is a property
item.ImageIndex = 2; // Property item.ImageIndex = 2; // Property
if ((var as PropertyVariable).IsEvaluated && (var as PropertyVariable).Value is ObjectVariable) {
item.Items.Add(""); // Show plus icon
}
} else { } else {
item.ImageIndex = 1; // Field item.ImageIndex = 1; // Field
} }

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/BuiltInVariable.cs

@ -15,7 +15,7 @@ namespace DebuggerLibrary
{ {
get get
{ {
if (corType == CorElementType.STRING) if (CorType == CorElementType.STRING)
{ {
((ICorDebugStringValue)corValue).GetString(NDebugger.pStringLen, ((ICorDebugStringValue)corValue).GetString(NDebugger.pStringLen,
out NDebugger.unused, out NDebugger.unused,
@ -26,7 +26,7 @@ namespace DebuggerLibrary
object retValue; object retValue;
IntPtr pValue = Marshal.AllocHGlobal(8); IntPtr pValue = Marshal.AllocHGlobal(8);
((ICorDebugGenericValue)corValue).GetValue(pValue); ((ICorDebugGenericValue)corValue).GetValue(pValue);
switch(corType) switch(CorType)
{ {
case CorElementType.BOOLEAN: retValue = *((System.Boolean*)pValue); break; case CorElementType.BOOLEAN: retValue = *((System.Boolean*)pValue); break;
case CorElementType.CHAR: retValue = *((System.Char*)pValue); break; case CorElementType.CHAR: retValue = *((System.Char*)pValue); break;

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/NullRefVariable.cs

@ -21,7 +21,7 @@ namespace DebuggerLibrary
{ {
get get
{ {
switch (corType) switch (CorType)
{ {
case CorElementType.SZARRAY: case CorElementType.SZARRAY:
case CorElementType.ARRAY: return typeof(System.Array).ToString(); case CorElementType.ARRAY: return typeof(System.Array).ToString();

10
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variable.cs

@ -15,6 +15,7 @@ namespace DebuggerLibrary
readonly string name; readonly string name;
protected ICorDebugValue corValue; protected ICorDebugValue corValue;
VariableCollection subVariables; VariableCollection subVariables;
CorElementType? corType;
public string Name { public string Name {
@ -27,15 +28,18 @@ namespace DebuggerLibrary
get; get;
} }
internal CorElementType corType { internal CorElementType CorType {
get { get {
return GetCorType(corValue); if (!corType.HasValue) {
corType = GetCorType(corValue);
}
return corType.Value;
} }
} }
public virtual string Type { public virtual string Type {
get{ get{
return CorTypeToString(corType); return CorTypeToString(CorType);
} }
} }

Loading…
Cancel
Save