2005-07-05 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mono / metadata / debug-helpers.c
index 284ddf1b2254916fe521c1fd8991552b75dce01d..010c49b72e7d650ca6ab1851005e20d0457035a2 100644 (file)
@@ -25,14 +25,19 @@ static const char *wrapper_type_names [] = {
        "managed-to-native",
        "remoting-invoke",
        "remoting-invoke-with-check",
+       "xdomain-invoke",
+       "xdomain-dispatch",
        "ldfld",
        "stfld",
+       "ldfld-remote",
+       "stfld-remote",
        "synchronized",
        "dynamic-method",
        "isinst",
        "cancast",
        "proxy_isinst",
        "stelemref",
+       "unbox",
        "unknown"
 };
 
@@ -108,7 +113,7 @@ mono_type_get_desc (GString *res, MonoType *type, gboolean include_namespace) {
                append_class_name (res, type->data.klass, include_namespace);
                break;
        case MONO_TYPE_GENERICINST:
-               mono_type_get_desc (res, type->data.generic_inst->generic_type, include_namespace);
+               mono_type_get_desc (res, &type->data.generic_class->container_class->byval_arg, include_namespace);
                break;
        default:
                break;
@@ -150,15 +155,17 @@ mono_signature_get_desc (MonoMethodSignature *sig, gboolean include_namespace)
 
 /**
  * mono_method_desc_new:
+ * @name: the method name.
+ * @include_namespace: whether the name includes a namespace or not.
  *
- * Creates a method description for `name', which conforms to the following
+ * Creates a method description for @name, which conforms to the following
  * specification:
  *
  * [namespace.]classname:methodname[(args...)]
  *
  * in all the loaded assemblies.
  *
- * Returns a parsed representation of the method description.
+ * Returns: a parsed representation of the method description.
  */
 MonoMethodDesc*
 mono_method_desc_new (const char *name, gboolean include_namespace)
@@ -231,8 +238,9 @@ mono_method_desc_from_method (MonoMethod *method)
 
 /**
  * mono_method_desc_free:
+ * @desc: method description to be released
  *
- * Releases the MonoMethodDesc object `desc'.
+ * Releases the MonoMethodDesc object @desc.
  */
 void
 mono_method_desc_free (MonoMethodDesc *desc)
@@ -255,9 +263,9 @@ mono_method_desc_match (MonoMethodDesc *desc, MonoMethod *method)
                return FALSE;
        if (!desc->args)
                return TRUE;
-       if (desc->num_args != method->signature->param_count)
+       if (desc->num_args != mono_method_signature (method)->param_count)
                return FALSE;
-       sig = mono_signature_get_desc (method->signature, desc->include_namespace);
+       sig = mono_signature_get_desc (mono_method_signature (method), desc->include_namespace);
        if (strcmp (sig, desc->args)) {
                g_free (sig);
                return FALSE;
@@ -279,13 +287,12 @@ mono_method_desc_full_match (MonoMethodDesc *desc, MonoMethod *method)
 MonoMethod*
 mono_method_desc_search_in_class (MonoMethodDesc *desc, MonoClass *klass)
 {
-       int i;
-
-       mono_class_init (klass);
-       for (i = 0; i < klass->method.count; ++i) {
-               if (mono_method_desc_match (desc, klass->methods [i]))
-                       return klass->methods [i];
-       }
+       MonoMethod* m;
+       gpointer iter = NULL;
+       
+       while ((m = mono_class_get_methods (klass, &iter)))
+               if (mono_method_desc_match (desc, m))
+                       return m;
        return NULL;
 }
 
@@ -323,7 +330,7 @@ mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image)
 static const unsigned char*
 dis_one (GString *str, MonoDisHelper *dh, MonoMethod *method, const unsigned char *ip, const unsigned char *end)
 {
-       MonoMethodHeader *header = ((MonoMethodNormal*)method)->header;
+       MonoMethodHeader *header = mono_method_get_header (method);
        const MonoOpcode *opcode;
        guint32 i, label, token;
        gint32 sval;
@@ -503,7 +510,7 @@ mono_method_full_name (MonoMethod *method, gboolean signature)
        const char *nspace = method->klass->name_space;
 
        if (signature) {
-               char *tmpsig = mono_signature_get_desc (method->signature, TRUE);
+               char *tmpsig = mono_signature_get_desc (mono_method_signature (method), TRUE);
 
                if (method->wrapper_type != MONO_WRAPPER_NONE)
                        sprintf (wrapper, "(wrapper %s) ", wrapper_type_to_str (method->wrapper_type));
@@ -522,23 +529,3 @@ mono_method_full_name (MonoMethod *method, gboolean signature)
 
        return res;
 }
-
-MonoMethod *
-mono_find_method_by_name (MonoClass *klass, const char *name, int param_count)
-{
-       MonoMethod *res = NULL;
-       int i;
-
-       mono_class_init (klass);
-
-       for (i = 0; i < klass->method.count; ++i) {
-               if (klass->methods [i]->name[0] == name [0] && 
-                   !strcmp (name, klass->methods [i]->name) &&
-                   klass->methods [i]->signature->param_count == param_count) {
-                       res = klass->methods [i];
-                       break;
-               }
-       }
-       return res;
-}
-