[Mono-bugs] [Bug 379866] New: monodis has problematic behavior when disassembling the moonlight mscorlib

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Apr 14 19:07:43 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=379866


           Summary: monodis has problematic behavior when disassembling the
                    moonlight mscorlib
           Product: Mono: Tools
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: monodis
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jbevain at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Using monodis on the 2.1 mscorlib produces:

wberrier:/usr/src/packages/RPMS/x86_64/tmp# monodis --assembly
/usr/lib/mono/2.1/mscorlib.dll
 Assembly Table
 Name:          mscorlib
 Hash Algoritm: 0x00008004
 Version:       2.0.0.0
 Flags:         0x00000001
 PublicKey:     BlobPtr (0x00006334)
         Dump:
 0x00000000: 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 
 Culture:       

Note that the error is the version. It seems to me that monodis doesn't really
load the mscorlib that is passed as an argument, and simply returns the 2.0
mscorlib, that has been initialized because the 2.1 mscorlib has the same
metadata version that the 2.0 one. Using --mscorlib doesn't help.

I've used the following patch to allow explicit choice of the mscorlib using
--runtime, but it seems to me that monodis should simply take whatever it is
passed as an argument.

Index: main.c
===================================================================
--- main.c      (revision 100561)
+++ main.c      (working copy)
 -1832,7 +1832,7 @@
 static void
 usage (void)
 {
-       GString *args = g_string_new ("[--output=filename] [--filter=filename]
[--help] [--mscorlib]\n");
+       GString *args = g_string_new ("[--output=filename] [--filter=filename]
[--runtime=version] [--help] [--mscorlib]\n");
        int i;

        for (i = 0; table_list [i].name != NULL; i++){
 -1853,6 +1853,7 @@
 main (int argc, char *argv [])
 {
        GList *input_files = NULL, *l;
+       char *runtime_version = NULL;
        int i, j;

        output = stdout;
 -1887,6 +1888,9 @@
                        } else if (strcmp (argv [i], "--forward-decls") == 0) {
                                dump_forward_decls = TRUE;
                                continue;
+                       } else if (strncmp (argv [i], "--runtime=", 10) == 0) { 
+                               runtime_version = &argv [i][10];
+                               continue;
                        } else if (strcmp (argv [i], "--help") == 0)
                                usage ();
                        for (j = 0; table_list [j].name != NULL; j++) {
 -1905,19 +1909,27 @@
        mono_install_assembly_load_hook (monodis_assembly_load_hook, NULL);
        mono_install_assembly_search_hook (monodis_assembly_search_hook, NULL);

+       
+
        /*
         * If we just have one file, use the corlib version it requires.
+        * if not runtime_version has been explicitely specified
         */
+       if (runtime_version)
+               mono_init_version (argv [0], runtime_version);
+
        if (!input_files->next) {
                char *filename = input_files->data;

-               mono_init_from_assembly (argv [0], filename);
+               if (!runtime_version)
+                       mono_init_from_assembly (argv [0], filename);

                mono_install_assembly_preload_hook (monodis_preload,
GUINT_TO_POINTER (FALSE));

                disassemble_file (filename);
        } else {
-               mono_init (argv [0]);
+               if (!runtime_version)
+                       mono_init (argv [0]);

                for (l = input_files; l; l = l->next)
                        disassemble_file (l->data);


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list