[Mono-list] patch for monodis
Nick Drochak
ndrochak@gol.com
08 Mar 2002 00:12:09 +0900
Here's a patch for monodis. It adds a new option, --mscorlib that makes
monodis behave as it used to. That is, putting "mscorlib" in for the
assembly name of any assembly not named "corlib".
Without the new switch, monodis just puts the assembly name, whatever it
happens to be.
If these changes are ok, I can commit.
Nick D.
Index: get.c
===================================================================
RCS file: /cvs/public/mono/mono/dis/get.c,v
retrieving revision 1.33
diff -u -r1.33 get.c
--- get.c 2002/02/18 11:02:20 1.33
+++ get.c 2002/03/07 11:16:34
@@ -17,6 +17,8 @@
#include "get.h"
#include <mono/metadata/class.h>
+extern gboolean substitute_with_mscorlib_p;
+
char *
get_typedef (MonoImage *m, int idx)
{
@@ -507,7 +509,7 @@
return g_strdup ("Unknown");
if (m != c->image) {
/* we cheat */
- if (!strcmp ("corlib", c->image->assembly_name))
+ if (substitute_with_mscorlib_p && !strcmp ("corlib",
c->image->assembly_name))
assemblyref = g_strdup_printf ("[%s]", "mscorlib");
else
assemblyref = g_strdup_printf ("[%s]", c->image->assembly_name);
Index: main.c
===================================================================
RCS file: /cvs/public/mono/mono/dis/main.c,v
retrieving revision 1.54
diff -u -r1.54 main.c
--- main.c 2002/03/05 13:27:52 1.54
+++ main.c 2002/03/07 11:16:35
@@ -30,6 +30,8 @@
/* True if you want to get a dump of the header data */
gboolean dump_header_data_p = FALSE;
+gboolean substitute_with_mscorlib_p = FALSE;
+
int dump_table = -1;
static void
@@ -854,7 +856,7 @@
static void
usage (void)
{
- GString *args = g_string_new ("[--help] ");
+ GString *args = g_string_new ("[--help] [--mscorlib] ");
int i;
for (i = 0; table_list [i].name != NULL; i++){
@@ -882,6 +884,10 @@
usage ();
else if (argv [i][1] == 'd')
dump_header_data_p = TRUE;
+ else if (strcmp (argv [i], "--mscorlib") == 0) {
+ substitute_with_mscorlib_p = TRUE;
+ i++;
+ }
else if (strcmp (argv [i], "--help") == 0)
usage ();
for (j = 0; table_list [j].name != NULL; j++) {