const char *ptr;
int len;
- mono_metadata_decode_row (t, 0, cols, MONO_ASSEMBLY_SIZE);
fprintf (output, "Assembly Table\n");
+ if (!t->rows)
+ return;
+
+ mono_metadata_decode_row (t, 0, cols, MONO_ASSEMBLY_SIZE);
+
fprintf (output, "Name: %s\n", mono_metadata_string_heap (m, cols [MONO_ASSEMBLY_NAME]));
fprintf (output, "Hash Algoritm: 0x%08x\n", cols [MONO_ASSEMBLY_HASH_ALG]);
fprintf (output, "Version: %d.%d.%d.%d\n", cols [MONO_ASSEMBLY_MAJOR_VERSION],
fprintf (output, "\n");
}
+void
+dump_table_typespec (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_TYPESPEC];
+ int i;
+
+ fprintf (output, "Typespec Table\n");
+
+ for (i = 1; i <= t->rows; i++){
+ char *typespec = get_typespec (m, i);
+
+ fprintf (output, "%d: %s\n", i, typespec);
+ g_free (typespec);
+ }
+ fprintf (output, "\n");
+}
+
void
dump_table_assemblyref (MonoImage *m)
{
for (i = 0; i < t->rows; i++){
guint32 cols [MONO_PARAM_SIZE];
- mono_metadata_decode_row (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, MONO_PARAM_SIZE);
fprintf (output, "%d: 0x%04x %d %s\n",
i + 1,
cols [MONO_PARAM_FLAGS], cols [MONO_PARAM_SEQUENCE],
switch (kind){
case 0:
- ks = "TypeDef"; break;
+ ks = "TypeDef";
+ xx = get_typedef (m, idx);
+ x = g_strconcat (xx, ".", mono_metadata_string_heap (m, cols [MONO_MEMBERREF_NAME]), NULL);
+ g_free (xx);
+ break;
case 1:
ks = "TypeRef";
xx = get_typeref (m, idx);
case 2:
ks = "ModuleRef"; break;
case 3:
- ks = "MethodDef"; break;
+ ks = "MethodDef";
+ x = get_methoddef (m, idx);
+ break;
case 4:
ks = "TypeSpec";
xx = get_typespec (m, idx);
for (i = 0; i < t->rows; i++){
guint32 cols [MONO_CLASS_LAYOUT_SIZE];
- mono_metadata_decode_row (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, MONO_CLASS_LAYOUT_SIZE);
fprintf (output, "%d: PackingSize=%d ClassSize=%d Parent=%s\n",
i + 1, cols [MONO_CLASS_LAYOUT_PACKING_SIZE],
for (i = 0; i < t->rows; i++){
guint32 cols [MONO_CONSTANT_SIZE];
- const char *parent = desc [cols [MONO_CONSTANT_PARENT] & HASCONSTANT_MASK];
+ const char *parent = desc [cols [MONO_CONSTANT_PARENT] & MONO_HASCONSTANT_MASK];
mono_metadata_decode_row (t, i, cols, MONO_CONSTANT_SIZE);
fprintf (output, "%d: Parent= %s: %d %s\n",
- i + 1, parent, cols [MONO_CONSTANT_PARENT] >> HASCONSTANT_BITS,
+ i + 1, parent, cols [MONO_CONSTANT_PARENT] >> MONO_HASCONSTANT_BITS,
get_constant (m, (MonoTypeEnum) cols [MONO_CONSTANT_TYPE], cols [MONO_CONSTANT_VALUE]));
}
mono_metadata_decode_row (t, i, cols, MONO_PROPERTY_MAP_SIZE);
s = get_typedef (m, cols [MONO_PROPERTY_MAP_PARENT]);
- fprintf (output, "%d: %s %d\n", i + 1, s, cols [MONO_PROPERTY_MAP_PROPERTY_LIST]);
+ fprintf (output, "%d: %s (%d) %d\n", i + 1, s, cols [MONO_PROPERTY_MAP_PARENT], cols [MONO_PROPERTY_MAP_PROPERTY_LIST]);
g_free (s);
}
}
dump_table_file (MonoImage *m)
{
MonoTableInfo *t = &m->tables [MONO_TABLE_FILE];
- int i;
+ int i, j, len;
fprintf (output, "File Table (1..%d)\n", t->rows);
for (i = 0; i < t->rows; i++){
guint32 cols [MONO_FILE_SIZE];
- const char *name;
+ const char *name, *hash;
mono_metadata_decode_row (t, i, cols, MONO_FILE_SIZE);
name = mono_metadata_string_heap (m, cols [MONO_FILE_NAME]);
- fprintf (output, "%d: %s %s\n", i + 1, name,
+ fprintf (output, "%d: %s %s [", i + 1, name,
cols [MONO_FILE_FLAGS] & 0x1 ? "nometadata" : "containsmetadata");
+ hash = mono_metadata_blob_heap (m, cols [MONO_FILE_HASH_VALUE]);
+ len = mono_metadata_decode_blob_size (hash, &hash);
+ for (j = 0; j < len; ++j)
+ fprintf (output, "%s%02X", j? " ": "", hash [j] & 0xff);
+ fprintf (output, "]\n");
+ }
+
+}
+
+static char*
+get_manifest_implementation (MonoImage *m, guint32 idx)
+{
+ guint32 row;
+ const char* table = "";
+ if (!idx)
+ return g_strdup ("current module");
+ row = idx >> MONO_IMPLEMENTATION_BITS;
+ switch (idx & MONO_IMPLEMENTATION_MASK) {
+ case MONO_IMPLEMENTATION_FILE:
+ table = "file";
+ break;
+ case MONO_IMPLEMENTATION_ASSEMBLYREF:
+ table = "assemblyref";
+ break;
+ case MONO_IMPLEMENTATION_EXP_TYPE:
+ table = "exportedtype";
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ return g_strdup_printf ("%s %d", table, row);
+}
+
+static const char*
+get_manifest_flags (guint32 mf)
+{
+ mf &= 3;
+ switch (mf) {
+ case 1: return "public";
+ case 2: return "private";
+ default:
+ return "";
+ }
+}
+
+void
+dump_table_manifest (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_MANIFESTRESOURCE];
+ int i;
+ fprintf (output, "Manifestresource Table (1..%d)\n", t->rows);
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_MANIFEST_SIZE];
+ const char *name, *mf;
+ char *impl;
+
+ mono_metadata_decode_row (t, i, cols, MONO_MANIFEST_SIZE);
+
+ name = mono_metadata_string_heap (m, cols [MONO_MANIFEST_NAME]);
+ mf = get_manifest_flags (cols [MONO_MANIFEST_FLAGS]);
+ impl = get_manifest_implementation (m, cols [MONO_MANIFEST_IMPLEMENTATION]);
+ fprintf (output, "%d: %s '%s' at offset %u in %s\n", i + 1, mf, name, cols [MONO_MANIFEST_OFFSET], impl);
+ g_free (impl);
}
}
}
+void
+dump_table_module (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_MODULE];
+ int i;
+ fprintf (output, "ModuleRef Table (1..%d)\n", t->rows);
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_MODULE_SIZE];
+ const char *name;
+ char *guid;
+
+ mono_metadata_decode_row (t, i, cols, MONO_MODULE_SIZE);
+
+ name = mono_metadata_string_heap (m, cols [MONO_MODULE_NAME]);
+ guid = get_guid (m, cols [MONO_MODULE_MVID]);
+ fprintf (output, "%d: %s %d %s\n", i + 1, name, cols [MONO_MODULE_MVID], guid);
+ }
+}
+
void
dump_table_method (MonoImage *m)
{
mono_metadata_decode_row (t, i - 1, cols, MONO_METHOD_SIZE);
sigblob = mono_metadata_blob_heap (m, cols [MONO_METHOD_SIGNATURE]);
mono_metadata_decode_blob_size (sigblob, &sigblob);
- method = mono_metadata_parse_method_signature (m, 1, sigblob, &sigblob);
- sig = dis_stringify_method_signature (m, method, i);
+ method = mono_metadata_parse_method_signature (m, i, sigblob, &sigblob);
+ sig = dis_stringify_method_signature (m, method, i, FALSE);
fprintf (output, "%d: %s (param: %d)\n", i, sig, cols [MONO_METHOD_PARAMLIST]);
g_free (sig);
mono_metadata_free_method_signature (method);
}
-static map_t semantics_map [] = {
+void
+dump_table_implmap (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_IMPLMAP];
+ MonoTableInfo *td = &m->tables [MONO_TABLE_MODULEREF];
+ int i;
+
+ fprintf (output, "ImplMap Table (1..%d)\n", t->rows);
+
+ for (i = 1; i <= t->rows; i++){
+ guint32 cols [MONO_IMPLMAP_SIZE];
+ char *method;
+
+ mono_metadata_decode_row (t, i - 1, cols, MONO_IMPLMAP_SIZE);
+
+ method = get_method (m, MONO_TOKEN_METHOD_DEF | (cols [MONO_IMPLMAP_MEMBER] >> MONO_MEMBERFORWD_BITS));
+
+ fprintf (output, "%d: %s %d (%s %s)\n", i,
+ method,
+ cols [MONO_IMPLMAP_FLAGS],
+ mono_metadata_string_heap (m, cols [MONO_IMPLMAP_NAME]),
+ mono_metadata_string_heap (m, mono_metadata_decode_row_col (td, cols [MONO_IMPLMAP_SCOPE] - 1, MONO_MODULEREF_NAME)));
+ }
+}
+
+void
+dump_table_methodimpl (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_METHODIMPL];
+ /*MonoTableInfo *td = &m->tables [MONO_TABLE_TYPEDEF];*/
+ int i;
+
+ fprintf (output, "MethodImpl Table (1..%d)\n", t->rows);
+
+ for (i = 1; i <= t->rows; i++){
+ guint32 cols [MONO_METHODIMPL_SIZE];
+ char *class, *impl, *decl;
+
+ mono_metadata_decode_row (t, i - 1, cols, MONO_METHODIMPL_SIZE);
+ class = get_typedef (m, cols [MONO_METHODIMPL_CLASS]);
+ impl = get_method (m, method_dor_to_token (cols [MONO_METHODIMPL_BODY]));
+ decl = get_method (m, method_dor_to_token (cols [MONO_METHODIMPL_DECLARATION]));
+ fprintf (output, "%d: %s\n\tdecl: %s\n\timpl: %s\n", i, class, decl, impl);
+ g_free (class);
+ g_free (impl);
+ g_free (decl);
+ }
+
+}
+
+static dis_map_t semantics_map [] = {
{1, "setter"},
{2, "getter"},
{4, "other"},
mono_metadata_decode_row (t, i - 1, cols, MONO_METHOD_SEMA_SIZE);
semantics = flags (cols [MONO_METHOD_SEMA_SEMANTICS], semantics_map);
- is_property = cols [MONO_METHOD_SEMA_ASSOCIATION] & HAS_SEMANTICS_MASK;
- index = cols [MONO_METHOD_SEMA_ASSOCIATION] >> HAS_SEMANTICS_BITS;
+ is_property = cols [MONO_METHOD_SEMA_ASSOCIATION] & MONO_HAS_SEMANTICS_MASK;
+ index = cols [MONO_METHOD_SEMA_ASSOCIATION] >> MONO_HAS_SEMANTICS_BITS;
fprintf (output, "%d: [%d] %s method: %d %s %d\n", i, cols [MONO_METHOD_SEMA_ASSOCIATION], semantics,
cols [MONO_METHOD_SEMA_METHOD] - 1,
is_property? "property" : "event",
static char*
has_cattr_get_table (MonoImage *m, guint32 val)
{
- guint32 t = val & CUSTOM_ATTR_MASK;
- guint32 index = val >> CUSTOM_ATTR_BITS;
+ guint32 t = val & MONO_CUSTOM_ATTR_MASK;
+ guint32 index = val >> MONO_CUSTOM_ATTR_BITS;
const char *table;
switch (t) {
- case CUSTOM_ATTR_METHODDEF:
+ case MONO_CUSTOM_ATTR_METHODDEF:
table = "MethodDef";
break;
- case CUSTOM_ATTR_FIELDDEF:
+ case MONO_CUSTOM_ATTR_FIELDDEF:
table = "FieldDef";
break;
- case CUSTOM_ATTR_TYPEREF:
+ case MONO_CUSTOM_ATTR_TYPEREF:
table = "TypeRef";
break;
- case CUSTOM_ATTR_TYPEDEF:
+ case MONO_CUSTOM_ATTR_TYPEDEF:
table = "TypeDef";
break;
- case CUSTOM_ATTR_PARAMDEF:
+ case MONO_CUSTOM_ATTR_PARAMDEF:
table = "Param";
break;
- case CUSTOM_ATTR_INTERFACE:
+ case MONO_CUSTOM_ATTR_INTERFACE:
table = "InterfaceImpl";
break;
- case CUSTOM_ATTR_MEMBERREF:
+ case MONO_CUSTOM_ATTR_MEMBERREF:
table = "MemberRef";
break;
- case CUSTOM_ATTR_MODULE:
+ case MONO_CUSTOM_ATTR_MODULE:
table = "Module";
break;
- case CUSTOM_ATTR_PERMISSION:
+ case MONO_CUSTOM_ATTR_PERMISSION:
table = "DeclSecurity?";
break;
- case CUSTOM_ATTR_PROPERTY:
+ case MONO_CUSTOM_ATTR_PROPERTY:
table = "Property";
break;
- case CUSTOM_ATTR_EVENT:
+ case MONO_CUSTOM_ATTR_EVENT:
table = "Event";
break;
- case CUSTOM_ATTR_SIGNATURE:
+ case MONO_CUSTOM_ATTR_SIGNATURE:
table = "StandAloneSignature";
break;
- case CUSTOM_ATTR_MODULEREF:
+ case MONO_CUSTOM_ATTR_MODULEREF:
table = "ModuleRef";
break;
- case CUSTOM_ATTR_TYPESPEC:
+ case MONO_CUSTOM_ATTR_TYPESPEC:
table = "TypeSpec";
break;
- case CUSTOM_ATTR_ASSEMBLY:
+ case MONO_CUSTOM_ATTR_ASSEMBLY:
table = "Assembly";
break;
- case CUSTOM_ATTR_ASSEMBLYREF:
+ case MONO_CUSTOM_ATTR_ASSEMBLYREF:
table = "AssemblyRef";
break;
- case CUSTOM_ATTR_FILE:
+ case MONO_CUSTOM_ATTR_FILE:
table = "File";
break;
- case CUSTOM_ATTR_EXP_TYPE:
+ case MONO_CUSTOM_ATTR_EXP_TYPE:
table = "ExportedType";
break;
- case CUSTOM_ATTR_MANIFEST:
+ case MONO_CUSTOM_ATTR_MANIFEST:
table = "Manifest";
break;
default:
break;
}
case MONO_TYPE_VALUETYPE:
- if (sig->params [i]->data.klass->enumtype) {
- type = sig->params [i]->data.klass->enum_basetype->type;
+ if (mono_class_is_enum (sig->params [i]->data.klass)) {
+ type = mono_class_enum_basetype (sig->params [i]->data.klass)->type;
goto handle_enum;
} else {
g_warning ("generic valutype not handled in custom attr value decoding");
break;
case MONO_TYPE_CLASS: /* It must be a Type: check? */
case MONO_TYPE_STRING:
+ if (*p == (char)0xff) {
+ g_string_append (res, "null");
+ p++;
+ break;
+ }
slen = mono_metadata_decode_value (p, &p);
g_string_append_c (res, '"');
g_string_append (res, p);
break;
}
}
- /*
- * FIXME: handle named args only when all the type are handled in fixed args.
- * slen = read16 (p);
- */
+ slen = read16 (p);
+ if (slen) {
+ g_string_sprintfa (res, " %d named args: (", slen);
+ slen = len - (p - value) + 1;
+ for (i = 0; i < slen; ++i) {
+ g_string_sprintfa (res, " %02X", (p [i] & 0xff));
+ }
+ g_string_append_c (res, ')');
+ }
s = res->str;
g_string_free (res, FALSE);
return s;
mono_metadata_decode_row (t, i - 1, cols, MONO_CUSTOM_ATTR_SIZE);
desc = has_cattr_get_table (m, cols [MONO_CUSTOM_ATTR_PARENT]);
- mtoken = cols [MONO_CUSTOM_ATTR_TYPE] >> CUSTOM_ATTR_TYPE_BITS;
- switch (cols [MONO_CUSTOM_ATTR_TYPE] & CUSTOM_ATTR_TYPE_MASK) {
- case CUSTOM_ATTR_TYPE_METHODDEF:
+ mtoken = cols [MONO_CUSTOM_ATTR_TYPE] >> MONO_CUSTOM_ATTR_TYPE_BITS;
+ switch (cols [MONO_CUSTOM_ATTR_TYPE] & MONO_CUSTOM_ATTR_TYPE_MASK) {
+ case MONO_CUSTOM_ATTR_TYPE_METHODDEF:
mtoken |= MONO_TOKEN_METHOD_DEF;
break;
- case CUSTOM_ATTR_TYPE_MEMBERREF:
+ case MONO_CUSTOM_ATTR_TYPE_MEMBERREF:
mtoken |= MONO_TOKEN_MEMBER_REF;
break;
default:
}
method = get_method (m, mtoken);
meth = mono_get_method (m, mtoken, NULL);
- params = custom_attr_params (m, meth->signature, mono_metadata_blob_heap (m, cols [MONO_CUSTOM_ATTR_VALUE]));
+ params = custom_attr_params (m, mono_method_signature (meth), mono_metadata_blob_heap (m, cols [MONO_CUSTOM_ATTR_VALUE]));
fprintf (output, "%d: %s: %s [%s]\n", i, desc, method, params);
g_free (desc);
g_free (method);
}
+void
+dump_table_exported (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_EXPORTEDTYPE];
+ guint32 cols [MONO_EXP_TYPE_SIZE];
+ int i;
+ const char *name, *nspace;
+ char *impl;
+ guint32 index;
+ fprintf (output, "ExportedType Table (1..%d)\n", t->rows);
+
+ for (i = 1; i <= t->rows; i++) {
+ mono_metadata_decode_row (t, i - 1, cols, MONO_EXP_TYPE_SIZE);
+ name = mono_metadata_string_heap (m, cols [MONO_EXP_TYPE_NAME]);
+ nspace = mono_metadata_string_heap (m, cols [MONO_EXP_TYPE_NAMESPACE]);
+ impl = get_manifest_implementation (m, cols [MONO_EXP_TYPE_IMPLEMENTATION]);
+ index = cols [MONO_EXP_TYPE_TYPEDEF];
+ fprintf (output, "%d: %s%s%s is in %s, token %x\n", i, nspace, *nspace ? "." : "", name, impl, index);
+ g_free (impl);
+ }
+
+}
+
+void
+dump_table_field_marshal (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_FIELDMARSHAL];
+ guint32 cols [MONO_FIELD_MARSHAL_SIZE];
+ int i, is_field, idx;
+ const char *blob;
+ char *native;
+
+ fprintf (output, "FieldMarshal Table (1..%d)\n", t->rows);
+
+ for (i = 1; i <= t->rows; i++) {
+ mono_metadata_decode_row (t, i - 1, cols, MONO_FIELD_MARSHAL_SIZE);
+ blob = mono_metadata_blob_heap (m, cols [MONO_FIELD_MARSHAL_NATIVE_TYPE]);
+ native = get_marshal_info (m, blob);
+ is_field = (cols [MONO_FIELD_MARSHAL_PARENT] & MONO_HAS_FIELD_MARSHAL_MASK) == MONO_HAS_FIELD_MARSHAL_FIELDSREF;
+ idx = cols [MONO_FIELD_MARSHAL_PARENT] >> MONO_HAS_FIELD_MARSHAL_BITS;
+ fprintf (output, "%d: (0x%04x) %s %d: %s\n", i, cols [MONO_FIELD_MARSHAL_PARENT], is_field? "Field" : "Param", idx, native);
+ g_free (native);
+ }
+
+}
+
+static const char*
+get_security_action (int val) {
+ static char buf [32];
+
+ switch (val) {
+ case SECURITY_ACTION_DEMAND:
+ return "Demand";
+ case SECURITY_ACTION_ASSERT:
+ return "Assert";
+ case SECURITY_ACTION_DENY:
+ return "Deny";
+ case SECURITY_ACTION_PERMITONLY:
+ return "PermitOnly";
+ case SECURITY_ACTION_LINKDEMAND:
+ return "LinkDemand";
+ case SECURITY_ACTION_INHERITDEMAND:
+ return "InheritanceDemand";
+ case SECURITY_ACTION_REQMIN:
+ return "RequestMinimum";
+ case SECURITY_ACTION_REQOPT:
+ return "RequestOptional";
+ case SECURITY_ACTION_REQREFUSE:
+ return "RequestRefuse";
+ default:
+ g_snprintf (buf, sizeof (buf), "0x%04X", val);
+ return buf;
+ }
+}
+
+void
+dump_table_declsec (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_DECLSECURITY];
+ guint32 cols [MONO_DECL_SECURITY_SIZE];
+ int i, len;
+ guint32 idx;
+ const char *blob, *action;
+ const char* parent[] = {
+ "TypeDef", "MethodDef", "Assembly", ""
+ };
+
+ fprintf (output, "DeclSecurity Table (1..%d)\n", t->rows);
+
+ for (i = 1; i <= t->rows; i++) {
+ mono_metadata_decode_row (t, i - 1, cols, MONO_DECL_SECURITY_SIZE);
+ blob = mono_metadata_blob_heap (m, cols [MONO_DECL_SECURITY_PERMISSIONSET]);
+ len = mono_metadata_decode_blob_size (blob, &blob);
+ action = get_security_action (cols [MONO_DECL_SECURITY_ACTION]);
+ idx = cols [MONO_DECL_SECURITY_PARENT];
+ fprintf (output, "%d: %s on %s %d%s", i, action, parent [idx & MONO_HAS_DECL_SECURITY_MASK], idx >> MONO_HAS_DECL_SECURITY_BITS, len? ":\n\t":"\n");
+ if (!len)
+ continue;
+ for (idx = 0; idx < len; ++idx)
+ fprintf (output, "%c", blob [idx]);
+ fprintf (output, "\n");
+ }
+}
+
+void
+dump_table_genericpar (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_GENERICPARAM];
+ guint32 cols [MONO_GENERICPARAM_SIZE];
+ int i;
+
+ fprintf (output, "GenericParameters (1..%d)\n", t->rows);
+
+ for (i = 1; i <= t->rows; i++) {
+ char *sig;
+ mono_metadata_decode_row (t, i - 1, cols, MONO_GENERICPARAM_SIZE);
+
+ sig = get_type_or_methdef (m, cols [MONO_GENERICPARAM_OWNER]);
+ fprintf (output, "%d: %d, flags=%d, owner=%s %s\n", i,
+ cols [MONO_GENERICPARAM_NUMBER],
+ cols [MONO_GENERICPARAM_FLAGS], sig,
+ mono_metadata_string_heap (m, cols [MONO_GENERICPARAM_NAME]));
+ g_free (sig);
+ }
+}
+
+void
+dump_table_methodspec (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_METHODSPEC];
+ guint32 cols [MONO_METHODSPEC_SIZE];
+ int i;
+
+ fprintf (output, "MethodSpec (1..%d)\n", t->rows);
+
+ for (i = 1; i <= t->rows; i++) {
+ char *sig;
+ char *method;
+ guint32 token;
+
+ mono_metadata_decode_row (t, i - 1, cols, MONO_METHODSPEC_SIZE);
+
+ /* build a methodspec token to get the method */
+ token = MONO_TOKEN_METHOD_SPEC | i;
+ method = get_method (m, token);
+
+ sig = get_method_type_param (m, cols [MONO_METHODSPEC_SIGNATURE]);
+ fprintf (output, "%d: %s, %s\n", i, method, sig);
+ g_free (sig);
+ g_free (method);
+ }
+}
+
+void
+dump_table_parconstraint (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_GENERICPARAMCONSTRAINT];
+ guint32 cols [MONO_GENPARCONSTRAINT_SIZE];
+ int i;
+
+ fprintf (output, "Generic Param Constraint (1..%d)\n", t->rows);
+
+ for (i = 1; i <= t->rows; i++) {
+ char *sig;
+ mono_metadata_decode_row (t, i - 1, cols, MONO_GENPARCONSTRAINT_SIZE);
+
+ sig = get_typedef_or_ref (m, cols [MONO_GENPARCONSTRAINT_CONSTRAINT]);
+ fprintf (output, "%d: gen-par=%d, Constraint=%s\n", i,
+ cols [MONO_GENPARCONSTRAINT_GENERICPAR], sig);
+ g_free (sig);
+ }
+}
+
+void
+dump_stream_blob (MonoImage *m)
+{
+ int i;
+
+ fprintf (output, "Blob heap contents\n");
+
+ for (i = 0; i < m->heap_blob.size; i++) {
+ 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");
+ }
+}