Author: zoltan
Date: 2006-10-05 10:54:02 -0400 (Thu, 05 Oct 2006)
New Revision: 66292

Modified:
   trunk/mono/mono/dis/ChangeLog
   trunk/mono/mono/dis/dump.c
   trunk/mono/mono/dis/dump.h
   trunk/mono/mono/dis/main.c
Log:
2006-10-05  Zoltan Varga  <[EMAIL PROTECTED]>

        * dump.c main.c: Allow dumping the *Ptr tables.


Modified: trunk/mono/mono/dis/ChangeLog
===================================================================
--- trunk/mono/mono/dis/ChangeLog       2006-10-05 14:53:21 UTC (rev 66291)
+++ trunk/mono/mono/dis/ChangeLog       2006-10-05 14:54:02 UTC (rev 66292)
@@ -1,3 +1,7 @@
+2006-10-05  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * dump.c main.c: Allow dumping the *Ptr tables.
+
 2006-09-12  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * declsec.c: Fix windows VC build.

Modified: trunk/mono/mono/dis/dump.c
===================================================================
--- trunk/mono/mono/dis/dump.c  2006-10-05 14:53:21 UTC (rev 66291)
+++ trunk/mono/mono/dis/dump.c  2006-10-05 14:54:02 UTC (rev 66292)
@@ -592,7 +592,7 @@
                method_container = mono_metadata_load_generic_params (m, 
MONO_TOKEN_METHOD_DEF | i, type_container);
                if (method_container)
                        mono_metadata_load_generic_param_constraints (m, 
MONO_TOKEN_METHOD_DEF | i, method_container);
-               mono_metadata_decode_row (t, i - 1, cols, MONO_METHOD_SIZE);
+               mono_metadata_decode_table_row (m, MONO_TABLE_METHOD, i - 1, 
cols, MONO_METHOD_SIZE);
                sigblob = mono_metadata_blob_heap (m, cols 
[MONO_METHOD_SIGNATURE]);
                mono_metadata_decode_blob_size (sigblob, &sigblob);
                method = mono_metadata_parse_method_signature_full (m, 
method_container ? method_container : type_container, i, sigblob, &sigblob);
@@ -1234,3 +1234,43 @@
                fprintf (output, "\n");
        }
 }
+
+static void
+dump_table_ptr (MonoImage *m, int table, const char *name)
+{
+       MonoTableInfo *t = &m->tables [table];
+       guint32 cols [1];
+       int i;
+       
+       fprintf (output, "%s (1..%d)\n", name, t->rows);
+
+       for (i = 1; i <= t->rows; i++) {
+               mono_metadata_decode_row (t, i - 1, cols, 1);
+
+               fprintf (output, "%d: %d\n", i, cols [0]);
+       }
+}
+
+void
+dump_table_methodptr (MonoImage *m)
+{
+       dump_table_ptr (m, MONO_TABLE_METHOD_POINTER, "Method Ptr");
+}
+
+void
+dump_table_fieldptr (MonoImage *m)
+{
+       dump_table_ptr (m, MONO_TABLE_FIELD_POINTER, "Field Ptr");
+}
+
+void
+dump_table_paramptr (MonoImage *m)
+{
+       dump_table_ptr (m, MONO_TABLE_PARAM_POINTER, "Param Ptr");
+}
+
+void
+dump_table_eventptr (MonoImage *m)
+{
+       dump_table_ptr (m, MONO_TABLE_EVENT_POINTER, "Event Ptr");
+}

Modified: trunk/mono/mono/dis/dump.h
===================================================================
--- trunk/mono/mono/dis/dump.h  2006-10-05 14:53:21 UTC (rev 66291)
+++ trunk/mono/mono/dis/dump.h  2006-10-05 14:54:02 UTC (rev 66292)
@@ -31,4 +31,9 @@
 void dump_table_parconstraint(MonoImage *m);
 void dump_table_implmap      (MonoImage *m);
 void dump_table_standalonesig (MonoImage *m);
+void dump_table_methodptr    (MonoImage *m);
+void dump_table_fieldptr     (MonoImage *m);
+void dump_table_paramptr     (MonoImage *m);
+void dump_table_eventptr     (MonoImage *m);
 void dump_stream_blob        (MonoImage *m);
+

Modified: trunk/mono/mono/dis/main.c
===================================================================
--- trunk/mono/mono/dis/main.c  2006-10-05 14:53:21 UTC (rev 66291)
+++ trunk/mono/mono/dis/main.c  2006-10-05 14:54:02 UTC (rev 66292)
@@ -1445,6 +1445,10 @@
        { "--typespec",    MONO_TABLE_TYPESPEC,         dump_table_typespec },
        { "--implmap",     MONO_TABLE_IMPLMAP,          dump_table_implmap },
        { "--standalonesig", MONO_TABLE_STANDALONESIG,  
dump_table_standalonesig },
+       { "--methodptr", MONO_TABLE_METHOD_POINTER,  dump_table_methodptr },
+       { "--fieldptr", MONO_TABLE_FIELD_POINTER,  dump_table_fieldptr },
+       { "--paramptr", MONO_TABLE_PARAM_POINTER,  dump_table_paramptr },
+       { "--eventptr", MONO_TABLE_EVENT_POINTER,  dump_table_eventptr },
        { "--blob",        0,                   dump_stream_blob },
        { NULL, -1, }
 };

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

Reply via email to