diff options
author | Jeffrey Stedfast <jeff@xamarin.com> | 2014-05-02 14:57:48 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2014-05-02 22:06:10 +0400 |
commit | 3b0fd1135965dce6c499c62b7ebf0cee81518e79 (patch) | |
tree | ef2da37565b46d17021dff49ee8004a4d9d1e983 /main/src/addins/MonoDevelop.Debugger.Win32 | |
parent | 6d9fd3e7be0d1e1b424c12acdc4c316087bed8c4 (diff) |
Merge pull request #75 from DavidKarlas/win32ArrayAndString
Win32 debugger Array and String properties/methods support
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger.Win32')
2 files changed, 31 insertions, 10 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs index afc12c9761..1dd1d6f3b7 100644 --- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs +++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorObjectAdaptor.cs @@ -78,11 +78,6 @@ namespace MonoDevelop.Debugger.Win32 return GetRealObject (ctx, val) is CorStringValue;
}
- public override bool IsClassInstance (EvaluationContext ctx, object val)
- {
- return GetRealObject (ctx, val) is CorObjectValue;
- }
-
public override bool IsNull (EvaluationContext ctx, object gval)
{
CorValRef val = (CorValRef) gval;
@@ -99,6 +94,10 @@ namespace MonoDevelop.Debugger.Win32 var t = (CorType) type;
var cctx = (CorEvaluationContext)ctx;
Type tt;
+ if (t.Type == CorElementType.ELEMENT_TYPE_STRING ||
+ t.Type == CorElementType.ELEMENT_TYPE_ARRAY ||
+ t.Type == CorElementType.ELEMENT_TYPE_SZARRAY)
+ return true;
// Primitive check
if (MetadataHelperFunctionsExtensions.CoreTypes.TryGetValue (t.Type, out tt))
return false;
@@ -386,7 +385,13 @@ namespace MonoDevelop.Debugger.Win32 try {
if (method != null) {
CorValRef v = new CorValRef (delegate {
- CorFunction func = targetType.Class.Module.GetFunctionFromToken (method.MetadataToken);
+ CorModule mod = null;
+ if (targetType.Type == CorElementType.ELEMENT_TYPE_ARRAY || targetType.Type == CorElementType.ELEMENT_TYPE_SZARRAY) {
+ mod = ((CorType)ctx.Adapter.GetType (ctx, "System.Object")).Class.Module;
+ } else {
+ mod = targetType.Class.Module;
+ }
+ CorFunction func = mod.GetFunctionFromToken (method.MetadataToken);
CorValue[] args = new CorValue[argValues.Length];
for (int n = 0; n < args.Length; n++)
args[n] = argValues[n].Val;
@@ -423,10 +428,14 @@ namespace MonoDevelop.Debugger.Win32 if (methodName == ".ctor")
break; // Can't create objects using constructor from base classes
- if (rtype.BaseType == null && rtype.FullName != "System.Object")
+ if ((rtype.BaseType == null && rtype.FullName != "System.Object") ||
+ currentType.Type == CorElementType.ELEMENT_TYPE_ARRAY ||
+ currentType.Type == CorElementType.ELEMENT_TYPE_SZARRAY ||
+ currentType.Type == CorElementType.ELEMENT_TYPE_STRING) {
currentType = ctx.Adapter.GetType (ctx, "System.Object") as CorType;
- else
+ } else {
currentType = currentType.Base;
+ }
}
return OverloadResolve (ctx, GetTypeName (ctx, type), methodName, argtypes, candidates, throwIfNotFound);
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/PropertyReference.cs b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/PropertyReference.cs index 93fd50c4f5..f97d9c3683 100644 --- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/PropertyReference.cs +++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/PropertyReference.cs @@ -29,6 +29,7 @@ using System.Reflection; using Mono.Debugging.Client; using Mono.Debugging.Evaluation; using Microsoft.Samples.Debugging.CorDebug; +using Microsoft.Samples.Debugging.CorDebug.NativeApi; namespace MonoDevelop.Debugger.Win32 { @@ -53,7 +54,12 @@ namespace MonoDevelop.Debugger.Win32 { this.prop = prop; this.declaringType = declaringType; - this.module = declaringType.Class.Module; + if (declaringType.Type == CorElementType.ELEMENT_TYPE_ARRAY || + declaringType.Type == CorElementType.ELEMENT_TYPE_SZARRAY) { + this.module = ((CorType)((CorEvaluationContext)ctx).Adapter.GetType (ctx, "System.Object")).Class.Module; + } else { + this.module = declaringType.Class.Module; + } this.index = index; if (!prop.GetGetMethod (true).IsStatic) this.thisobj = thisobj; @@ -98,7 +104,13 @@ namespace MonoDevelop.Debugger.Win32 MethodInfo mi = prop.GetGetMethod (); CorFunction func = module.GetFunctionFromToken (mi.MetadataToken); - CorValue val = ctx.RuntimeInvoke (func, declaringType.TypeParameters, thisobj != null ? thisobj.Val : null, args); + CorValue val = null; + if (declaringType.Type == CorElementType.ELEMENT_TYPE_ARRAY || + declaringType.Type == CorElementType.ELEMENT_TYPE_SZARRAY) { + val = ctx.RuntimeInvoke (func, new CorType[0], thisobj != null ? thisobj.Val : null, args); + } else { + val = ctx.RuntimeInvoke (func, declaringType.TypeParameters, thisobj != null ? thisobj.Val : null, args); + } return cachedValue = new CorValRef (val, loader); } set { |