Author: martin
Date: 2007-10-09 13:03:51 -0400 (Tue, 09 Oct 2007)
New Revision: 87196

Modified:
   branches/martin/debugger-terrania/ChangeLog
   branches/martin/debugger-terrania/frontend/Style.cs
   branches/martin/debugger-terrania/languages/mono/MonoClassInfo.cs
   branches/martin/debugger-terrania/languages/mono/MonoClassObject.cs
   branches/martin/debugger-terrania/languages/mono/MonoClassType.cs
   branches/martin/debugger-terrania/languages/mono/MonoLanguageBackend.cs
   branches/martin/debugger-terrania/languages/mono/MonoMember.cs
Log:
Merged from HEAD.

Modified: branches/martin/debugger-terrania/ChangeLog
===================================================================
--- branches/martin/debugger-terrania/ChangeLog 2007-10-09 17:01:20 UTC (rev 
87195)
+++ branches/martin/debugger-terrania/ChangeLog 2007-10-09 17:03:51 UTC (rev 
87196)
@@ -1,5 +1,16 @@
 2007-10-09  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * languages/mono/MonoClassInfo.cs
+       (MonoClassInfo): Moved the implementations of GetField(),
+       SetField(), GetStaticField() and SetStaticField() here from
+       `MonoClassType'.
+
+       * languages/mono/MonoClassType.cs
+       (MonoClassType): Moved all the code dealing with fields into
+       `MonoClassInfo'.        
+
+2007-10-09  Martin Baulig  <[EMAIL PROTECTED]>
+
        * languages/TargetMember.cs
        (TargetEnumInfo): New public abstract class.
 

Modified: branches/martin/debugger-terrania/frontend/Style.cs
===================================================================
--- branches/martin/debugger-terrania/frontend/Style.cs 2007-10-09 17:01:20 UTC 
(rev 87195)
+++ branches/martin/debugger-terrania/frontend/Style.cs 2007-10-09 17:03:51 UTC 
(rev 87196)
@@ -222,14 +222,13 @@
                }
 
                protected string FormatEnumMember (Thread target, string prefix,
-                                                  TargetMemberInfo member, 
bool is_static,
+                                                  TargetEnumInfo info, bool 
is_static,
                                                   Hashtable hash)
                {
-                       TargetFieldInfo fi = member as TargetFieldInfo;
                        string value = "";
-                       if (fi.HasConstValue)
-                               value = String.Format (" = {0}", fi.ConstValue);
-                       return String.Format ("{0}   {1}{2}", prefix, 
member.Name, value);
+                       if (info.HasConstValue)
+                               value = String.Format (" = {0}", 
info.ConstValue);
+                       return String.Format ("{0}   {1}{2}", prefix, 
info.Name, value);
                }
 
                protected string FormatMember (string prefix, TargetMemberInfo 
member,

Modified: branches/martin/debugger-terrania/languages/mono/MonoClassInfo.cs
===================================================================
--- branches/martin/debugger-terrania/languages/mono/MonoClassInfo.cs   
2007-10-09 17:01:20 UTC (rev 87195)
+++ branches/martin/debugger-terrania/languages/mono/MonoClassInfo.cs   
2007-10-09 17:03:51 UTC (rev 87196)
@@ -126,18 +126,86 @@
                        }
                }
 
-               public int[] GetFieldOffsets (TargetMemoryAccess target)
+               public TargetObject GetField (TargetMemoryAccess target, 
TargetLocation location,
+                                             TargetFieldInfo field)
                {
                        get_field_offsets (target);
-                       return field_offsets;
+
+                       int offset = field_offsets [field.Position];
+                       TargetType type = field_types [field.Position];
+
+                       if (!ClassType.IsByRef)
+                               offset -= 2 * 
target.TargetInfo.TargetAddressSize;
+                       TargetLocation field_loc = location.GetLocationAtOffset 
(offset);
+
+                       if (type.IsByRef)
+                               field_loc = field_loc.GetDereferencedLocation 
();
+
+                       if (field_loc.HasAddress && field_loc.GetAddress 
(target).IsNull)
+                               return null;
+
+                       return type.GetObject (target, field_loc);
                }
 
-               public TargetType[] GetFieldTypes (TargetMemoryAccess target)
+               public void SetField (TargetAccess target, TargetLocation 
location,
+                                     TargetFieldInfo field, TargetObject obj)
                {
                        get_field_offsets (target);
-                       return field_types;
+
+                       int offset = field_offsets [field.Position];
+                       TargetType type = field_types [field.Position];
+
+                       if (!ClassType.IsByRef)
+                               offset -= 2 * 
target.TargetInfo.TargetAddressSize;
+                       TargetLocation field_loc = location.GetLocationAtOffset 
(offset);
+
+                       if (type.IsByRef)
+                               field_loc = field_loc.GetDereferencedLocation 
();
+
+                       type.SetObject (target, field_loc, obj);
                }
 
+               public TargetObject GetStaticField (Thread target, 
TargetFieldInfo field)
+               {
+                       get_field_offsets (target);
+
+                       int offset = field_offsets [field.Position];
+                       TargetType type = field_types [field.Position];
+
+                       TargetAddress data_address = target.CallMethod (
+                               
SymbolFile.MonoLanguage.MonoDebuggerInfo.ClassGetStaticFieldData,
+                               KlassAddress, 0);
+
+                       TargetLocation location = new AbsoluteTargetLocation 
(data_address);
+                       TargetLocation field_loc = location.GetLocationAtOffset 
(offset);
+
+                       if (type.IsByRef)
+                               field_loc = field_loc.GetDereferencedLocation 
();
+
+                       return type.GetObject (target, field_loc);
+               }
+
+               public void SetStaticField (Thread target, TargetFieldInfo 
field,
+                                           TargetObject obj)
+               {
+                       get_field_offsets (target);
+
+                       int offset = field_offsets [field.Position];
+                       TargetType type = field_types [field.Position];
+
+                       TargetAddress data_address = target.CallMethod (
+                               
SymbolFile.MonoLanguage.MonoDebuggerInfo.ClassGetStaticFieldData,
+                               KlassAddress, 0);
+
+                       TargetLocation location = new AbsoluteTargetLocation 
(data_address);
+                       TargetLocation field_loc = location.GetLocationAtOffset 
(offset);
+
+                       if (type.IsByRef)
+                               field_loc = field_loc.GetDereferencedLocation 
();
+
+                       type.SetObject (target, field_loc, obj);
+               }
+
                void get_methods (TargetMemoryAccess target)
                {
                        if (methods != null)

Modified: branches/martin/debugger-terrania/languages/mono/MonoClassObject.cs
===================================================================
--- branches/martin/debugger-terrania/languages/mono/MonoClassObject.cs 
2007-10-09 17:01:20 UTC (rev 87195)
+++ branches/martin/debugger-terrania/languages/mono/MonoClassObject.cs 
2007-10-09 17:03:51 UTC (rev 87196)
@@ -48,13 +48,13 @@
 
                public override TargetObject GetField (TargetMemoryAccess 
target, TargetFieldInfo field)
                {
-                       return ((MonoFieldInfo) field).GetField (target, 
Location);
+                       return ((MonoFieldInfo) field).DeclaringType.GetField 
(target, Location, field);
                }
 
                public override void SetField (TargetAccess target, 
TargetFieldInfo field,
                                               TargetObject obj)
                {
-                       type.SetField (target, Location, field, obj);
+                       ((MonoFieldInfo) field).DeclaringType.SetField (target, 
Location, field, obj);
                }
 
                internal TargetAddress GetKlassAddress (TargetMemoryAccess 
target)

Modified: branches/martin/debugger-terrania/languages/mono/MonoClassType.cs
===================================================================
--- branches/martin/debugger-terrania/languages/mono/MonoClassType.cs   
2007-10-09 17:01:20 UTC (rev 87195)
+++ branches/martin/debugger-terrania/languages/mono/MonoClassType.cs   
2007-10-09 17:03:51 UTC (rev 87196)
@@ -446,78 +446,31 @@
                        return null;
                }
 
-               int GetFieldOffset (TargetMemoryAccess target, TargetFieldInfo 
field)
+               internal TargetObject GetField (TargetMemoryAccess target, 
TargetLocation location,
+                                               TargetFieldInfo field)
                {
                        ResolveClass (target, true);
-
-                       return class_info.GetFieldOffsets (target) 
[field.Position];
+                       return class_info.GetField (target, location, field);
                }
 
-               internal TargetObject GetField (TargetMemoryAccess target, 
TargetLocation location,
-                                               TargetFieldInfo finfo)
-               {
-                       int offset = GetFieldOffset (target, finfo);
-                       Console.WriteLine ("GET FIELD: {0} {1} {2} {3}", this, 
finfo, finfo.Type, offset);
-                       if (!IsByRef)
-                               offset -= 2 * 
target.TargetInfo.TargetAddressSize;
-                       TargetLocation field_loc = location.GetLocationAtOffset 
(offset);
-
-                       if (finfo.Type.IsByRef)
-                               field_loc = field_loc.GetDereferencedLocation 
();
-
-                       if (field_loc.HasAddress && field_loc.GetAddress 
(target).IsNull)
-                               return null;
-
-                       return finfo.Type.GetObject (target, field_loc);
-               }
-
                internal void SetField (TargetAccess target, TargetLocation 
location,
-                                       TargetFieldInfo finfo, TargetObject obj)
+                                       TargetFieldInfo field, TargetObject obj)
                {
-                       int offset = GetFieldOffset (target, finfo);
-                       if (!IsByRef)
-                               offset -= 2 * 
target.TargetInfo.TargetAddressSize;
-                       TargetLocation field_loc = location.GetLocationAtOffset 
(offset);
-
-                       if (finfo.Type.IsByRef)
-                               field_loc = field_loc.GetDereferencedLocation 
();
-
-                       finfo.Type.SetObject (target, field_loc, obj);
+                       ResolveClass (target, true);
+                       class_info.SetField (target, location, field, obj);
                }
 
-               public override TargetObject GetStaticField (Thread target, 
TargetFieldInfo finfo)
+               public override TargetObject GetStaticField (Thread target, 
TargetFieldInfo field)
                {
-                       int offset = GetFieldOffset (target, finfo);
-
-                       TargetAddress data_address = target.CallMethod (
-                               
File.MonoLanguage.MonoDebuggerInfo.ClassGetStaticFieldData,
-                               class_info.KlassAddress, 0);
-
-                       TargetLocation location = new AbsoluteTargetLocation 
(data_address);
-                       TargetLocation field_loc = location.GetLocationAtOffset 
(offset);
-
-                       if (finfo.Type.IsByRef)
-                               field_loc = field_loc.GetDereferencedLocation 
();
-
-                       return finfo.Type.GetObject (target, field_loc);
+                       ResolveClass (target, true);
+                       return class_info.GetStaticField (target, field);
                }
 
-               public override void SetStaticField (Thread target, 
TargetFieldInfo finfo,
+               public override void SetStaticField (Thread target, 
TargetFieldInfo field,
                                                     TargetObject obj)
                {
-                       int offset = GetFieldOffset (target, finfo);
-
-                       TargetAddress data_address = target.CallMethod (
-                               
File.MonoLanguage.MonoDebuggerInfo.ClassGetStaticFieldData,
-                               class_info.KlassAddress, 0);
-
-                       TargetLocation location = new AbsoluteTargetLocation 
(data_address);
-                       TargetLocation field_loc = location.GetLocationAtOffset 
(offset);
-
-                       if (finfo.Type.IsByRef)
-                               field_loc = field_loc.GetDereferencedLocation 
();
-
-                       finfo.Type.SetObject (target, field_loc, obj);
+                       ResolveClass (target, true);
+                       class_info.SetStaticField (target, field, obj);
                }
 
                internal MonoClassObject GetCurrentObject (TargetMemoryAccess 
target, TargetLocation location)

Modified: 
branches/martin/debugger-terrania/languages/mono/MonoLanguageBackend.cs
===================================================================
--- branches/martin/debugger-terrania/languages/mono/MonoLanguageBackend.cs     
2007-10-09 17:01:20 UTC (rev 87195)
+++ branches/martin/debugger-terrania/languages/mono/MonoLanguageBackend.cs     
2007-10-09 17:03:51 UTC (rev 87196)
@@ -354,7 +354,7 @@
                                if (info == null)
                                        return null;
 
-                               type = info.SymbolFile.LookupMonoClass 
(info.CecilType);
+                               type = info.SymbolFile.LookupMonoType 
(info.CecilType);
                        } catch {
                                return null;
                        }

Modified: branches/martin/debugger-terrania/languages/mono/MonoMember.cs
===================================================================
--- branches/martin/debugger-terrania/languages/mono/MonoMember.cs      
2007-10-09 17:01:20 UTC (rev 87195)
+++ branches/martin/debugger-terrania/languages/mono/MonoMember.cs      
2007-10-09 17:03:51 UTC (rev 87196)
@@ -9,21 +9,16 @@
        {
                [NonSerialized]
                public readonly Cecil.FieldDefinition FieldInfo;
-               MonoClassType type;
+               public readonly MonoClassType DeclaringType;
 
                public MonoFieldInfo (MonoClassType type, TargetType 
field_type, int index, int pos,
                                      Cecil.FieldDefinition finfo)
                        : base (field_type, finfo.Name, index, finfo.IsStatic, 
pos, 0, finfo.HasConstant)
                {
                        FieldInfo = finfo;
-                       this.type = type;
+                       DeclaringType = type;
                }
 
-               internal TargetObject GetField (TargetMemoryAccess target, 
TargetLocation location)
-               {
-                       return type.GetField (target, location, this);
-               }
-
                public override object ConstValue {
                        get {
                                if (FieldInfo.HasConstant)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to