Browse Source

Unavailable variables in debugger handled gracefully

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@452 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
603a58a350
  1. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  2. 36
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectVariable.cs
  3. 40
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/UnavailableVariable.cs

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj

@ -191,6 +191,7 @@ @@ -191,6 +191,7 @@
<Compile Include="Src\DebuggerInterop\Core\_ULARGE_INTEGER.cs" />
<Compile Include="Src\DebuggerInterop\MetaData\COR_FIELD_OFFSET.cs" />
<Compile Include="Src\DebuggerInterop\MetaData\IMetaDataImport.cs" />
<Compile Include="Src\Variables\UnavailableVariable.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="README.TXT" />

36
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectVariable.cs

@ -67,7 +67,7 @@ namespace DebuggerLibrary @@ -67,7 +67,7 @@ namespace DebuggerLibrary
return true;
}
}
protected override unsafe VariableCollection GetSubVariables()
{
VariableCollection subVariables = new VariableCollection();
@ -79,30 +79,30 @@ namespace DebuggerLibrary @@ -79,30 +79,30 @@ namespace DebuggerLibrary
} else {
curFrame = debugger.CurrentThread.LastFunction.CorILFrame;
}
foreach(FieldProps field in metaData.EnumFields(classProps.Token)) {
ICorDebugValue filedValue;
if (field.IsStatic) {
if (field.IsLiteral) continue; // Try next field
try {
ICorDebugValue fieldValue;
if (field.IsStatic) {
if (field.IsLiteral) continue; // Try next field
corClass.GetStaticFieldValue(field.Token, curFrame, out fieldValue);
} else {
if (corValue == null) continue; // Try next field
((ICorDebugObjectValue)corValue).GetFieldValue(corClass, field.Token, out fieldValue);
}
// If current frame is not availiable, skip field
// TODO: This is not necessary if field is not context specific
if (curFrame == null) continue;
corClass.GetStaticFieldValue(field.Token, curFrame, out filedValue);
} else {
if (corValue == null) continue; // Try next field
((ICorDebugObjectValue)corValue).GetFieldValue(corClass, field.Token, out filedValue);
subVariables.Add(VariableFactory.CreateVariable(debugger, fieldValue, field.Name));
} catch {
subVariables.Add(new UnavailableVariable(debugger, null, field.Name));
}
subVariables.Add(VariableFactory.CreateVariable(debugger, filedValue, field.Name));
}
return subVariables;
}
public unsafe ObjectVariable BaseClass {
get {
if (baseClass == null) baseClass = GetBaseClass();

40
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/UnavailableVariable.cs

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Runtime.InteropServices;
using DebuggerInterop.Core;
namespace DebuggerLibrary
{
public class UnavailableVariable: Variable
{
public override object Value {
get {
return "<unavailable>";
}
}
public override string Type {
get {
return "<unknown>";
}
}
internal unsafe UnavailableVariable(NDebugger debugger, ICorDebugValue corValue, string name):base(debugger, corValue, name)
{
}
public override bool MayHaveSubVariables {
get {
return false;
}
}
}
}
Loading…
Cancel
Save