Author: martin
Date: 2008-01-18 18:56:18 -0500 (Fri, 18 Jan 2008)
New Revision: 93301

Added:
   branches/martin/debugger-terrania/debugger/test/E.cs
Modified:
   branches/martin/debugger-terrania/debugger/ChangeLog
   branches/martin/debugger-terrania/debugger/backend/SingleSteppingEngine.cs
   branches/martin/debugger-terrania/debugger/languages/mono/MonoClassObject.cs
   branches/martin/debugger-terrania/debugger/languages/mono/MonoClassType.cs
   
branches/martin/debugger-terrania/debugger/languages/mono/MonoGenericInstanceType.cs
Log:
2008-01-19  Martin Baulig  <[EMAIL PROTECTED]>

        * languages/mono/MonoClassType.cs
        (IMonoStructType): New internal interface.
        (MonoClassType): Make things work if our parent class is a
        `MonoGenericInstanceType' and not a `MonoClassType'.



Modified: branches/martin/debugger-terrania/debugger/ChangeLog
===================================================================
--- branches/martin/debugger-terrania/debugger/ChangeLog        2008-01-18 
23:41:47 UTC (rev 93300)
+++ branches/martin/debugger-terrania/debugger/ChangeLog        2008-01-18 
23:56:18 UTC (rev 93301)
@@ -1,3 +1,10 @@
+2008-01-19  Martin Baulig  <[EMAIL PROTECTED]>
+
+       * languages/mono/MonoClassType.cs
+       (IMonoStructType): New internal interface.
+       (MonoClassType): Make things work if our parent class is a
+       `MonoGenericInstanceType' and not a `MonoClassType'.
+
 2008-01-17  Martin Baulig  <[EMAIL PROTECTED]>
 
        * languages/TargetObjectKind.cs

Modified: 
branches/martin/debugger-terrania/debugger/backend/SingleSteppingEngine.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/backend/SingleSteppingEngine.cs  
2008-01-18 23:41:47 UTC (rev 93300)
+++ branches/martin/debugger-terrania/debugger/backend/SingleSteppingEngine.cs  
2008-01-18 23:56:18 UTC (rev 93301)
@@ -3228,7 +3228,8 @@
                                Report.Debug (DebugFlags.SSE,
                                              "{0} rti resolved class: {1}", 
sse, klass);
 
-                               class_info = Function.MonoClass.ClassResolved 
(inferior, klass);
+                               class_info = language.ReadClassInfo (inferior, 
klass);
+                               Function.MonoClass.ResolveClass (inferior, 
class_info, false);
                                stage = Stage.ResolvedClass;
                                do_execute ();
                                return EventResult.Running;

Modified: 
branches/martin/debugger-terrania/debugger/languages/mono/MonoClassObject.cs
===================================================================
--- 
branches/martin/debugger-terrania/debugger/languages/mono/MonoClassObject.cs    
    2008-01-18 23:41:47 UTC (rev 93300)
+++ 
branches/martin/debugger-terrania/debugger/languages/mono/MonoClassObject.cs    
    2008-01-18 23:56:18 UTC (rev 93301)
@@ -16,20 +16,24 @@
                        this.info = info;
                }
 
-               public override TargetStructObject GetParentObject (Thread 
target)
+               public override TargetStructObject GetParentObject (Thread 
thread)
                {
+                       return (TargetStructObject) 
thread.ThreadServant.DoTargetAccess (
+                               delegate (TargetMemoryAccess target) {
+                                       return GetParentObject (target);
+                       });
+               }
+
+               internal TargetStructObject GetParentObject (TargetMemoryAccess 
target)
+               {
                        if (!type.HasParent || !type.IsByRef)
                                return null;
 
-                       MonoClassInfo parent_info = (MonoClassInfo) 
info.GetParent (target);
-                       if (parent_info == null)
+                       TargetStructType sparent = type.GetParentType (target);
+                       if (sparent == null)
                                return null;
 
-                       MonoClassType parent_type = parent_info.ClassType;
-                       if (!type.IsByRef && parent_type.IsByRef)
-                               return null;
-
-                       return new MonoClassObject (parent_type, parent_info, 
Location);
+                       return (TargetStructObject) sparent.GetObject (target, 
Location);
                }
 
                public override TargetClassObject GetCurrentObject (Thread 
thread)

Modified: 
branches/martin/debugger-terrania/debugger/languages/mono/MonoClassType.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/languages/mono/MonoClassType.cs  
2008-01-18 23:41:47 UTC (rev 93300)
+++ branches/martin/debugger-terrania/debugger/languages/mono/MonoClassType.cs  
2008-01-18 23:56:18 UTC (rev 93301)
@@ -10,8 +10,17 @@
 {
        internal delegate void ClassInitHandler (TargetMemoryAccess target, 
TargetAddress klass);
 
-       internal class MonoClassType : TargetClassType
+       internal interface IMonoStructType
        {
+               TargetStructType Type {
+                       get;
+               }
+
+               void ResolveClass (TargetMemoryAccess target, MonoClassInfo 
info, bool fail);
+       }
+
+       internal class MonoClassType : TargetClassType, IMonoStructType
+       {
                MonoFieldInfo[] fields;
                MonoMethodInfo[] methods;
                MonoPropertyInfo[] properties;
@@ -20,7 +29,7 @@
 
                Cecil.TypeDefinition type;
                MonoSymbolFile file;
-               MonoClassType parent_type;
+               IMonoStructType parent_type;
                MonoClassInfo class_info;
 
                Hashtable load_handlers;
@@ -36,8 +45,10 @@
 
                        if (type.BaseType != null) {
                                TargetType parent = 
file.MonoLanguage.LookupMonoType (type.BaseType);
-                               if (parent != null)
-                                       parent_type = (MonoClassType) 
parent.ClassType;
+                               if (parent is MonoGenericInstanceType)
+                                       parent_type = (IMonoStructType) parent;
+                               else if (parent != null)
+                                       parent_type = (IMonoStructType) 
parent.ClassType;
                        }
 
                        if (type.GenericParameters.Count > 0) {
@@ -61,6 +72,10 @@
                        this.class_info = class_info;
                }
 
+               TargetStructType IMonoStructType.Type {
+                       get { return this; }
+               }
+
                public Cecil.TypeDefinition Type {
                        get { return type; }
                }
@@ -92,7 +107,7 @@
                internal override TargetStructType GetParentType 
(TargetMemoryAccess target)
                {
                        if (parent_type != null)
-                               return parent_type;
+                               return parent_type.Type;
 
                        ResolveClass (target, true);
 
@@ -107,7 +122,7 @@
                }
 
                internal MonoClassType MonoParentType {
-                       get { return parent_type; }
+                       get { return parent_type as MonoClassType; }
                }
 
                public override Module Module {
@@ -251,19 +266,16 @@
                        return ResolveClass (target, false);
                }
 
-               internal MonoClassInfo ResolveClass (TargetMemoryAccess target, 
bool fail)
+               public MonoClassInfo ResolveClass (TargetMemoryAccess target, 
bool fail)
                {
                        if (class_info != null)
                                return class_info;
 
-                       if (parent_type != null) {
-                               if (parent_type.ResolveClass (target, fail) == 
null)
-                                       return null;
-                       }
-
                        class_info = file.LookupClassInfo (target, (int) 
type.MetadataToken.ToUInt ());
-                       if (class_info != null)
+                       if (class_info != null) {
+                               ResolveClass (target, class_info, fail);
                                return class_info;
+                       }
 
                        if (fail)
                                throw new TargetException 
(TargetError.ClassNotInitialized,
@@ -272,10 +284,14 @@
                        return null;
                }
 
-               internal MonoClassInfo ClassResolved (TargetMemoryAccess 
target, TargetAddress klass)
+               public void ResolveClass (TargetMemoryAccess target, 
MonoClassInfo info, bool fail)
                {
-                       class_info = File.MonoLanguage.ReadClassInfo (target, 
klass);
-                       return class_info;
+                       this.class_info = info;
+
+                       if (parent_type != null) {
+                               MonoClassInfo parent_info = 
class_info.GetParent (target);
+                               parent_type.ResolveClass (target, parent_info, 
fail);
+                       }
                }
 
                protected override TargetObject DoGetObject (TargetMemoryAccess 
target,

Modified: 
branches/martin/debugger-terrania/debugger/languages/mono/MonoGenericInstanceType.cs
===================================================================
--- 
branches/martin/debugger-terrania/debugger/languages/mono/MonoGenericInstanceType.cs
        2008-01-18 23:41:47 UTC (rev 93300)
+++ 
branches/martin/debugger-terrania/debugger/languages/mono/MonoGenericInstanceType.cs
        2008-01-18 23:56:18 UTC (rev 93301)
@@ -4,7 +4,7 @@
 
 namespace Mono.Debugger.Languages.Mono
 {
-       internal class MonoGenericInstanceType : TargetGenericInstanceType
+       internal class MonoGenericInstanceType : TargetGenericInstanceType, 
IMonoStructType
        {
                public readonly MonoClassType Container;
                TargetType[] type_args;
@@ -31,6 +31,10 @@
                        full_name = sb.ToString ();
                }
 
+               TargetStructType IMonoStructType.Type {
+                       get { return this; }
+               }
+
                public override string Name {
                        get { return full_name; }
                }
@@ -89,7 +93,7 @@
                        return File.MonoLanguage.ReadGenericClass (target, 
parent.GenericClass);
                }
 
-               internal MonoClassInfo ResolveClass (TargetMemoryAccess target, 
bool fail)
+               public MonoClassInfo ResolveClass (TargetMemoryAccess target, 
bool fail)
                {
                        if (class_info != null)
                                return class_info;
@@ -102,8 +106,10 @@
                                return null;
 
                        class_info = File.MonoLanguage.ReadClassInfo (target, 
klass);
-                       if (class_info != null)
+                       if (class_info != null) {
+                               ResolveClass (target, class_info, fail);
                                return class_info;
+                       }
 
                        if (fail)
                                throw new TargetException 
(TargetError.ClassNotInitialized,
@@ -112,6 +118,11 @@
                        return null;
                }
 
+               public void ResolveClass (TargetMemoryAccess target, 
MonoClassInfo info, bool fail)
+               {
+                       this.class_info = info;
+               }
+
                internal override TargetClass GetClass (TargetMemoryAccess 
target)
                {
                        ResolveClass (target, true);

Added: branches/martin/debugger-terrania/debugger/test/E.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/test/E.cs        2008-01-18 
23:41:47 UTC (rev 93300)
+++ branches/martin/debugger-terrania/debugger/test/E.cs        2008-01-18 
23:56:18 UTC (rev 93301)
@@ -0,0 +1,32 @@
+using System;
+
+public class Foo<S>
+{
+       public readonly S Data;
+
+       public Foo (S s)
+       {
+               this.Data = s;
+       }
+
+       public void Hello ()
+       {
+               Console.WriteLine (Data);
+       }
+}
+
+public class Test : Foo<int>
+{
+       public Test ()
+               : base (9)
+       { }
+}
+
+class X
+{
+       static void Main ()
+       {
+               Test test = new Test ();
+               test.Hello ();
+       }
+}

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to