X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fdis%2Fdis-cil.c;h=cea4a6fbea920771aec0251893f92de5a37636af;hb=7e7c374cd91776d4212a6d48a03fd72adcdf2515;hp=950511107eb6a3592f8c7ad26813c8cbe53050c6;hpb=7e18ed47c9606f3981e7b18cbc238d6781843153;p=mono.git diff --git a/mono/dis/dis-cil.c b/mono/dis/dis-cil.c index 950511107eb..cea4a6fbea9 100644 --- a/mono/dis/dis-cil.c +++ b/mono/dis/dis-cil.c @@ -18,6 +18,7 @@ #include "dump.h" #include "dis-cil.h" #include "mono/metadata/opcodes.h" +#include "mono/metadata/class-internals.h" #include "mono/utils/mono-compiler.h" #ifndef HAVE_ISINF @@ -55,7 +56,7 @@ isinf (double num) indent[indent_level*2] = 0; void -dissasemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContext *context) +disassemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContainer *container) { const unsigned char *start = mh->code; int size = mh->code_size; @@ -63,7 +64,7 @@ dissasemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContext *context const unsigned char *ptr = start; const MonoOpcode *entry; char indent[1024]; - int i, indent_level = 0; + int i, j, indent_level = 0; gboolean in_fault = 0; const char *clause_names[] = {"catch", "filter", "finally", "", "fault"}; gboolean *trys = NULL; @@ -82,11 +83,16 @@ dissasemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContext *context trys = g_malloc0 (sizeof (gboolean) * mh->num_clauses); trys [0] = 1; for (i=1; i < mh->num_clauses; ++i) { -#define pcl mh->clauses [i-1] +#define jcl mh->clauses [j] #define cl mh->clauses [i] - if (pcl.try_offset != cl.try_offset || pcl.try_len != cl.try_len) - trys [i] = 1; -#undef pcl + trys [i] = 1; + for (j = 0; j < i; j++) { + if (cl.try_offset == jcl.try_offset && cl.try_len == jcl.try_len) { + trys [i] = 0; + break; + } + } +#undef jcl #undef cl } } @@ -105,7 +111,7 @@ dissasemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContext *context } else { char * klass = mh->clauses[i].flags ? g_strdup ("") : dis_stringify_object_with_class (m, mh->clauses[i].data.catch_class, - FALSE, FALSE); + TRUE, FALSE); fprintf (output, "\t%s%s %s { // %d\n", indent, clause_names [mh->clauses[i].flags], klass, i); g_free (klass); @@ -144,7 +150,7 @@ dissasemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContext *context guint32 token = read32 (ptr); char *s; - s = get_field (m, token, context); + s = get_field (m, token, container); fprintf (output, "%s", s); g_free (s); ptr += 4; @@ -171,7 +177,7 @@ dissasemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContext *context guint32 token = read32 (ptr); char *s; - s = get_method (m, token, context); + s = get_method (m, token, container); fprintf (output, "%s", s); g_free (s); ptr += 4; @@ -192,8 +198,11 @@ dissasemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContext *context fprintf (output, "(00 00 00 00 00 00 f0 7f)"); /* positive infinity */ else if (isnan (r)) fprintf (output, "(00 00 00 00 00 00 f8 ff)"); /* NaN */ - else - fprintf (output, "%.20g", r); + else { + char *str = stringify_double (r); + fprintf (output, str); + g_free (str); + } ptr += 8; break; } @@ -210,7 +219,7 @@ dissasemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContext *context const char *us_ptr = mono_metadata_user_string (m, token & 0xffffff); int len = mono_metadata_decode_blob_size (us_ptr, (const char**)&us_ptr); - char *s = get_encoded_user_string_or_bytearray (us_ptr, len); + char *s = get_encoded_user_string_or_bytearray ((const guchar*)us_ptr, len); /* * See section 23.1.4 on the encoding of the #US heap @@ -244,7 +253,7 @@ dissasemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContext *context guint32 token = read32 (ptr); char *s; - s = get_token (m, token, context); + s = get_token (m, token, container); fprintf (output, "%s", s); g_free (s); @@ -254,7 +263,7 @@ dissasemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContext *context case MonoInlineType: { guint32 token = read32 (ptr); - char *s = get_token_type (m, token, context); + char *s = get_token_type (m, token, container); fprintf (output, "%s", s); g_free (s); ptr += 4; @@ -298,8 +307,11 @@ dissasemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContext *context fprintf (output, "(00 00 80 7f)"); /* positive infinity */ else if (isnan (f)) fprintf (output, "(00 00 c0 ff)"); /* NaN */ - else - fprintf (output, "%.20g", (double) f); + else { + char *str = stringify_double ((double) f); + fprintf (output, str); + g_free (str); + } ptr += 4; break; }