Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <martin@novell.com>2003-07-20 22:20:31 +0400
committerMartin Baulig <martin@novell.com>2003-07-20 22:20:31 +0400
commitac75fa6f72c9a612568d8880ed7c254baef837f5 (patch)
tree3a263f0c7de922167f1d67601bb8845e2825e2aa
parent08d46b09cb2759b080665f7dc0dc49cdab983500 (diff)
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. svn path=/trunk/mono/; revision=16448
-rw-r--r--mono/interpreter/interp.c2
-rw-r--r--mono/metadata/ChangeLog9
-rw-r--r--mono/metadata/mono-debug-debugger.c261
-rw-r--r--mono/metadata/mono-debug-debugger.h77
-rw-r--r--mono/metadata/mono-debug.c54
-rw-r--r--mono/metadata/mono-debug.h4
-rw-r--r--mono/mini/driver.c2
7 files changed, 223 insertions, 186 deletions
diff --git a/mono/interpreter/interp.c b/mono/interpreter/interp.c
index 278ce6faeb0..6dec06cbfc6 100644
--- a/mono/interpreter/interp.c
+++ b/mono/interpreter/interp.c
@@ -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);
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog
index 0cfe275847c..ffb1a1d5fef 100644
--- a/mono/metadata/ChangeLog
+++ b/mono/metadata/ChangeLog
@@ -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
diff --git a/mono/metadata/mono-debug-debugger.c b/mono/metadata/mono-debug-debugger.c
index 918370cd785..6b944f90544 100644
--- a/mono/metadata/mono-debug-debugger.c
+++ b/mono/metadata/mono-debug-debugger.c
@@ -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 ();
diff --git a/mono/metadata/mono-debug-debugger.h b/mono/metadata/mono-debug-debugger.h
index 252d189f108..8947f287ae7 100644
--- a/mono/metadata/mono-debug-debugger.h
+++ b/mono/metadata/mono-debug-debugger.h
@@ -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,17 +21,59 @@ 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.
*/
guint32 num_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);
diff --git a/mono/metadata/mono-debug.c b/mono/metadata/mono-debug.c
index b0401511282..a467ff57557 100644
--- a/mono/metadata/mono-debug.c
+++ b/mono/metadata/mono-debug.c
@@ -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 ();
}
diff --git a/mono/metadata/mono-debug.h b/mono/metadata/mono-debug.h
index 2ee54fdf991..ada96963dca 100644
--- a/mono/metadata/mono-debug.h
+++ b/mono/metadata/mono-debug.h
@@ -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);
diff --git a/mono/mini/driver.c b/mono/mini/driver.c
index 0aad83bdb4f..acbe22da131 100644
--- a/mono/mini/driver.c
+++ b/mono/mini/driver.c
@@ -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) {