#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
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;
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;
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
}
}
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;
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;
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;
}
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
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);
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;
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;
}