* dump.c (dump_stream_blob): Format this nicely.
(dump_table_standalonesig): New public function.
* main.c (dis_locals): If --show-tokens was requested, print the
standalone signature token.
(table_list): Added "--standalonesig".
svn path=/trunk/mono/; revision=31726
+2004-08-02 Martin Baulig <martin@ximian.com>
+
+ * dump.c (dump_stream_blob): Format this nicely.
+ (dump_table_standalonesig): New public function.
+
+ * main.c (dis_locals): If --show-tokens was requested, print the
+ standalone signature token.
+ (table_list): Added "--standalonesig".
+
2004-07-09 Jackson Harper <jackson@ximian.com>
* get.c: Make "class" the default so only valuetypes get the
fprintf (output, "Blob heap contents\n");
for (i = 0; i < m->heap_blob.size; i++) {
- fprintf (output, "%x ", m->heap_blob.data [i]);
- if (i > 0 && (i % 25) == 0)
- fprintf (output, "\n");
+ if (i > 0) {
+ if ((i % 16) == 0)
+ fprintf (output, "\n");
+ else if ((i % 8) == 0)
+ fprintf (output, "- ");
+ }
+ fprintf (output, "%02x ", m->heap_blob.data [i] & 0xff);
}
fprintf (output, "\n");
}
+void
+dump_table_standalonesig (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_STANDALONESIG];
+ guint32 cols [MONO_STAND_ALONE_SIGNATURE_SIZE];
+ int i;
+
+ fprintf (output, "Stand alone signature (1..%d)\n", t->rows);
+
+ for (i = 1; i <= t->rows; i++) {
+ char *sig;
+ const char *locals_ptr;
+ int j, bsize;
+
+ mono_metadata_decode_row (t, i - 1, cols, MONO_STAND_ALONE_SIGNATURE_SIZE);
+
+ locals_ptr = mono_metadata_blob_heap (m, cols [MONO_STAND_ALONE_SIGNATURE]);
+ bsize = mono_metadata_decode_blob_size (locals_ptr, &locals_ptr);
+
+ fprintf (output, "%d: blob[0x%x] = ", i, cols [MONO_STAND_ALONE_SIGNATURE]);
+
+ for (j = 0; j < bsize; j++) {
+ fprintf (output, "%02x ", locals_ptr [j]);
+ }
+ fprintf (output, "\n");
+ }
+}
void dump_table_methodspec (MonoImage *m);
void dump_table_parconstraint(MonoImage *m);
void dump_table_implmap (MonoImage *m);
+void dump_table_standalonesig (MonoImage *m);
void dump_stream_blob (MonoImage *m);
}
static void
-dis_locals (MonoImage *m, MonoMethodHeader *mh)
+dis_locals (MonoImage *m, MonoMethodHeader *mh, const char *ptr)
{
int i;
- fprintf(output, "\t.locals %s(\n", mh->init_locals ? "init " : "");
+ if (show_tokens) {
+ unsigned char flags = *(const unsigned char *) ptr;
+ unsigned char format = flags & METHOD_HEADER_FORMAT_MASK;
+ guint16 fat_flags;
+ guint32 local_var_sig_tok, max_stack, code_size, init_locals;
+ int hsize;
+
+ g_assert (format == METHOD_HEADER_FAT_FORMAT);
+ fat_flags = read16 (ptr);
+ ptr += 2;
+ hsize = (fat_flags >> 12) & 0xf;
+ max_stack = read16 (ptr);
+ ptr += 2;
+ code_size = read32 (ptr);
+ ptr += 4;
+ local_var_sig_tok = read32 (ptr);
+ ptr += 4;
+
+ if (fat_flags & METHOD_HEADER_INIT_LOCALS)
+ init_locals = 1;
+ else
+ init_locals = 0;
+
+ fprintf(output, "\t.locals /*%08x*/ %s(\n",
+ local_var_sig_tok, init_locals ? "init " : "");
+ } else
+ fprintf(output, "\t.locals %s(\n", mh->init_locals ? "init " : "");
+
for (i=0; i < mh->num_locals; ++i) {
char * desc;
if (i)
fprintf (output, "\t// Code size %d (0x%x)\n", mh->code_size, mh->code_size);
fprintf (output, "\t.maxstack %d\n", mh->max_stack);
if (mh->num_locals)
- dis_locals (m, mh);
+ dis_locals (m, mh, ptr);
dissasemble_cil (m, mh);
/*
{ "--typeref", MONO_TABLE_TYPEREF, dump_table_typeref },
{ "--typespec", MONO_TABLE_TYPESPEC, dump_table_typespec },
{ "--implmap", MONO_TABLE_IMPLMAP, dump_table_implmap },
+ { "--standalonesig", MONO_TABLE_STANDALONESIG, dump_table_standalonesig },
{ "--blob", NULL, dump_stream_blob },
{ NULL, -1 }
};