Author: martin
Date: 2007-09-25 10:30:57 -0400 (Tue, 25 Sep 2007)
New Revision: 86325

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/languages/mono/MonoClassType.cs
   trunk/debugger/languages/mono/MonoLanguageBackend.cs
   trunk/debugger/languages/mono/MonoSymbolFile.cs
Log:
2007-09-25  Martin Baulig  <[EMAIL PROTECTED]>

        * languages/mono/MonoSymbolFile.cs
        (MonoTypeTable.ReadDataItem): Create a `token' -> `klass_address'
        hash table; don't actually read the class.
        (MonoSymbolFile.LookupClassInfo): New internal method; we now
        create the `MonoClassInfo' on-the-fly when it's needed.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2007-09-25 14:16:29 UTC (rev 86324)
+++ trunk/debugger/ChangeLog    2007-09-25 14:30:57 UTC (rev 86325)
@@ -1,5 +1,13 @@
 2007-09-25  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * languages/mono/MonoSymbolFile.cs
+       (MonoTypeTable.ReadDataItem): Create a `token' -> `klass_address'
+       hash table; don't actually read the class.
+       (MonoSymbolFile.LookupClassInfo): New internal method; we now
+       create the `MonoClassInfo' on-the-fly when it's needed.
+
+2007-09-25  Martin Baulig  <[EMAIL PROTECTED]>
+
        * languages/mono/MonoClassType.cs
        (MonoClassType.ResolveClass): Added `TargetMemoryAccess target'
        and `bool fail' arguments.

Modified: trunk/debugger/languages/mono/MonoClassType.cs
===================================================================
--- trunk/debugger/languages/mono/MonoClassType.cs      2007-09-25 14:16:29 UTC 
(rev 86324)
+++ trunk/debugger/languages/mono/MonoClassType.cs      2007-09-25 14:30:57 UTC 
(rev 86325)
@@ -392,7 +392,7 @@
                                        return null;
                        }
 
-                       type_info = file.MonoLanguage.LookupClassInfo (type);
+                       type_info = file.LookupClassInfo (target, (int) 
type.MetadataToken.ToUInt ());
                        if (type_info != null)
                                return type_info;
 

Modified: trunk/debugger/languages/mono/MonoLanguageBackend.cs
===================================================================
--- trunk/debugger/languages/mono/MonoLanguageBackend.cs        2007-09-25 
14:16:29 UTC (rev 86324)
+++ trunk/debugger/languages/mono/MonoLanguageBackend.cs        2007-09-25 
14:30:57 UTC (rev 86325)
@@ -718,11 +718,6 @@
 
                        return info;
                }
-
-               internal MonoClassInfo LookupClassInfo (Cecil.TypeDefinition 
type)
-               {
-                       return (MonoClassInfo) class_info_by_type [type];
-               }
 #endregion
 
 #region Class Init Handlers

Modified: trunk/debugger/languages/mono/MonoSymbolFile.cs
===================================================================
--- trunk/debugger/languages/mono/MonoSymbolFile.cs     2007-09-25 14:16:29 UTC 
(rev 86324)
+++ trunk/debugger/languages/mono/MonoSymbolFile.cs     2007-09-25 14:30:57 UTC 
(rev 86325)
@@ -222,6 +222,7 @@
                Hashtable range_hash;
                ArrayList ranges;
                Hashtable type_hash;
+               Hashtable class_entry_by_token;
                ArrayList sources;
                Hashtable source_hash;
                Hashtable source_file_hash;
@@ -244,6 +245,7 @@
                        ranges = ArrayList.Synchronized (new ArrayList ());
                        range_hash = Hashtable.Synchronized (new Hashtable ());
                        type_hash = Hashtable.Synchronized (new Hashtable ());
+                       class_entry_by_token = Hashtable.Synchronized (new 
Hashtable ());
                        function_hash = Hashtable.Synchronized (new Hashtable 
());
 
                        Index = memory.ReadInteger (address);
@@ -785,11 +787,11 @@
 
                                reader.BinaryReader.ReadInt32 ();
 
-                               reader.BinaryReader.ReadLeb128 ();
-                               reader.BinaryReader.ReadLeb128 ();
+                               int token = reader.BinaryReader.ReadLeb128 ();
+                               int instance_size = 
reader.BinaryReader.ReadLeb128 ();
                                TargetAddress klass_address = 
reader.ReadAddress ();
 
-                               SymbolFile.MonoLanguage.ReadClassInfo (memory, 
klass_address);
+                               SymbolFile.AddClassEntry (token, klass_address);
                        }
 
                        protected override string MyToString ()
@@ -798,6 +800,41 @@
                        }
                }
 
+               protected void AddClassEntry (int token, TargetAddress klass)
+               {
+                       class_entry_by_token.Add (token, new ClassEntry 
(klass));
+               }
+
+               internal MonoClassInfo LookupClassInfo (TargetMemoryAccess 
target, int token)
+               {
+                       ClassEntry entry = (ClassEntry) class_entry_by_token 
[token];
+                       if (entry == null)
+                               return null;
+
+                       return entry.ReadClassInfo (MonoLanguage, target);
+               }
+
+               protected class ClassEntry
+               {
+                       public readonly TargetAddress KlassAddress;
+
+                       MonoClassInfo info;
+
+                       public ClassEntry (TargetAddress klass)
+                       {
+                               this.KlassAddress = klass;
+                       }
+
+                       internal MonoClassInfo ReadClassInfo 
(MonoLanguageBackend mono,
+                                                             
TargetMemoryAccess target)
+                       {
+                               if (info == null)
+                                       info = mono.ReadClassInfo (target, 
KlassAddress);
+
+                               return info;
+                       }
+               }
+
                protected class MonoMethodSource : MethodSource
                {
                        protected readonly MonoSymbolFile file;

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

Reply via email to