-SUBDIRS = metadata cil dis interpreter
+SUBDIRS = metadata cil cli dis interpreter
+2001-07-17 Miguel de Icaza <miguel@ximian.com>
+
+ * main.c (usage): Print out all the arguments.
+
+ * get.c, main.c, dump.c: Remove `expand', `get_encoded_value',
+ `get_blob_encoded_size' and replaced with the proper functions
+ from metadata.c
+
2001-07-15 Miguel de Icaza <miguel@ximian.com>
* main.c (dis_code): Only display .entrypoint when we are dealing
char *res;
int len, i, j;
- ptr = get_blob_encoded_size (ptr, &len);
+ ptr = mono_metadata_decode_blob_size (ptr, &len);
res = g_malloc (len + 1);
/*
const char *ptr;
int len;
- expand (t, 0, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, 0, cols, CSIZE (cols));
fprintf (output, "Assembly Table\n");
fprintf (output, "Name: %s\n", mono_metadata_string_heap (m, cols [7]));
fprintf (output, "PublicKey: BlobPtr (0x%08x)\n", cols [6]);
ptr = mono_metadata_blob_heap (m, cols [6]);
- ptr = get_encoded_value (ptr, &len);
+ ptr = mono_metadata_decode_value (ptr, &len);
if (len > 0){
fprintf (output, "\tDump:");
hex_dump (ptr, 0, len);
char *s = get_typedef (m, i);
guint32 cols [6];
- expand (&m->tables [META_TABLE_TYPEDEF], i - 1, cols, CSIZE (cols));
+ mono_metadata_decode_row (&m->tables [META_TABLE_TYPEDEF], i - 1, cols, CSIZE (cols));
fprintf (output, "%d: %s (flist=%d, mlist=%d)\n", i, s, cols [4], cols [5]);
g_free (s);
int len;
guint32 cols [9];
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
fprintf (output, "%d: Version=%d.%d.%d.%d\n\tName=%s\n", i,
cols [0], cols [1], cols [2], cols [3],
mono_metadata_string_heap (m, cols [6]));
ptr = mono_metadata_blob_heap (m, cols [6]);
- ptr = get_encoded_value (ptr, &len);
+ ptr = mono_metadata_decode_value (ptr, &len);
if (len > 0){
fprintf (output, "\tPublic Key:");
hex_dump (ptr, 0, len);
for (i = 0; i < t->rows; i++){
guint32 cols [3];
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
fprintf (output, "%d: 0x%04x %d %s\n",
i,
cols [0], cols [1],
guint32 cols [3];
char *sig, *flags;
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
sig = get_field_signature (m, cols [2]);
flags = field_flags (cols [0]);
fprintf (output, "%d: %s %s: %s\n",
for (i = 0; i < t->rows; i++){
guint32 cols [3];
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
kind = cols [0] & 7;
idx = cols [0] >> 3;
for (i = 0; i < t->rows; i++){
guint32 cols [3];
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
fprintf (output, "%d: PackingSize=%d ClassSize=%d Parent=%s\n",
i, cols [0], cols [1], get_typedef (m, cols [2]));
for (i = 0; i < t->rows; i++){
guint32 cols [4];
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
fprintf (output, "%d: Parent=0x%08x %s\n",
i, cols [2], get_constant (m, (ElementTypeEnum) cols [0], cols [3]));
char *type;
int bsize;
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
flags [0] = 0;
if (cols [0] & 0x0200)
strcat (flags, "special ");
strcat (flags, "hasdefault ");
ptr = mono_metadata_blob_heap (m, cols [2]);
- ptr = get_blob_encoded_size (ptr, &bsize);
+ ptr = mono_metadata_decode_blob_size (ptr, &bsize);
/* ECMA claims 0x08 ... */
if (*ptr != 0x28 && *ptr != 0x08)
g_warning("incorrect signature in propert blob: 0x%x", *ptr);
ptr++;
- ptr = get_encoded_value (ptr, &pcount);
+ ptr = mono_metadata_decode_value (ptr, &pcount);
ptr = get_type (m, ptr, &type);
fprintf (output, "%d: %s %s (",
i, type, mono_metadata_string_heap (m, cols [1]));
const char *name;
char *type;
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
name = mono_metadata_string_heap (m, cols [1]);
type = get_typedef_or_ref (m, cols [2]);
guint32 cols [3];
const char *name;
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
name = mono_metadata_string_heap (m, cols[1]);
fprintf (output, "%d: %s %s\n", i, name, cols[2]&0x1?"nometadata":"containsmetadata");
guint32 cols [1];
const char *name;
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
name = mono_metadata_string_heap (m, cols[0]);
fprintf (output, "%d: %s\n", i, name);
guint32 cols [6];
const char *name;
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
name = mono_metadata_string_heap (m, cols[3]);
fprintf (output, "%d: %s\n", i, name);
#include "util.h"
#include "get.h"
-/**
- * expand:
- * @t: table to extract information from.
- * @idx: index in table.
- * @res: array of @res_size cols to store the results in
- *
- * This decompresses the metadata element @idx in table @t
- * into the guint32 @res array that has res_size elements
- */
-void
-expand (metadata_tableinfo_t *t, int idx, guint32 *res, int res_size)
-
-{
- guint32 bitfield = t->size_bitfield;
- int i, count = meta_table_count (bitfield);
- char *data = t->base + idx * t->row_size;
-
- g_assert (res_size == count);
-
- for (i = 0; i < count; i++){
- int n = meta_table_size (bitfield, i);
-
- switch (n){
- case 1:
- res [i] = *data; break;
- case 2:
- res [i] = read16 (data); break;
-
- case 4:
- res [i] = read32 (data); break;
-
- default:
- g_assert_not_reached ();
- }
- data += n;
- }
-}
-
-/**
- * get_encoded_value:
- * @ptr: pointer to decode from
- * @len: result value is stored here.
- *
- * This routine decompresses 32-bit values as specified in the "Blob and
- * Signature" section (22.2)
- *
- * Returns: updated pointer location
- */
-const char *
-get_encoded_value (const char *_ptr, guint32 *len)
-{
- const unsigned char *ptr = (unsigned char *) _ptr;
- unsigned char b = *ptr;
-
- if ((b & 0x80) == 0){
- *len = b;
- return ptr+1;
- } else if ((b & 0x40) == 0){
- *len = ((b & 0x3f) << 8 | ptr [1]);
- return ptr + 2;
- }
- *len = ((b & 0x1f) << 24) |
- (ptr [1] << 16) |
- (ptr [2] << 8) |
- ptr [3];
-
- return ptr + 4;
-}
-
char *
get_typedef (metadata_t *m, int idx)
{
guint32 cols [6];
- expand (&m->tables [META_TABLE_TYPEDEF], idx - 1, cols, CSIZE (cols));
+ mono_metadata_decode_row (&m->tables [META_TABLE_TYPEDEF], idx - 1, cols, CSIZE (cols));
return g_strdup_printf (
"%s.%s",
*/
g_assert (idx == 1);
- expand (&m->tables [META_TABLE_MODULEREF], idx - 1, cols, CSIZE (cols));
+ mono_metadata_decode_row (&m->tables [META_TABLE_MODULEREF], idx - 1, cols, CSIZE (cols));
return g_strdup (mono_metadata_string_heap (m, cols [6]));
}
{
guint32 cols [9];
- expand (&m->tables [META_TABLE_ASSEMBLYREF], idx - 1, cols, CSIZE (cols));
+ mono_metadata_decode_row (&m->tables [META_TABLE_ASSEMBLYREF], idx - 1, cols, CSIZE (cols));
return g_strdup (mono_metadata_string_heap (m, cols [6]));
}
int i, r;
char buffer [80];
- ptr = get_encoded_value (ptr, &rank);
- ptr = get_encoded_value (ptr, &num_sizes);
+ ptr = mono_metadata_decode_value (ptr, &rank);
+ ptr = mono_metadata_decode_value (ptr, &num_sizes);
if (num_sizes > 0)
sizes = g_new (guint32, num_sizes);
for (i = 0; i < num_sizes; i++)
- ptr = get_encoded_value (ptr, &(sizes [i]));
+ ptr = mono_metadata_decode_value (ptr, &(sizes [i]));
- ptr = get_encoded_value (ptr, &num_lo_bounds);
+ ptr = mono_metadata_decode_value (ptr, &num_lo_bounds);
if (num_lo_bounds > 0)
lo_bounds = g_new (guint32, num_lo_bounds);
for (i = 0; i < num_lo_bounds; i++)
- ptr = get_encoded_value (ptr, &(lo_bounds [i]));
+ ptr = mono_metadata_decode_value (ptr, &(lo_bounds [i]));
for (r = 0; r < rank; r++){
if (r < num_sizes){
GString *res = g_string_new ("");
int len;
- expand (&m->tables [META_TABLE_TYPESPEC], idx-1, cols, CSIZE (cols));
+ mono_metadata_decode_row (&m->tables [META_TABLE_TYPESPEC], idx-1, cols, CSIZE (cols));
ptr = mono_metadata_blob_heap (m, cols [0]);
- ptr = get_encoded_value (ptr, &len);
+ ptr = mono_metadata_decode_value (ptr, &len);
switch (*ptr++){
case ELEMENT_TYPE_PTR:
char *x, *ret;
guint32 rs_idx, table;
- expand (&m->tables [META_TABLE_TYPEREF], idx - 1, cols, CSIZE (cols));
+ mono_metadata_decode_row (&m->tables [META_TABLE_TYPEREF], idx - 1, cols, CSIZE (cols));
t = mono_metadata_string_heap (m, cols [1]);
s = mono_metadata_string_heap (m, cols [2]);
{
guint32 token;
- ptr = get_encoded_value (ptr, &token);
+ ptr = mono_metadata_decode_value (ptr, &token);
*result = get_typedef_or_ref (m, token);
}
-/**
- * methoddefref_signature:
- * @m: metadata context
- * @ptr: location to decode from.
- * @result: pointer to string where resulting decoded string is stored
- *
- * This routine decodes into a string a MethodDef or a MethodRef.
- *
- * result will point to a g_malloc()ed string.
- *
- * Returns: the new ptr to continue decoding
- */
-static const char *
-methoddefref_signature (metadata_t *m, const char *ptr, char **result)
-{
- *result = g_strdup ("method-def-or-ref");
-
- return ptr;
-}
-
static map_t element_type_map [] = {
{ ELEMENT_TYPE_END , "end" },
{ ELEMENT_TYPE_VOID , "void" },
char *res;
int len;
- ptr = get_encoded_value (ptr, &len);
+ ptr = mono_metadata_decode_value (ptr, &len);
base = ptr;
/* FIELD is 0x06 */
g_assert (*ptr == 0x06);
int len;
char *allocated_modifier_string;
- ptr = get_encoded_value (ptr, &len);
+ ptr = mono_metadata_decode_value (ptr, &len);
/* FIELD is 0x06 */
g_assert (*ptr == 0x06);
return g_strdup (buffer);
}
-/**
- * get_blob_encoded_size:
- * @ptr: pointer to a blob object
- * @size: where we return the size of the object
- *
- * This decodes a compressed size as described by 23.1.4
- *
- * Returns: the position to start decoding a blob or user string object
- * from.
- */
-const char *
-get_blob_encoded_size (const char *xptr, int *size)
-{
- const unsigned char *ptr = xptr;
-
- if ((*ptr & 0x80) == 0){
- *size = ptr [0] & 0x7f;
- ptr++;
- } else if ((*ptr & 0x40) == 0){
- *size = ((ptr [0] & 0x3f) << 8) + ptr [1];
- ptr += 2;
- } else {
- *size = ((ptr [0] & 0x1f) << 24) +
- (ptr [1] << 16) +
- (ptr [2] << 8) +
- ptr [3];
- ptr += 4;
- }
-
- return (char *) ptr;
-}
-
/**
* Returns a stringifed representation of a MethodRefSig (22.2.2)
*/
int param_count, signature_len;
int i;
- ptr = get_encoded_value (ptr, &signature_len);
+ ptr = mono_metadata_decode_value (ptr, &signature_len);
if (*ptr & 0x20){
if (*ptr & 0x40)
seen_vararg = 1;
ptr++;
- ptr = get_encoded_value (ptr, ¶m_count);
+ ptr = mono_metadata_decode_value (ptr, ¶m_count);
ptr = get_ret_type (m, ptr, &allocated_ret_type);
g_string_append (res, allocated_ret_type);
int typedef_index = (bb - loc->t->base) / loc->t->row_size;
guint32 cols [6], cols_next [6];
- expand (loc->t, typedef_index, cols, CSIZE (cols));
+ mono_metadata_decode_row (loc->t, typedef_index, cols, CSIZE (cols));
if (loc->idx < cols [4])
return -1;
* Need to check that the next row is valid.
*/
if (typedef_index + 1 < loc->t->rows) {
- expand (loc->t, typedef_index + 1, cols_next, CSIZE (cols_next));
+ mono_metadata_decode_row (loc->t, typedef_index + 1, cols_next, CSIZE (cols_next));
if (loc->idx >= cols_next [4])
return 1;
}
g_assert (mono_metadata_token_code (token) == TOKEN_TYPE_FIELD_DEF);
- expand (&m->tables [META_TABLE_FIELD], idx - 1, cols, CSIZE (cols));
+ mono_metadata_decode_row (&m->tables [META_TABLE_FIELD], idx - 1, cols, CSIZE (cols));
sig = get_field_signature (m, cols [2]);
/*
case TOKEN_TYPE_MEMBER_REF: {
char *sig;
- expand (&m->tables [META_TABLE_MEMBERREF], idx - 1, member_cols, CSIZE (member_cols));
+ mono_metadata_decode_row (&m->tables [META_TABLE_MEMBERREF],
+ idx - 1, member_cols,
+ CSIZE (member_cols));
class = get_memberref_parent (m, member_cols [0]);
- fancy_name = g_strconcat (class, "::",
- mono_metadata_string_heap (m, member_cols [1]),
- NULL);
+ fancy_name = g_strconcat (
+ class, "::",
+ mono_metadata_string_heap (m, member_cols [1]),
+ NULL);
sig = get_methodref_signature (
m, member_cols [2], fancy_name);
const char *ptr = mono_metadata_blob_heap (m, blob_index);
int len;
- ptr = get_encoded_value (ptr, &len);
+ ptr = mono_metadata_decode_value (ptr, &len);
switch (t){
case ELEMENT_TYPE_BOOLEAN:
char **retval);
const char *get_blob_encoded_size (const char *ptr, int *size);
-void expand (metadata_tableinfo_t *t, int idx, guint32 *res, int res_size);
-
-
ElementTypeEnum get_field_literal_type (metadata_t *m, guint32 blob_signature);
if (t->base == NULL)
return;
- expand (t, 0, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, 0, cols, CSIZE (cols));
fprintf (output,
".assembly %s\n"
return;
for (i = 0; i < t->rows; i++){
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
fprintf (output,
".assembly extern %s\n"
for (i = start; i < end; i++){
char *sig, *flags;
- expand (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
sig = get_field_signature (m, cols [2]);
flags = field_flags (cols [0]);
guint32 cols[1];
int len=0, i, bsize;
- expand (t, (token&0xffffff)-1, cols, CSIZE(cols));
+ mono_metadata_decode_row (t, (token&0xffffff)-1, cols, CSIZE(cols));
ptr = mono_metadata_blob_heap (m, cols[0]);
- ptr = get_blob_encoded_size (ptr, &bsize);
+ ptr = mono_metadata_decode_blob_size (ptr, &bsize);
if (*ptr != 0x07)
g_warning("wrong signature for locals blob");
ptr++;
- ptr = get_encoded_value (ptr, &len);
+ ptr = mono_metadata_decode_value (ptr, &len);
fprintf(output, "\t.locals ( // %d\n", len);
for (i=0; i < len; ++i) {
int val;
char * desc = NULL;
const char *p = ptr;
MonoType *type;
- ptr = get_encoded_value (ptr, &val);
+ ptr = mono_metadata_decode_value (ptr, &val);
if (val == ELEMENT_TYPE_PINNED) {
fprintf(output, "//pinned\n");
p = ptr;
- ptr = get_encoded_value (ptr, &val);
+ ptr = mono_metadata_decode_value (ptr, &val);
}
if (val == ELEMENT_TYPE_BYREF) {
fprintf(output, "// byref\n");
MethodSignature *ms = g_new0 (MethodSignature, 1);
int i, len;
- ptr = get_encoded_value (ptr, &len);
+ ptr = mono_metadata_decode_value (ptr, &len);
fprintf (output, " // SIG: ");
hex_dump (ptr, 0, -len);
fprintf (output, "\n");
ms->flags = *ptr++;
- ptr = get_encoded_value (ptr, &ms->param_count);
+ ptr = mono_metadata_decode_value (ptr, &ms->param_count);
ptr = get_ret_type (m, ptr, &ms->ret_type);
ms->param = g_new (char *, ms->param_count);
MethodSignature *ms;
char *flags, *impl_flags;
- expand (t, i, cols, CSIZE (cols));
- expand (t, i + 1, cols_next, CSIZE (cols_next));
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, i + 1, cols_next, CSIZE (cols_next));
flags = method_flags (cols [2]);
impl_flags = method_impl_flags (cols [1]);
for (i = 0; i < ms->param_count; i++){
char *pf;
- expand (p, i, param_cols, CSIZE (param_cols));
+ mono_metadata_decode_row (p, i, param_cols, CSIZE (param_cols));
pf = param_flags (param_cols [0]);
fprintf (
output, "\t\t%s %s %s%s", pf, ms->param [i],
const char *name;
gboolean next_is_valid, last;
- expand (t, n, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, n, cols, CSIZE (cols));
if (t->rows > n+1){
- expand (t, n + 1, cols_next, CSIZE (cols_next));
+ mono_metadata_decode_row (t, n + 1, cols_next, CSIZE (cols_next));
next_is_valid = 1;
} else
next_is_valid = 0;
static void
usage (void)
{
- fprintf (stderr, "Usage is: monodis [--typeref][--typedef][--assemblyref][--param][--fields][--memberref] file ..\n");
+ GString *args = g_string_new ("");
+ int i;
+
+ for (i = 0; table_list [i].name != NULL; i++){
+ g_string_append (args, "[");
+ g_string_append (args, table_list [i].name);
+ g_string_append (args, "] ");
+ if ((i % 4) == 0)
+ g_string_append_c (args, '\n');
+ }
+ fprintf (stderr,
+ "Usage is: monodis %s file ..\n", args);
exit (1);
}
* Don't look at these macros, it hurts...
*/
#define GOTO_LABEL
+#undef GOTO_LABEL
#ifdef GOTO_LABEL
#define SWITCH(a) goto *goto_map [(a)];
#define BREAK SWITCH(*ip)
#define SUB_SWITCH case 0xFE:
#endif
+void
+ves_abort (cli_image_info_t *iinfo, MonoMethod *mh, unsigned char *ip, stackval *stack)
+{
+ printf ("In method: %s\n",
+ printf ("Aborted execution");
+ abort (1);
+}
+
/*
* Need to optimize ALU ops when natural int == int32
*
#ifdef GOTO_LABEL
START:
#endif
- /*g_print ("0x%04x %02x\n", ip-(unsigned char*)mh->header->code, *ip);
+ g_print ("0x%04x %02x\n", ip-(unsigned char*)mh->header->code, *ip);
if (sp > stack)
printf ("\t[%d] %d 0x%08x %0.5f\n", sp-stack, sp[-1].type, sp[-1].data.i, sp[-1].data.f);
- */
+
SWITCH (*ip) {
CASE (CEE_NOP)
++ip;
+2001-07-17 Miguel de Icaza <miguel@ximian.com>
+
+ * metadata.h: Fixed Paolo's quick hack. Put the documnentation
+ from get.c here.
+
Sun Jul 15 19:39:06 CEST 2001 Paolo Molaro <lupus@ximian.com>
* metadata.c, metadata.h: decode local vars in method header
metadata_t cli_metadata;
} cli_image_info_t;
-typedef struct {
- MonoMetaMethodHeader *header;
- MonoMethodSignature *signature;
- guint32 name; /* index in string heap */
- /* add flags, info from param table ... */
-} MonoMethod;
-
guint32 cli_rva_image_map (cli_image_info_t *iinfo, guint32 rva);
char *cli_rva_map (cli_image_info_t *iinfo, guint32 rva);
-MonoMethod *mono_get_method (cli_image_info_t *iinfo, guint32 token);
-void mono_free_method (MonoMethod *method);
-
-
#endif /* __MONO_CIL_COFF_H__ */
return eh;
}
-/* cut and paste from expand: remove that one later */
+/**
+ * mono_metadata_decode_row:
+ * @t: table to extract information from.
+ * @idx: index in table.
+ * @res: array of @res_size cols to store the results in
+ *
+ * This decompresses the metadata element @idx in table @t
+ * into the guint32 @res array that has res_size elements
+ */
void
mono_metadata_decode_row (metadata_tableinfo_t *t, int idx, guint32 *res, int res_size)
{
}
}
+/**
+ * mono_metadata_decode_blob_size:
+ * @ptr: pointer to a blob object
+ * @size: where we return the size of the object
+ *
+ * This decodes a compressed size as described by 23.1.4
+ *
+ * Returns: the position to start decoding a blob or user string object
+ * from.
+ */
const char *
mono_metadata_decode_blob_size (const char *xptr, int *size)
{
return (char *) ptr;
}
-/* cut and paste from get_encode_val */
+
+/**
+ * mono_metadata_decode_value:
+ * @ptr: pointer to decode from
+ * @len: result value is stored here.
+ *
+ * This routine decompresses 32-bit values as specified in the "Blob and
+ * Signature" section (22.2)
+ *
+ * Returns: updated pointer location
+ */
const char *
mono_metadata_decode_value (const char *_ptr, guint32 *len)
{
g_free (type);
}
-MonoMethod *
-mono_get_method (cli_image_info_t *iinfo, guint32 token)
-{
- MonoMethod *result = g_new0 (MonoMethod, 1);
- int table = mono_metadata_token_table (token);
- int index = mono_metadata_token_index (token);
- metadata_tableinfo_t *tables = iinfo->cli_metadata.tables;
- const char *loc;
- const char *sig = NULL;
- int size;
- guint32 cols[6];
-
- /*
- * We need a context with cli_image_info_t for this module and the assemblies
- * loaded later to support method refs...
- */
- if (table != META_TABLE_METHOD) {
- g_assert (table == META_TABLE_MEMBERREF);
- mono_metadata_decode_row (&tables [table], index, cols, 3);
- g_assert ((cols [0] & 0x07) != 3);
- table = META_TABLE_METHOD;
- index = cols [0] >> 3;
- sig = mono_metadata_blob_heap (&iinfo->cli_metadata, cols [2]);
- result->name = cols [1];
- }
-
- mono_metadata_decode_row (&tables [table], index - 1, cols, 6);
- result->name = cols [3];
- /* if this is a methodref from another module/assembly, this fails */
- loc = cli_rva_map (iinfo, cols [0]);
- g_assert (loc);
- result->header = mono_metadata_parse_mh (&iinfo->cli_metadata, loc);
- if (!sig) /* already taken from the methodref */
- sig = mono_metadata_blob_heap (&iinfo->cli_metadata, cols [4]);
- sig = mono_metadata_decode_blob_size (sig, &size);
- result->signature = mono_metadata_parse_method_signature (&iinfo->cli_metadata, 0, sig, NULL);
-
- return result;
-}
-
-void
-mono_free_method (MonoMethod *method)
-{
- mono_metadata_free_method_signature (method->signature);
- mono_metadata_free_mh (method->header);
- g_free (method);
-}
-
/**
* @mh: The Method header
* @ptr: Points to the beginning of the Section Data (25.3)
#include <glib.h>
-#include "eltype.h"
+#include <mono/metadata/eltype.h>
typedef struct {
guint32 sh_offset;
guint32 size_bitfield;
} metadata_tableinfo_t;
+void mono_metadata_decode_row (metadata_tableinfo_t *t,
+ int idx,
+ guint32 *res,
+ int res_size);
+
/*
* This macro is used to extract the size of the table encoded in
* the size_bitfield of metadata_tableinfo_t.
/*
*
*/
-char *mono_metadata_locate (metadata_t *meta, int table, int idx);
-char *mono_metadata_locate_token (metadata_t *meta, guint32 token);
-
-const char *mono_metadata_string_heap (metadata_t *meta, guint32 index);
-const char *mono_metadata_blob_heap (metadata_t *meta, guint32 index);
-const char *mono_metadata_user_string (metadata_t *meta, guint32 index);
+char *mono_metadata_locate (metadata_t *meta, int table, int idx);
+char *mono_metadata_locate_token (metadata_t *meta, guint32 token);
+
+const char *mono_metadata_string_heap (metadata_t *meta, guint32 index);
+const char *mono_metadata_blob_heap (metadata_t *meta, guint32 index);
+const char *mono_metadata_user_string (metadata_t *meta, guint32 index);
+/*
+ * Functions to extract information from the Blobs
+ */
const char *mono_metadata_decode_value (const char *ptr,
guint32 *len);
const char *mono_metadata_decode_blob_size (const char *xptr,
int *size);
-void mono_metadata_decode_row (metadata_tableinfo_t *t,
- int idx,
- guint32 *res,
- int res_size);
typedef enum {
MONO_META_EXCEPTION_CLAUSE_NONE,