2003-07-20 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Sun, 20 Jul 2003 18:20:31 +0000 (18:20 -0000)
committerMartin Baulig <martin@novell.com>
Sun, 20 Jul 2003 18:20:31 +0000 (18:20 -0000)
* mono-debug.h: Set version number to 31.
(mono_debug_init): Added `MonoDomain *' argument.

* mono-debug-debugger.c: Reworked the type support; explicitly
tell the debugger about builtin types; pass the `klass' address to
the debugger.

svn path=/trunk/mono/; revision=16448

mono/interpreter/interp.c
mono/metadata/ChangeLog
mono/metadata/mono-debug-debugger.c
mono/metadata/mono-debug-debugger.h
mono/metadata/mono-debug.c
mono/metadata/mono-debug.h
mono/mini/driver.c

index 278ce6faeb02d6f22118f6fd4610287b83a67fdd..6dec06cbfc68135df7bb2855a428e70bdfa610e2 100644 (file)
@@ -4461,7 +4461,7 @@ static void main_thread_handler (gpointer user_data)
        char *error;
 
        if (main_args->enable_debugging)
-               mono_debug_init (MONO_DEBUG_FORMAT_MONO);
+               mono_debug_init (main_args->domain, MONO_DEBUG_FORMAT_MONO);
 
        assembly = mono_domain_assembly_open (main_args->domain,
                                              main_args->file);
index 0cfe275847cfb73e2e88360c8378f3b97904c2d9..ffb1a1d5fef680e1b2c8e7515167caee53627cf2 100644 (file)
@@ -1,3 +1,12 @@
+2003-07-20  Martin Baulig  <martin@ximian.com>
+
+       * mono-debug.h: Set version number to 31.
+       (mono_debug_init): Added `MonoDomain *' argument.
+
+       * mono-debug-debugger.c: Reworked the type support; explicitly
+       tell the debugger about builtin types; pass the `klass' address to
+       the debugger.
+
 2003-07-20 Jackson Harper <jackson@latitudegeo.com>
 
        * image.c: Allow new metadata tables to be loaded without a
index 918370cd785c82ffbf832be24f4bc9f7e43ac6b5..6b944f90544043fabd8ee89e73c615a60cd6eaca 100644 (file)
@@ -73,7 +73,7 @@ allocate_symbol_file_entry (MonoDebuggerSymbolTable *table)
 }
 
 void
-mono_debugger_initialize (void)
+mono_debugger_initialize (MonoDomain *domain)
 {
        MonoDebuggerSymbolTable *symbol_table;
 
@@ -88,6 +88,8 @@ mono_debugger_initialize (void)
        symbol_table->version = MONO_DEBUGGER_VERSION;
        symbol_table->total_size = sizeof (MonoDebuggerSymbolTable);
 
+       symbol_table->domain = domain;
+
        mono_debugger_symbol_table = symbol_table;
        mono_debugger_initialized = TRUE;
 
@@ -111,10 +113,58 @@ mono_debugger_add_symbol_file (MonoDebugHandle *handle)
        return info;
 }
 
+static MonoDebuggerClassInfo *
+_mono_debugger_add_type (MonoDebuggerSymbolFile *symfile, MonoClass *klass)
+{
+       MonoDebuggerClassInfo *info;
+
+       info = allocate_class_entry (symfile);
+       info->klass = klass;
+       if (klass->rank) {
+               info->token = klass->element_class->type_token;
+               info->rank = klass->rank;
+       } else
+               info->token = klass->type_token;
+       info->type_info = write_type (mono_debugger_symbol_table, &klass->this_arg);
+       return info;
+}
+
+MonoDebuggerBuiltinTypes *
+mono_debugger_add_builtin_types (MonoDebuggerSymbolFile *symfile)
+{
+       MonoDebuggerBuiltinTypes *types = g_new0 (MonoDebuggerBuiltinTypes, 1);
+
+       types->total_size = sizeof (MonoDebuggerBuiltinTypes);
+       types->object_class = _mono_debugger_add_type (symfile, mono_defaults.object_class);
+       types->byte_class = _mono_debugger_add_type (symfile, mono_defaults.byte_class);
+       types->void_class = _mono_debugger_add_type (symfile, mono_defaults.void_class);
+       types->boolean_class = _mono_debugger_add_type (symfile, mono_defaults.boolean_class);
+       types->sbyte_class = _mono_debugger_add_type (symfile, mono_defaults.sbyte_class);
+       types->int16_class = _mono_debugger_add_type (symfile, mono_defaults.int16_class);
+       types->uint16_class = _mono_debugger_add_type (symfile, mono_defaults.uint16_class);
+       types->int32_class = _mono_debugger_add_type (symfile, mono_defaults.int32_class);
+       types->uint32_class = _mono_debugger_add_type (symfile, mono_defaults.uint32_class);
+       types->int_class = _mono_debugger_add_type (symfile, mono_defaults.int_class);
+       types->uint_class = _mono_debugger_add_type (symfile, mono_defaults.uint_class);
+       types->int64_class = _mono_debugger_add_type (symfile, mono_defaults.int64_class);
+       types->uint64_class = _mono_debugger_add_type (symfile, mono_defaults.uint64_class);
+       types->single_class = _mono_debugger_add_type (symfile, mono_defaults.single_class);
+       types->double_class = _mono_debugger_add_type (symfile, mono_defaults.double_class);
+       types->char_class = _mono_debugger_add_type (symfile, mono_defaults.char_class);
+       types->string_class = _mono_debugger_add_type (symfile, mono_defaults.string_class);
+       types->enum_class = _mono_debugger_add_type (symfile, mono_defaults.enum_class);
+       types->array_class = _mono_debugger_add_type (symfile, mono_defaults.array_class);
+
+       mono_debugger_symbol_table->corlib = symfile;
+       mono_debugger_symbol_table->builtin_types = types;
+
+       return types;
+}
+
 void
 mono_debugger_add_type (MonoDebuggerSymbolFile *symfile, MonoClass *klass)
 {
-       MonoDebuggerClassInfo *info;
+       guint32 info;
 
        mono_debugger_lock ();
 
@@ -122,22 +172,14 @@ mono_debugger_add_type (MonoDebuggerSymbolFile *symfile, MonoClass *klass)
                class_table = g_hash_table_new (g_direct_hash, g_direct_equal);
 
        /* We write typeof (object) into each symbol file's type table. */
-       if ((klass != mono_defaults.object_class) && g_hash_table_lookup (class_table, klass)) {
+       info = GPOINTER_TO_UINT (g_hash_table_lookup (class_table, klass));
+       if ((info != 0) && (klass != mono_defaults.object_class)) {
                mono_debugger_unlock ();
                return;
        }
 
        symfile->generation++;
-
-       info = allocate_class_entry (symfile);
-       info->klass = klass;
-       if (klass->rank) {
-               info->token = klass->element_class->type_token;
-               info->rank = klass->rank;
-       } else
-               info->token = klass->type_token;
-       info->type_info = write_type (mono_debugger_symbol_table, &klass->this_arg);
-
+       _mono_debugger_add_type (symfile, klass);
        mono_debugger_event (MONO_DEBUGGER_EVENT_TYPE_ADDED, NULL, 0);
        mono_debugger_unlock ();
 }
@@ -395,59 +437,37 @@ write_simple_type (MonoDebuggerSymbolTable *table, MonoType *type)
        if (offset)
                return offset;
 
+       *ptr++ = MONO_DEBUGGER_TYPE_KIND_FUNDAMENTAL;
+       *((gpointer *) ptr)++ = mono_class_from_mono_type (type);
+
        switch (type->type) {
        case MONO_TYPE_BOOLEAN:
        case MONO_TYPE_I1:
        case MONO_TYPE_U1:
-               *((gint32 *) ptr) = 1;
-               ptr += sizeof(gint32);
+               *((gint32 *) ptr)++ = 1;
                break;
 
        case MONO_TYPE_CHAR:
        case MONO_TYPE_I2:
        case MONO_TYPE_U2:
-               *((gint32 *) ptr) = 2;
-               ptr += sizeof(gint32);
+               *((gint32 *) ptr)++ = 2;
                break;
 
        case MONO_TYPE_I4:
        case MONO_TYPE_U4:
        case MONO_TYPE_R4:
-               *((gint32 *) ptr) = 4;
-               ptr += sizeof(gint32);
+               *((gint32 *) ptr)++ = 4;
                break;
 
        case MONO_TYPE_I8:
        case MONO_TYPE_U8:
        case MONO_TYPE_R8:
-               *((gint32 *) ptr) = 8;
-               ptr += sizeof(gint32);
-               break;
-
-       case MONO_TYPE_I:
-       case MONO_TYPE_U:
-               *((gint32 *) ptr) = sizeof (void *);
-               ptr += sizeof(gint32);
+               *((gint32 *) ptr)++ = 8;
                break;
 
        case MONO_TYPE_VOID:
-               *((gint32 *) ptr) = 0;
-               ptr += sizeof(gint32);
-               break;
-
-       case MONO_TYPE_STRING: {
-               MonoString string;
-
-               *((gint32 *) ptr) = -8;
-               ptr += sizeof(gint32);
-               *((guint32 *) ptr) = sizeof (MonoString);
-               ptr += sizeof(guint32);
-               *ptr++ = 1;
-               *ptr++ = (guint8*)&string.length - (guint8*)&string;
-               *ptr++ = sizeof (string.length);
-               *ptr++ = (guint8*)&string.chars - (guint8*)&string;
+               *((gint32 *) ptr)++ = 0;
                break;
-       }
 
        default:
                return 0;
@@ -500,12 +520,21 @@ write_type (MonoDebuggerSymbolTable *table, MonoType *type)
        }
 
        switch (kind) {
+       case MONO_TYPE_STRING:
+               size = 8 + 2 * sizeof (gpointer);
+               break;
+
        case MONO_TYPE_SZARRAY:
-               size = 16;
+               size = 12 + sizeof (gpointer);
                break;
 
        case MONO_TYPE_ARRAY:
-               size = 23;
+               size = 19 + sizeof (gpointer);
+               break;
+
+       case MONO_TYPE_I:
+       case MONO_TYPE_U:
+               size = 5 + sizeof (gpointer);
                break;
 
        case MONO_TYPE_VALUETYPE:
@@ -514,7 +543,7 @@ write_type (MonoDebuggerSymbolTable *table, MonoType *type)
                int i;
 
                if (klass->init_pending) {
-                       size = 4;
+                       size = 1;
                        break;
                }
 
@@ -525,7 +554,7 @@ write_type (MonoDebuggerSymbolTable *table, MonoType *type)
                        return offset;
 
                if (klass->enumtype) {
-                       size = 13;
+                       size = 9 + sizeof (gpointer);
                        break;
                }
 
@@ -561,7 +590,7 @@ write_type (MonoDebuggerSymbolTable *table, MonoType *type)
 
                g_hash_table_destroy (method_slots);
 
-               size = 34 + num_fields * 8 + num_properties * (4 + 2 * sizeof (gpointer)) +
+               size = 29 + sizeof (gpointer) + num_fields * 8 + num_properties * (4 + 2 * sizeof (gpointer)) +
                        num_methods * (8 + sizeof (gpointer)) + num_params * 4;
 
                if (kind == MONO_TYPE_CLASS)
@@ -571,7 +600,7 @@ write_type (MonoDebuggerSymbolTable *table, MonoType *type)
        }
 
        default:
-               size = sizeof (int);
+               size = 1;
                break;
        }
 
@@ -583,19 +612,30 @@ write_type (MonoDebuggerSymbolTable *table, MonoType *type)
        g_hash_table_insert (type_table, type, GUINT_TO_POINTER (offset));
 
        switch (kind) {
+       case MONO_TYPE_STRING: {
+               MonoString string;
+
+               *ptr++ = MONO_DEBUGGER_TYPE_KIND_STRING;
+               klass = mono_class_from_mono_type (type);
+               *((gpointer *) ptr)++ = klass;
+               *((guint32 *) ptr)++ = sizeof (MonoString);
+               *((gpointer *) ptr)++ = mono_class_vtable (table->domain, klass);
+               *ptr++ = (guint8*)&string.length - (guint8*)&string;
+               *ptr++ = sizeof (string.length);
+               *ptr++ = (guint8*)&string.chars - (guint8*)&string;
+               break;
+       }
+
        case MONO_TYPE_SZARRAY: {
                MonoArray array;
 
-               *((gint32 *) ptr) = -size;
-               ptr += sizeof(gint32);
-               *((guint32 *) ptr) = sizeof (MonoArray);
-               ptr += sizeof(guint32);
-               *ptr++ = 2;
+               *ptr++ = MONO_DEBUGGER_TYPE_KIND_SZARRAY;
+               *((gpointer *) ptr)++ = mono_class_from_mono_type (type);
+               *((guint32 *) ptr)++ = sizeof (MonoArray);
                *ptr++ = (guint8*)&array.max_length - (guint8*)&array;
                *ptr++ = sizeof (array.max_length);
                *ptr++ = (guint8*)&array.vector - (guint8*)&array;
-               *((guint32 *) ptr) = write_type (table, &type->data.klass->byval_arg);
-               ptr += sizeof(guint32);
+               *((guint32 *) ptr)++ = write_type (table, &type->data.klass->byval_arg);
                break;
        }
 
@@ -603,11 +643,9 @@ write_type (MonoDebuggerSymbolTable *table, MonoType *type)
                MonoArray array;
                MonoArrayBounds bounds;
 
-               *((gint32 *) ptr) = -size;
-               ptr += sizeof(gint32);
-               *((guint32 *) ptr) = sizeof (MonoArray);
-               ptr += sizeof(guint32);
-               *ptr++ = 3;
+               *ptr++ = MONO_DEBUGGER_TYPE_KIND_ARRAY;
+               *((gpointer *) ptr)++ = mono_class_from_mono_type (type);
+               *((guint32 *) ptr)++ = sizeof (MonoArray);
                *ptr++ = (guint8*)&array.max_length - (guint8*)&array;
                *ptr++ = sizeof (array.max_length);
                *ptr++ = (guint8*)&array.vector - (guint8*)&array;
@@ -618,66 +656,59 @@ write_type (MonoDebuggerSymbolTable *table, MonoType *type)
                *ptr++ = sizeof (bounds.lower_bound);
                *ptr++ = (guint8*)&bounds.length - (guint8*)&bounds;
                *ptr++ = sizeof (bounds.length);
-               *((guint32 *) ptr) = write_type (table, &type->data.array->eklass->byval_arg);
-               ptr += sizeof(guint32);
+               *((guint32 *) ptr)++ = write_type (table, &type->data.array->eklass->byval_arg);
                break;
        }
 
+       case MONO_TYPE_I:
+       case MONO_TYPE_U:
+               *ptr++ = MONO_DEBUGGER_TYPE_KIND_POINTER;
+               *((gpointer *) ptr)++ = mono_class_from_mono_type (type);
+               *((gint32 *) ptr)++ = sizeof (void *);
+               break;
+
        case MONO_TYPE_VALUETYPE:
        case MONO_TYPE_CLASS: {
                int base_offset = kind == MONO_TYPE_CLASS ? 0 : - sizeof (MonoObject);
                int i, j;
 
                if (klass->init_pending) {
-                       *((gint32 *) ptr) = -1;
-                       ptr += sizeof(gint32);
+                       *ptr++ = 0;
                        break;
                }
 
                g_hash_table_insert (class_table, klass, GUINT_TO_POINTER (offset));
 
                if (klass->enumtype) {
-                       *((gint32 *) ptr) = -size;
-                       ptr += sizeof(gint32);
-                       *((guint32 *) ptr) = sizeof (MonoObject);
-                       ptr += sizeof(guint32);
-                       *ptr++ = 4;
-                       *((guint32 *) ptr) = write_type (table, klass->enum_basetype);
-                       ptr += sizeof(guint32);
+                       *ptr++ = MONO_DEBUGGER_TYPE_KIND_ENUM;
+                       *((gpointer *) ptr)++ = mono_class_from_mono_type (type);
+                       *((guint32 *) ptr)++ = sizeof (MonoObject);
+                       *((guint32 *) ptr)++ = write_type (table, klass->enum_basetype);
                        break;
                }
 
-               *((gint32 *) ptr) = -size;
-               ptr += sizeof(guint32);
-
-               *((guint32 *) ptr) = klass->instance_size + base_offset;
-               ptr += sizeof(guint32);
                if (type->type == MONO_TYPE_OBJECT)
-                       *ptr++ = 7;
+                       *ptr++ = MONO_DEBUGGER_TYPE_KIND_OBJECT;
+               else if (type->type == MONO_TYPE_CLASS)
+                       *ptr++ = MONO_DEBUGGER_TYPE_KIND_CLASS;
                else
-                       *ptr++ = kind == MONO_TYPE_CLASS ? 6 : 5;
-               *ptr++ = kind == MONO_TYPE_CLASS;
-               *((guint32 *) ptr) = num_fields;
-               ptr += sizeof(guint32);
-               *((guint32 *) ptr) = num_fields * (4 + sizeof (gpointer));
-               ptr += sizeof(guint32);
-               *((guint32 *) ptr) = num_properties;
-               ptr += sizeof(guint32);
-               *((guint32 *) ptr) = num_properties * 3 * sizeof (gpointer);
-               ptr += sizeof(guint32);
-               *((guint32 *) ptr) = num_methods;
-               ptr += sizeof(guint32);
-               *((guint32 *) ptr) = num_methods * (4 + 2 * sizeof (gpointer)) +
+                       *ptr++ = MONO_DEBUGGER_TYPE_KIND_STRUCT;
+
+               *((gpointer *) ptr)++ = klass;
+               *((guint32 *) ptr)++ = klass->instance_size + base_offset;
+               *((guint32 *) ptr)++ = num_fields;
+               *((guint32 *) ptr)++ = num_fields * (4 + sizeof (gpointer));
+               *((guint32 *) ptr)++ = num_properties;
+               *((guint32 *) ptr)++ = num_properties * 3 * sizeof (gpointer);
+               *((guint32 *) ptr)++ = num_methods;
+               *((guint32 *) ptr)++ = num_methods * (4 + 2 * sizeof (gpointer)) +
                        num_params * sizeof (gpointer);
-               ptr += sizeof(guint32);
                for (i = 0; i < klass->field.count; i++) {
                        if (klass->fields [i].type->attrs & FIELD_ATTRIBUTE_STATIC)
                                continue;
 
-                       *((guint32 *) ptr) = klass->fields [i].offset + base_offset;
-                       ptr += sizeof(guint32);
-                       *((guint32 *) ptr) = write_type (table, klass->fields [i].type);
-                       ptr += sizeof(guint32);
+                       *((guint32 *) ptr)++ = klass->fields [i].offset + base_offset;
+                       *((guint32 *) ptr)++ = write_type (table, klass->fields [i].type);
                }
 
                for (i = 0; i < klass->property.count; i++) {
@@ -685,44 +716,34 @@ write_type (MonoDebuggerSymbolTable *table, MonoType *type)
                                continue;
 
                        if (klass->properties [i].get)
-                               *((guint32 *) ptr) = write_type
+                               *((guint32 *) ptr)++ = write_type
                                        (table, klass->properties [i].get->signature->ret);
                        else
-                               *((guint32 *) ptr) = 0;
-                       ptr += sizeof(guint32);
-                       *((gpointer *) ptr) = klass->properties [i].get;
-                       ptr += sizeof(gpointer);
-                       *((gpointer *) ptr) = klass->properties [i].set;
-                       ptr += sizeof(gpointer);
+                               *((guint32 *) ptr)++ = 0;
+                       *((gpointer *) ptr)++ = klass->properties [i].get;
+                       *((gpointer *) ptr)++ = klass->properties [i].set;
                }
 
                for (i = 0; i < methods->len; i++) {
                        MonoMethod *method = g_ptr_array_index (methods, i);
 
-                       *((gpointer *) ptr) = method;
-                       ptr += sizeof(gpointer);
+                       *((gpointer *) ptr)++ = method;
                        if ((method->signature->ret) && (method->signature->ret->type != MONO_TYPE_VOID))
-                               *((guint32 *) ptr) = write_type (table, method->signature->ret);
+                               *((guint32 *) ptr)++ = write_type (table, method->signature->ret);
                        else
-                               *((guint32 *) ptr) = 0;
-                       ptr += sizeof(guint32);
-                       *((guint32 *) ptr) = method->signature->param_count;
-                       ptr += sizeof(guint32);
+                               *((guint32 *) ptr)++ = 0;
+                       *((guint32 *) ptr)++ = method->signature->param_count;
                        for (j = 0; j < method->signature->param_count; j++)
-                       {
-                               *((guint32 *) ptr) = write_type (table, method->signature->params [j]);
-                               ptr += sizeof(guint32);
-                       }
+                               *((guint32 *) ptr)++ = write_type (table, method->signature->params [j]);
                }
 
                g_ptr_array_free (methods, FALSE);
 
                if (kind == MONO_TYPE_CLASS) {
                        if (klass->parent)
-                               *((guint32 *) ptr) = write_type (table, &klass->parent->this_arg);
+                               *((guint32 *) ptr)++ = write_type (table, &klass->parent->this_arg);
                        else
-                               *((guint32 *) ptr) = 0;
-                       ptr += sizeof(guint32);         
+                               *((guint32 *) ptr)++ = 0;
                }
 
                break;
@@ -730,14 +751,12 @@ write_type (MonoDebuggerSymbolTable *table, MonoType *type)
 
        default:
                g_message (G_STRLOC ": %p - %x,%x,%x", type, type->attrs, kind, type->byref);
-
-               *((gint32 *) ptr) = -1;
-               ptr += sizeof(gint32);
+               *ptr++ = 0;
                break;
        }
 
        if (ptr - old_ptr != data_size) {
-               g_warning (G_STRLOC ": %d,%d - %d", ptr - old_ptr, data_size, kind);
+               g_warning (G_STRLOC ": %d,%d,%d - %d", ptr - old_ptr, data_size, sizeof (gpointer), kind);
                if (klass)
                        g_warning (G_STRLOC ": %s.%s", klass->name_space, klass->name);
                g_assert_not_reached ();
index 252d189f1080fbd7f70bda6320f27debd96200e3..8947f287ae775ad0e3812ed12c9f03e5c6c6dd71 100644 (file)
@@ -7,6 +7,7 @@
 #include <mono/io-layer/io-layer.h>
 
 typedef struct _MonoDebuggerBreakpointInfo     MonoDebuggerBreakpointInfo;
+typedef struct _MonoDebuggerBuiltinTypes       MonoDebuggerBuiltinTypes;
 typedef struct _MonoDebuggerSymbolTable                MonoDebuggerSymbolTable;
 typedef struct _MonoDebuggerSymbolFile         MonoDebuggerSymbolFile;
 typedef struct _MonoDebuggerSymbolFilePriv     MonoDebuggerSymbolFilePriv;
@@ -20,16 +21,58 @@ typedef enum {
        MONO_DEBUGGER_EVENT_BREAKPOINT
 } MonoDebuggerEvent;
 
+typedef enum {
+       MONO_DEBUGGER_TYPE_KIND_FUNDAMENTAL = 1,
+       MONO_DEBUGGER_TYPE_KIND_STRING,
+       MONO_DEBUGGER_TYPE_KIND_SZARRAY,
+       MONO_DEBUGGER_TYPE_KIND_ARRAY,
+       MONO_DEBUGGER_TYPE_KIND_POINTER,
+       MONO_DEBUGGER_TYPE_KIND_ENUM,
+       MONO_DEBUGGER_TYPE_KIND_OBJECT,
+       MONO_DEBUGGER_TYPE_KIND_STRUCT,
+       MONO_DEBUGGER_TYPE_KIND_CLASS
+} MonoDebuggerTypeKind;
+
 struct _MonoDebuggerBreakpointInfo {
        guint32 index;
        MonoMethodDesc *desc;
 };
 
+struct _MonoDebuggerBuiltinTypes {
+       guint32 total_size;
+       MonoDebuggerClassInfo *object_class;
+       MonoDebuggerClassInfo *byte_class;
+       MonoDebuggerClassInfo *void_class;
+       MonoDebuggerClassInfo *boolean_class;
+       MonoDebuggerClassInfo *sbyte_class;
+       MonoDebuggerClassInfo *int16_class;
+       MonoDebuggerClassInfo *uint16_class;
+       MonoDebuggerClassInfo *int32_class;
+       MonoDebuggerClassInfo *uint32_class;
+       MonoDebuggerClassInfo *int_class;
+       MonoDebuggerClassInfo *uint_class;
+       MonoDebuggerClassInfo *int64_class;
+       MonoDebuggerClassInfo *uint64_class;
+       MonoDebuggerClassInfo *single_class;
+       MonoDebuggerClassInfo *double_class;
+       MonoDebuggerClassInfo *char_class;
+       MonoDebuggerClassInfo *string_class;
+       MonoDebuggerClassInfo *enum_class;
+       MonoDebuggerClassInfo *array_class;
+};
+
 struct _MonoDebuggerSymbolTable {
        guint64 magic;
        guint32 version;
        guint32 total_size;
 
+       /*
+        * Corlib and builtin types.
+        */
+       MonoDomain *domain;
+       MonoDebuggerSymbolFile *corlib;
+       MonoDebuggerBuiltinTypes *builtin_types;
+
        /*
         * The symbol files.
         */
@@ -75,6 +118,7 @@ struct _MonoDebuggerSymbolFile {
        MonoSymbolFile *symfile;
        MonoImage *image;
        const char *image_file;
+       guint32 class_entry_size;
        /* Pointer to the malloced range table. */
        guint32 locked;
        guint32 generation;
@@ -83,7 +127,6 @@ struct _MonoDebuggerSymbolFile {
        guint32 num_range_entries;
        /* Pointer to the malloced class table. */
        MonoDebuggerClassInfo *class_table;
-       guint32 class_entry_size;
        guint32 num_class_entries;
        /* Private. */
        MonoDebuggerSymbolFilePriv *_priv;
@@ -147,24 +190,26 @@ extern MonoDebuggerIOLayer mono_debugger_io_layer;
 
 extern void (*mono_debugger_event_handler) (MonoDebuggerEvent event, gpointer data, guint32 arg);
 
-void            mono_debugger_initialize              (void);
-void            mono_debugger_cleanup                 (void);
+void            mono_debugger_initialize                  (MonoDomain *domain);
+void            mono_debugger_cleanup                     (void);
+
+void            mono_debugger_lock                        (void);
+void            mono_debugger_unlock                      (void);
+void            mono_debugger_event                       (MonoDebuggerEvent event, gpointer data, guint32 arg);
 
-void            mono_debugger_lock                    (void);
-void            mono_debugger_unlock                  (void);
-void            mono_debugger_event                   (MonoDebuggerEvent event, gpointer data, guint32 arg);
+MonoDebuggerSymbolFile   *mono_debugger_add_symbol_file   (MonoDebugHandle *handle);
+void                      mono_debugger_add_type          (MonoDebuggerSymbolFile *symfile, MonoClass *klass);
+MonoDebuggerBuiltinTypes *mono_debugger_add_builtin_types (MonoDebuggerSymbolFile *symfile);
 
-MonoDebuggerSymbolFile *mono_debugger_add_symbol_file (MonoDebugHandle *handle);
-void            mono_debugger_add_type                (MonoDebuggerSymbolFile *symfile, MonoClass *klass);
-void            mono_debugger_add_method              (MonoDebuggerSymbolFile *symfile,
-                                                      MonoDebugMethodInfo *minfo,
-                                                      MonoDebugMethodJitInfo *jit);
+void            mono_debugger_add_method                  (MonoDebuggerSymbolFile *symfile,
+                                                          MonoDebugMethodInfo *minfo,
+                                                          MonoDebugMethodJitInfo *jit);
 
-int             mono_debugger_insert_breakpoint_full  (MonoMethodDesc *desc);
-int             mono_debugger_remove_breakpoint       (int breakpoint_id);
-int             mono_debugger_insert_breakpoint       (const gchar *method_name, gboolean include_namespace);
-int             mono_debugger_method_has_breakpoint   (MonoMethod *method);
-void            mono_debugger_breakpoint_callback     (MonoMethod *method, guint32 idx);
+int             mono_debugger_insert_breakpoint_full      (MonoMethodDesc *desc);
+int             mono_debugger_remove_breakpoint           (int breakpoint_id);
+int             mono_debugger_insert_breakpoint           (const gchar *method_name, gboolean include_namespace);
+int             mono_debugger_method_has_breakpoint       (MonoMethod *method);
+void            mono_debugger_breakpoint_callback         (MonoMethod *method, guint32 idx);
 
 gpointer        mono_debugger_create_notification_function (gpointer *notification_address);
 
index b0401511282525397347636b0c87cee2cdd47826..a467ff575578429126866a396b1ab982ac63a895 100644 (file)
@@ -41,7 +41,7 @@ extern void (*mono_debugger_class_init_func) (MonoClass *klass);
  * callbacks here.
  */
 void
-mono_debug_init (MonoDebugFormat format)
+mono_debug_init (MonoDomain *domain, MonoDebugFormat format)
 {
        MonoAssembly **ass;
 
@@ -52,7 +52,7 @@ mono_debug_init (MonoDebugFormat format)
        in_the_mono_debugger = format == MONO_DEBUG_FORMAT_DEBUGGER;
 
        if (in_the_mono_debugger)
-               mono_debugger_initialize ();
+               mono_debugger_initialize (domain);
 
        mono_debugger_lock ();
 
@@ -75,51 +75,15 @@ mono_debug_init (MonoDebugFormat format)
 void
 mono_debug_init_2 (MonoAssembly *assembly)
 {
+       MonoDebugHandle *handle;
+
        mono_debug_open_image (assembly->image);
 
-       mono_debug_add_type (mono_defaults.object_class);
-       mono_debug_add_type (mono_defaults.object_class);
-       mono_debug_add_type (mono_defaults.byte_class);
-       mono_debug_add_type (mono_defaults.void_class);
-       mono_debug_add_type (mono_defaults.boolean_class);
-       mono_debug_add_type (mono_defaults.sbyte_class);
-       mono_debug_add_type (mono_defaults.int16_class);
-       mono_debug_add_type (mono_defaults.uint16_class);
-       mono_debug_add_type (mono_defaults.int32_class);
-       mono_debug_add_type (mono_defaults.uint32_class);
-       mono_debug_add_type (mono_defaults.int_class);
-       mono_debug_add_type (mono_defaults.uint_class);
-       mono_debug_add_type (mono_defaults.int64_class);
-       mono_debug_add_type (mono_defaults.uint64_class);
-       mono_debug_add_type (mono_defaults.single_class);
-       mono_debug_add_type (mono_defaults.double_class);
-       mono_debug_add_type (mono_defaults.char_class);
-       mono_debug_add_type (mono_defaults.string_class);
-       mono_debug_add_type (mono_defaults.enum_class);
-       mono_debug_add_type (mono_defaults.array_class);
-       mono_debug_add_type (mono_defaults.multicastdelegate_class);
-       mono_debug_add_type (mono_defaults.asyncresult_class);
-       mono_debug_add_type (mono_defaults.waithandle_class);
-       mono_debug_add_type (mono_defaults.typehandle_class);
-       mono_debug_add_type (mono_defaults.fieldhandle_class);
-       mono_debug_add_type (mono_defaults.methodhandle_class);
-       mono_debug_add_type (mono_defaults.monotype_class);
-       mono_debug_add_type (mono_defaults.exception_class);
-       mono_debug_add_type (mono_defaults.threadabortexception_class);
-       mono_debug_add_type (mono_defaults.thread_class);
-       mono_debug_add_type (mono_defaults.transparent_proxy_class);
-       mono_debug_add_type (mono_defaults.real_proxy_class);
-       mono_debug_add_type (mono_defaults.mono_method_message_class);
-       mono_debug_add_type (mono_defaults.appdomain_class);
-       mono_debug_add_type (mono_defaults.field_info_class);
-       mono_debug_add_type (mono_defaults.stringbuilder_class);
-       mono_debug_add_type (mono_defaults.math_class);
-       mono_debug_add_type (mono_defaults.stack_frame_class);
-       mono_debug_add_type (mono_defaults.stack_trace_class);
-       mono_debug_add_type (mono_defaults.marshal_class);
-       mono_debug_add_type (mono_defaults.iserializeable_class);
-       mono_debug_add_type (mono_defaults.serializationinfo_class);
-       mono_debug_add_type (mono_defaults.streamingcontext_class);
+       handle = _mono_debug_get_image (mono_defaults.corlib);
+       g_assert (handle);
+
+       if (handle->_priv->debugger_info)
+               mono_debugger_add_builtin_types (handle->_priv->debugger_info);
 
        mono_debugger_unlock ();
 }
index 2ee54fdf991e566f493139392705af52367611c0..ada96963dcad94e73ed53e780f4c7d90928a9233 100644 (file)
@@ -75,13 +75,13 @@ struct _MonoDebugVarInfo {
        guint32 end_scope;
 };
 
-#define MONO_DEBUGGER_VERSION                          30
+#define MONO_DEBUGGER_VERSION                          31
 #define MONO_DEBUGGER_MAGIC                            0x7aff65af4253d427
 
 extern MonoDebugFormat mono_debug_format;
 extern GHashTable *mono_debug_handles;
 
-void mono_debug_init (MonoDebugFormat format);
+void mono_debug_init (MonoDomain *domain, MonoDebugFormat format);
 void mono_debug_init_2 (MonoAssembly *assembly);
 void mono_debug_cleanup (void);
 MonoDebugDomainData *mono_debug_get_domain_data (MonoDebugHandle *handle, MonoDomain *domain);
index 0aad83bdb4f42ad84c77e18b24acab8b0d060db7..acbe22da1316c9fda5d8361ed285db4482ff3ba9 100644 (file)
@@ -641,7 +641,7 @@ mono_main (int argc, char* argv[]) {
        }
 
        if (enable_debugging)
-               mono_debug_init (MONO_DEBUG_FORMAT_MONO);
+               mono_debug_init (domain, MONO_DEBUG_FORMAT_MONO);
 
        assembly = mono_assembly_open (aname, NULL);
        if (!assembly) {