diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
index 5e0a9759e2..ec88556e6f 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
@@ -90,6 +90,7 @@
+
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/StackFrame.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/StackFrame.cs
index 73a4f686fc..bed53f2056 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/StackFrame.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/StackFrame.cs
@@ -125,7 +125,8 @@ namespace Debugger
/// Returns diagnostic description of the frame
public override string ToString()
{
- return this.MethodInfo.FullName;
+ // TODO: Use full name
+ return this.MethodInfo.DeclaringType.FullName + "." + this.MethodInfo.Name;
}
internal ICorDebugILFrame CorILFrame {
@@ -281,6 +282,7 @@ namespace Debugger
/// Gets the instance of the class asociated with the current frame.
/// That is, 'this' in C#.
///
+ [Debugger.Tests.Ignore]
public Value GetThisValue()
{
return new Value(appDomain, GetThisCorValue());
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Thread.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Thread.cs
index 788d743845..976c2bf188 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Thread.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Thread.cs
@@ -269,6 +269,7 @@ namespace Debugger
/// Gets the whole callstack of the Thread.
/// If the thread is in invalid state returns empty array
+ [Debugger.Tests.Ignore]
public StackFrame[] GetCallstack()
{
return new List(CallstackEnum).ToArray();
@@ -332,6 +333,7 @@ namespace Debugger
return stackFrame;
}
+ [Debugger.Tests.Ignore]
public string GetStackTrace()
{
return GetStackTrace("at {0} in {1}:line {2}", "at {0}");
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/Tests/IgnoreAttribute.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/Tests/IgnoreAttribute.cs
index 3df7eb152f..25059fe862 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/Tests/IgnoreAttribute.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/Tests/IgnoreAttribute.cs
@@ -9,7 +9,7 @@ using System;
namespace Debugger.Tests
{
- [AttributeUsage(AttributeTargets.Property)]
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
public class IgnoreAttribute: Attribute
{
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/Tests/IgnoreOnExceptionAttribute.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/Tests/IgnoreOnExceptionAttribute.cs
new file mode 100644
index 0000000000..e38bf87e6c
--- /dev/null
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/Tests/IgnoreOnExceptionAttribute.cs
@@ -0,0 +1,17 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+using System;
+
+namespace Debugger.Tests
+{
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Class)]
+ public class IgnoreOnExceptionAttribute: Attribute
+ {
+
+ }
+}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMethodInfo.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMethodInfo.cs
index 9fc576c626..c8bb16b0e8 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMethodInfo.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMethodInfo.cs
@@ -156,16 +156,17 @@ namespace Debugger.MetaData
// public virtual MethodInfo MakeGenericMethod(params Type[] typeArguments);
// public override bool ContainsGenericParameters { get; }
+ public override Type ReturnType {
+ get {
+ if (this.MethodDefSig.RetType.Void) return null;
+ return DebugType.CreateFromSignature(this.DebugModule, this.MethodDefSig.RetType.Type, declaringType);
+ }
+ }
+
public override ParameterInfo ReturnParameter {
get {
- return new DebugParameterInfo(
- this,
- string.Empty,
- this.MethodDefSig.RetType.Void ?
- null :
- DebugType.CreateFromSignature(this.DebugModule, this.MethodDefSig.RetType.Type, declaringType),
- -1
- );
+ if (this.MethodDefSig.RetType.Void) return null;
+ return new DebugParameterInfo(this, string.Empty, this.ReturnType, -1);
}
}
@@ -596,7 +597,8 @@ namespace Debugger.MetaData
public override string ToString()
{
- return this.FullName;
+ // TODO: Use full name
+ return this.Name;
}
}
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugPropertyInfo.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugPropertyInfo.cs
index fc8cf2336f..8b19c0f1d0 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugPropertyInfo.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugPropertyInfo.cs
@@ -54,7 +54,7 @@ namespace Debugger.MetaData
[Debugger.Tests.Ignore]
public override int MetadataToken {
- get { return (getMethod ?? setMethod).MetadataToken; }
+ get { return 0; }
}
public override System.Reflection.Module Module {
@@ -99,7 +99,13 @@ namespace Debugger.MetaData
}
public override Type PropertyType {
- get { return getMethod.ReturnType; }
+ get {
+ if (getMethod != null) {
+ return getMethod.ReturnType;
+ } else {
+ return setMethod.GetParameters()[setMethod.GetParameters().Length - 1].ParameterType;
+ }
+ }
}
public override MethodInfo[] GetAccessors(bool nonPublic)
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs
index caec2b32a1..117fe60ff6 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs
@@ -26,6 +26,7 @@ namespace Debugger.MetaData
/// If two types are identical, the references to DebugType will also be identical
/// Type will be loaded once per each appdomain.
///
+ [Debugger.Tests.IgnoreOnException]
public class DebugType: System.Type, IDebugMemberInfo
{
public const BindingFlags BindingFlagsAll = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Array.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Array.cs
index 560b2eae15..53f87b804b 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Array.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Array.cs
@@ -102,6 +102,7 @@ namespace Debugger
}
/// Returns all elements in the array
+ [Debugger.Tests.Ignore]
public Value[] GetArrayElements()
{
List values = new List();
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs
index 6dc5b07b78..a54826913d 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs
@@ -21,19 +21,15 @@ namespace Debugger
get {
if (IsNull) throw new GetValueException("Value is null");
- if (this.Type.IsClass) {
- return this.CorReferenceValue.Dereference().CastTo();
- }
- if (this.Type.IsValueType) {
- if (this.CorValue.Is()) {
- // Dereference and unbox
- return this.CorReferenceValue.Dereference().CastTo().Object;
- } else {
- return this.CorValue.CastTo();
- }
- }
-
- throw new DebuggerException("Value is not an object");
+ ICorDebugValue corValue = this.CorValue;
+ // Dereference and unbox if necessary
+ if (corValue.Is())
+ corValue = corValue.CastTo().Dereference();
+ if (corValue.Is())
+ return corValue.CastTo().Object;
+ if (!corValue.Is())
+ throw new DebuggerException("Value is not an object");
+ return corValue.CastTo();
}
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Primitive.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Primitive.cs
index a90089b5bd..988a22b032 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Primitive.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Primitive.cs
@@ -17,14 +17,17 @@ namespace Debugger
{
internal ICorDebugGenericValue CorGenericValue {
get {
- if (!this.Type.IsPrimitive && !this.Type.IsValueType) throw new DebuggerException("Value is not a 'generic'");
+ if (IsNull) throw new GetValueException("Value is null");
- // Dereference and unbox
- if (this.CorValue.Is()) {
- return this.CorReferenceValue.Dereference().CastTo().Object.CastTo();
- } else {
- return this.CorValue.CastTo();
- }
+ ICorDebugValue corValue = this.CorValue;
+ // Dereference and unbox if necessary
+ if (corValue.Is())
+ corValue = corValue.CastTo().Dereference();
+ if (corValue.Is())
+ corValue = corValue.CastTo().Object.CastTo();
+ if (!corValue.Is())
+ throw new DebuggerException("Value is not an generic value");
+ return corValue.CastTo();
}
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.cs
index e119910156..7e59d955f5 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.cs
@@ -24,7 +24,6 @@ namespace Debugger
public partial class Value: DebuggerObject
{
AppDomain appDomain;
- Process process;
ICorDebugValue corValue;
PauseSession corValue_pauseSession;
DebugType type;
@@ -40,15 +39,9 @@ namespace Debugger
/// Gets a string representation of the value
public string AsString {
get {
- if (this.IsNull) return "null";
- if (this.Type.IsArray) return "{" + this.Type.FullName + "}";
- if (this.Type.IsClass) return "{" + this.Type.FullName + "}";
- if (this.Type.IsValueType) return "{" + this.Type.FullName + "}";
+ if (this.IsNull) return "null";
if (this.Type.IsPrimitive) return PrimitiveValue.ToString();
- // Does not work well with unit tests: (variable value)
- // if (this.Type.IsPointer) return "0x" + this.CorValue.CastTo().Address.ToString("X8");
- if (this.Type.IsPointer) return "{" + this.Type.FullName + "}";
- throw new DebuggerException("Unknown type");
+ return "{" + this.Type.FullName + "}";
}
}
@@ -60,14 +53,14 @@ namespace Debugger
[Debugger.Tests.Ignore]
public Process Process {
- get { return process; }
+ get { return appDomain.Process; }
}
/// Returns true if the Value can not be used anymore.
/// Value is valid only until the debuggee is resummed.
public bool IsInvalid {
get {
- return corValue_pauseSession != process.PauseSession &&
+ return corValue_pauseSession != this.Process.PauseSession &&
!corValue.Is();
}
}
@@ -75,18 +68,16 @@ namespace Debugger
[Tests.Ignore]
public ICorDebugValue CorValue {
get {
- if (this.IsInvalid) {
+ if (this.IsInvalid)
throw new GetValueException("Value is no longer valid");
- }
-
return corValue;
}
}
ICorDebugReferenceValue CorReferenceValue {
get {
- if (!this.IsReference) throw new DebuggerException("Reference value expected");
-
+ if (!this.CorValue.Is())
+ throw new DebuggerException("Reference value expected");
return this.CorValue.CastTo();
}
}
@@ -96,9 +87,7 @@ namespace Debugger
///
[Debugger.Tests.IgnoreAttribute]
public ulong Address {
- get {
- return corValue.Address;
- }
+ get { return corValue.Address; }
}
/// Gets value indication whether the value is a reference
@@ -129,32 +118,25 @@ namespace Debugger
return newValue;
}
+ [Debugger.Tests.Ignore]
public Value GetPermanentReference()
{
- ICorDebugValue corValue = this.CorValue;
- if (this.Type.IsClass) {
- corValue = this.CorObjectValue.CastTo().CreateHandle(CorDebugHandleType.HANDLE_STRONG).CastTo();
- }
- if (this.Type.IsValueType || this.Type.IsPrimitive) {
- if (!corValue.Is()) {
- return this.Box();
- } else {
- // Make the reference to box permanent
- corValue = corValue.CastTo().Dereference().CastTo().CreateHandle(CorDebugHandleType.HANDLE_STRONG).CastTo();
- }
+ if (this.CorValue.Is()) {
+ return this;
+ } else if (this.CorValue.Is()) {
+ return new Value(appDomain, this.CorValue.CastTo().Dereference().CastTo().CreateHandle(CorDebugHandleType.HANDLE_STRONG).CastTo());
+ } else {
+ return this.Box();
}
- return new Value(appDomain, corValue);
}
internal Value(AppDomain appDomain, ICorDebugValue corValue)
{
- if (corValue == null) {
+ if (corValue == null)
throw new ArgumentNullException("corValue");
- }
this.appDomain = appDomain;
- this.process = appDomain.Process;
this.corValue = corValue;
- this.corValue_pauseSession = process.PauseSession;
+ this.corValue_pauseSession = this.Process.PauseSession;
if (corValue.Is() &&
corValue.CastTo().Value == 0 &&
@@ -171,9 +153,7 @@ namespace Debugger
/// Returns the of the value
public DebugType Type {
- get {
- return type;
- }
+ get { return type; }
}
[Tests.Ignore]
@@ -202,10 +182,9 @@ namespace Debugger
{
ICorDebugValue newCorValue = newValue.CorValue;
- if (this.IsReference) {
- if (!newCorValue.Is()) {
+ if (this.CorValue.Is()) {
+ if (!newCorValue.Is())
newCorValue = newValue.Box().CorValue;
- }
corValue.CastTo().SetValue(newCorValue.CastTo().Value);
} else {
corValue.CastTo().RawValue = newValue.CorGenericValue.RawValue;