[corlib] Versioning from reference sources
[mono.git] / mono / metadata / debug-helpers.c
index cceaaef13e37969f3e2dd4689222e230fc3b3e45..d4027a01f5d2ce1dba0898d4f064b99ffbcc5c30 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * console-io.c: ConsoleDriver internal calls
+ * debug-helpers.c:
  *
  * Author:
  *     Mono Project (http://www.mono-project.com)
@@ -12,6 +12,7 @@
 #include "mono/metadata/opcodes.h"
 #include "mono/metadata/metadata-internals.h"
 #include "mono/metadata/class-internals.h"
+#include "mono/metadata/object-internals.h"
 #include "mono/metadata/mono-endian.h"
 #include "mono/metadata/debug-helpers.h"
 #include "mono/metadata/tabledefs.h"
@@ -197,9 +198,9 @@ mono_type_get_desc (GString *res, MonoType *type, gboolean include_namespace)
        case MONO_TYPE_VAR:
        case MONO_TYPE_MVAR:
                if (type->data.generic_param) {
-                       MonoGenericParamInfo *info = mono_generic_param_info (type->data.generic_param);
-                       if (info)
-                               g_string_append (res, info->name);
+                       const char *name = mono_generic_param_name (type->data.generic_param);
+                       if (name)
+                               g_string_append (res, name);
                        else
                                g_string_append_printf (res, "%s%d", type->type == MONO_TYPE_VAR ? "!" : "!!", mono_generic_param_num (type->data.generic_param));
                } else {
@@ -325,10 +326,10 @@ mono_method_desc_new (const char *name, gboolean include_namespace)
                g_free (class_nspace);
                return NULL;
        }
-       *method_name++ = 0;
        /* allow two :: to separate the method name */
-       if (*method_name == ':')
-               method_name++;
+       if (method_name != class_nspace && method_name [-1] == ':')
+               method_name [-1] = 0;
+       *method_name++ = 0;
        class_name = strrchr (class_nspace, '.');
        if (class_name) {
                *class_name++ = 0;
@@ -467,6 +468,8 @@ match_class (MonoMethodDesc *desc, int pos, MonoClass *klass)
 gboolean
 mono_method_desc_full_match (MonoMethodDesc *desc, MonoMethod *method)
 {
+       if (!desc->klass)
+               return FALSE;
        if (!match_class (desc, strlen (desc->klass), method->klass))
                return FALSE;
 
@@ -489,7 +492,6 @@ MonoMethod*
 mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image)
 {
        MonoClass *klass;
-       const MonoTableInfo *tdef;
        const MonoTableInfo *methods;
        MonoMethod *method;
        int i;
@@ -508,7 +510,8 @@ mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image)
                return mono_method_desc_search_in_class (desc, klass);
        }
 
-       tdef = mono_image_get_table_info (image, MONO_TABLE_TYPEDEF);
+       /* FIXME: Is this call necessary?  We don't use its result. */
+       mono_image_get_table_info (image, MONO_TABLE_TYPEDEF);
        methods = mono_image_get_table_info (image, MONO_TABLE_METHOD);
        for (i = 0; i < mono_table_info_get_rows (methods); ++i) {
                guint32 token = mono_metadata_decode_row_col (methods, i, MONO_METHOD_NAME);
@@ -572,7 +575,7 @@ dis_one (GString *str, MonoDisHelper *dh, MonoMethod *method, const unsigned cha
                size_t len2;
                char *blob2 = NULL;
 
-               if (!method->klass->image->dynamic) {
+               if (!image_is_dynamic (method->klass->image) && !method_is_dynamic (method)) {
                        token = read32 (ip);
                        blob = mono_metadata_user_string (method->klass->image, mono_metadata_token_index (token));
 
@@ -683,6 +686,7 @@ dis_one (GString *str, MonoDisHelper *dh, MonoMethod *method, const unsigned cha
        if (dh->newline)
                g_string_append (str, dh->newline);
 
+       mono_metadata_free_mh (header);
        return ip;
 }
 
@@ -842,7 +846,7 @@ mono_object_describe (MonoObject *obj)
                MonoArray *array = (MonoArray*)obj;
                sep = print_name_space (klass);
                g_print ("%s%s", sep, klass->name);
-               g_print (" at %p, rank: %d, length: %d\n", obj, klass->rank, mono_array_length (array));
+               g_print (" at %p, rank: %d, length: %d\n", obj, klass->rank, (int)mono_array_length (array));
        } else {
                sep = print_name_space (klass);
                g_print ("%s%s", sep, klass->name);
@@ -1001,7 +1005,7 @@ mono_class_describe_statics (MonoClass* klass)
 
        if (!vtable)
                return;
-       if (!(addr = vtable->data))
+       if (!(addr = mono_vtable_get_static_field_data (vtable)))
                return;
 
        for (p = klass; p != NULL; p = p->parent) {
@@ -1018,4 +1022,3 @@ mono_class_describe_statics (MonoClass* klass)
                }
        }
 }
-