[Mono-bugs] [Bug 38532][Wis] Changed - Supporting the #- heap.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 14 May 2004 19:32:36 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by miguel@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=38532

--- shadow/38532	2003-02-22 14:34:35.000000000 -0500
+++ shadow/38532.tmp.12092	2004-05-14 19:32:36.000000000 -0400
@@ -1,14 +1,14 @@
 Bug#: 38532
-Product: Mono/Runtime
+Product: Mono: Runtime
 Version: unspecified
-OS: 
+OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Wishlist
 Component: misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: miguel@ximian.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -66,6 +66,90 @@
 
 Of course, the MS people listening should feel free to correct any
 mistakes in the description or better yet provide us the documentation
 for the format:-)
 
 lupus
+
+------- Additional Comments From miguel@ximian.com  2003-08-11 17:04 -------
+Btw, officially Microsoft will be changing that format in future
+version s of the CLR.
+
+My feeling is that it is not worth supporting.
+
+------- Additional Comments From miguel@ximian.com  2004-05-14 19:32 -------
+ModuleReader.cs has some information on parsing the #- heap.
+
+It contains four new tables (MethodPtr, FieldPtr, EventPtr, ParamPtr).
+
+Basically tokens go through an extra layer of love:
+
+                        private int DecodeToken(int token)
+                        {
+                                if (this.debugTokenEncoding)
+                                {
+                                        if (token == -1)
+                                                return -1;
+
+                                        int tableType = token >> 24;
+                                        int index = (token & 0xffffff)
+- 1;
+
+                                        if (index == -1)
+                                                return -1;
+
+                                        switch (tableType)
+                                        {
+                                                case TableType.Method:
+                                                        if
+(this.tables.MethodPointer.Length == 0)
+                                                                return
+token;
+                                                        return
+this.tables.MethodPointer[index].Method;
+
+                                                case TableType.Field:
+                                                        if
+(this.tables.FieldPointer.Length == 0)
+                                                                return
+token;
+                                                        return
+this.tables.FieldPointer[index].Field;
+                                        }
+                                }
+
+                                return token;
+                        }
+private int DecodeToken(int token)
+{
+        if (this.debugTokenEncoding)
+        {
+                if (token == -1)
+                        return -1;
+
+                int tableType = token >> 24;
+                int index = (token & 0xffffff) - 1;
+
+                if (index == -1)
+                        return -1;
+
+                switch (tableType)
+                {
+                        case TableType.Method:
+                                if (this.tables.MethodPointer.Length == 0)
+                                        return token;
+                                return
+this.tables.MethodPointer[index].Method;
+
+                        case TableType.Field:
+                                if (this.tables.FieldPointer.Length == 0)
+                                        return token;
+                                return
+this.tables.FieldPointer[index].Field;
+                }
+        }
+
+        return token;
+}
+
+Those tables contain pointers into the other tables, so they
+are either 2 or 4 bytes per row.