Author: jbevain
Date: 2007-03-22 16:03:06 -0500 (Thu, 22 Mar 2007)
New Revision: 74845

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:
2007-03-22  Jb Evain  <[EMAIL PROTECTED]>

        * dump.c, dump.h, main.c: Implement dumping of Strings
        and UserStrings heap.


Modified: trunk/mono/mono/dis/ChangeLog
===================================================================
--- trunk/mono/mono/dis/ChangeLog       2007-03-22 20:59:28 UTC (rev 74844)
+++ trunk/mono/mono/dis/ChangeLog       2007-03-22 21:03:06 UTC (rev 74845)
@@ -1,3 +1,8 @@
+2007-03-22  Jb Evain  <[EMAIL PROTECTED]>
+
+       * dump.c, dump.h, main.c: Implement dumping of Strings
+       and UserStrings heap.
+
 2007-03-13  Jonathan Chambers  <[EMAIL PROTECTED]>
 
        * monodis.vcproj: Move to msvc directory.

Modified: trunk/mono/mono/dis/dump.c
===================================================================
--- trunk/mono/mono/dis/dump.c  2007-03-22 20:59:28 UTC (rev 74844)
+++ trunk/mono/mono/dis/dump.c  2007-03-22 21:03:06 UTC (rev 74845)
@@ -1210,6 +1210,38 @@
 }
 
 void
+dump_stream_strings (MonoImage *m)
+{
+       guint32 i;
+
+       fprintf (output, "Strings heap contents\n");
+
+       for (i = 0; i < m->heap_strings.size; ) {
+               const char *str = mono_metadata_string_heap (m, i);
+               fprintf (output, "%02x: \"%s\"\n", i, str);
+               i += strlen (str) + 1;
+       }
+}
+
+void
+dump_stream_us (MonoImage *m)
+{
+       guint32 i;
+
+       fprintf (output, "User Strings heap contents\n");
+
+       for (i = 0; i < m->heap_us.size; ) {
+               const char *us_ptr = mono_metadata_user_string (m, i);
+               int len = mono_metadata_decode_blob_size (us_ptr, (const 
char**)&us_ptr);
+
+               char *str = get_encoded_user_string_or_bytearray ((const 
guchar*)us_ptr, len);
+               fprintf (output, "%02x: %s\n", i, str);
+               g_free (str);
+               i += len + 1;
+       }
+}
+
+void
 dump_table_standalonesig (MonoImage *m)
 {
        MonoTableInfo *t = &m->tables [MONO_TABLE_STANDALONESIG];

Modified: trunk/mono/mono/dis/dump.h
===================================================================
--- trunk/mono/mono/dis/dump.h  2007-03-22 20:59:28 UTC (rev 74844)
+++ trunk/mono/mono/dis/dump.h  2007-03-22 21:03:06 UTC (rev 74845)
@@ -37,4 +37,5 @@
 void dump_table_eventptr     (MonoImage *m);
 void dump_table_propertyptr  (MonoImage *m);
 void dump_stream_blob        (MonoImage *m);
-
+void dump_stream_strings     (MonoImage *m);
+void dump_stream_us          (MonoImage *m);

Modified: trunk/mono/mono/dis/main.c
===================================================================
--- trunk/mono/mono/dis/main.c  2007-03-22 20:59:28 UTC (rev 74844)
+++ trunk/mono/mono/dis/main.c  2007-03-22 21:03:06 UTC (rev 74845)
@@ -1468,7 +1468,9 @@
        { "--paramptr", MONO_TABLE_PARAM_POINTER,  dump_table_paramptr },
        { "--eventptr", MONO_TABLE_EVENT_POINTER,  dump_table_eventptr },
        { "--propertyptr", MONO_TABLE_PROPERTY_POINTER,  dump_table_propertyptr 
},
-       { "--blob",        0,                   dump_stream_blob },
+       { "--blob", 0, dump_stream_blob },
+       { "--strings", 0, dump_stream_strings },
+       { "--userstrings", 0, dump_stream_us },
        { NULL, -1, }
 };
 

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

Reply via email to