#error "Some clown #defined MONO_DEBUGGER_SUPPORTED without USE_INCLUDED_GC - fix configure.in!"
#endif
-static guint64 old_debugger_insert_breakpoint (guint64 method_arg, const gchar *string_arg);
-static guint64 old_debugger_remove_breakpoint (guint64 breakpoint);
static guint64 debugger_compile_method (guint64 method_arg);
static guint64 debugger_get_virtual_method (guint64 class_arg, guint64 method_arg);
static guint64 debugger_get_boxed_object (guint64 klass_arg, guint64 val_arg);
-static guint64 old_debugger_create_string (G_GNUC_UNUSED guint64 dummy, const gchar *string_arg);
static guint64 debugger_class_get_static_field_data (guint64 klass);
-static guint64 old_debugger_lookup_class (guint64 image_argument, guint64 token_arg);
-static guint64 old_debugger_lookup_assembly (G_GNUC_UNUSED guint64 dummy, const gchar *string_arg);
-
static guint64 debugger_run_finally (guint64 argument1, guint64 argument2);
-static guint64 debugger_get_current_thread (void);
static void debugger_attach (void);
static void debugger_detach (void);
static void debugger_initialize (void);
const gchar *string_argument);
static gint64 debugger_lookup_class (guint64 image_argument, G_GNUC_UNUSED guint64 dummy,
gchar *full_name);
-static guint64 debugger_lookup_assembly (G_GNUC_UNUSED guint64 dummy, G_GNUC_UNUSED guint64 dummy2,
- const gchar *string_argument);
-static gint64 debugger_get_method_addr_or_bpt (guint64 method_argument, guint64 index);
+static guint64 debugger_insert_method_breakpoint (guint64 method_argument, guint64 index);
static void debugger_remove_method_breakpoint (G_GNUC_UNUSED guint64 dummy, guint64 index);
static void debugger_runtime_class_init (guint64 klass_arg);
G_STRUCT_OFFSET (MonoThread, tid),
G_STRUCT_OFFSET (MonoThread, stack_ptr),
G_STRUCT_OFFSET (MonoThread, end_stack),
+ G_STRUCT_OFFSET (MonoClass, image),
G_STRUCT_OFFSET (MonoClass, instance_size),
G_STRUCT_OFFSET (MonoClass, parent),
G_STRUCT_OFFSET (MonoClass, type_token),
G_STRUCT_OFFSET (MonoDefaults, enum_class),
G_STRUCT_OFFSET (MonoDefaults, array_class),
G_STRUCT_OFFSET (MonoDefaults, delegate_class),
- G_STRUCT_OFFSET (MonoDefaults, exception_class)
+ G_STRUCT_OFFSET (MonoDefaults, exception_class),
+ G_STRUCT_OFFSET (MonoMethod, klass),
+ G_STRUCT_OFFSET (MonoMethod, token),
+ G_STRUCT_OFFSET (MonoMethod, name) + sizeof (void *),
+ G_STRUCT_OFFSET (MonoMethodInflated, declaring)
};
/*
&debugger_compile_method,
&debugger_get_virtual_method,
&debugger_get_boxed_object,
- &old_debugger_insert_breakpoint,
- &old_debugger_remove_breakpoint,
&mono_debugger_runtime_invoke,
- &old_debugger_create_string,
&debugger_class_get_static_field_data,
- &old_debugger_lookup_class,
- 0,
- &old_debugger_lookup_assembly,
&debugger_run_finally,
- &debugger_get_current_thread,
&debugger_attach,
&debugger_detach,
&debugger_initialize,
&debugger_create_string,
&debugger_lookup_class,
- &debugger_lookup_assembly,
- &debugger_get_method_addr_or_bpt,
+ &debugger_insert_method_breakpoint,
&debugger_remove_method_breakpoint,
- &debugger_runtime_class_init
-};
-
-static guint64
-old_debugger_insert_breakpoint (guint64 method_argument, const gchar *string_argument)
-{
- MonoMethodDesc *desc;
-
- desc = mono_method_desc_new (string_argument, TRUE);
- if (!desc)
- return 0;
-
- return (guint64) mono_debugger_insert_breakpoint_full (desc);
-}
+ &debugger_runtime_class_init,
-static guint64
-old_debugger_remove_breakpoint (guint64 breakpoint)
-{
- return mono_debugger_remove_breakpoint (breakpoint);
-}
+ &mono_debug_debugger_version,
+ &mono_debugger_thread_table
+};
static guint64
debugger_compile_method (guint64 method_arg)
addr = mono_compile_method (method);
mono_debugger_unlock ();
- mono_debugger_notification_function (
- MONO_DEBUGGER_EVENT_METHOD_COMPILED, (guint64) (gsize) addr, 0);
-
return (guint64) (gsize) addr;
}
return (guint64) (gsize) boxed;
}
-static guint64
-old_debugger_create_string (G_GNUC_UNUSED guint64 dummy, const gchar *string_arg)
-{
- return (guint64) (gsize) mono_string_new_wrapper (string_arg);
-}
-
static guint64
debugger_create_string (G_GNUC_UNUSED guint64 dummy, G_GNUC_UNUSED guint64 dummy2,
const gchar *string_argument)
return (guint64) (gsize) mono_string_new_wrapper (string_argument);
}
-static guint64
-old_debugger_lookup_class (guint64 image_argument, guint64 token_argument)
-{
- MonoImage *image = (MonoImage *) GUINT_TO_POINTER ((gsize) image_argument);
- guint32 token = (guint32) token_argument;
- MonoClass *klass;
-
- klass = mono_class_get (image, token);
- if (klass)
- mono_class_init (klass);
-
- return (guint64) (gsize) klass;
-}
-
-static guint64
-old_debugger_lookup_assembly (G_GNUC_UNUSED guint64 dummy, const gchar *string_arg)
-{
- gint64 retval;
-
- mono_debugger_lock ();
- retval = mono_debugger_lookup_assembly (string_arg);
- mono_debugger_unlock ();
- return retval;
-}
-
static gint64
debugger_lookup_class (guint64 image_argument, G_GNUC_UNUSED guint64 dummy,
gchar *full_name)
return (gint64) (gssize) klass;
}
-static guint64
-debugger_lookup_assembly (G_GNUC_UNUSED guint64 dummy, G_GNUC_UNUSED guint64 dummy2,
- const gchar *string_argument)
-{
- gint64 retval;
-
- mono_debugger_lock ();
- retval = mono_debugger_lookup_assembly (string_argument);
- mono_debugger_unlock ();
- return retval;
-}
-
static guint64
debugger_run_finally (guint64 context_argument, G_GNUC_UNUSED guint64 dummy)
{
return (guint64) (gsize) mono_vtable_get_static_field_data (vtable);
}
-static gint64
-debugger_get_method_addr_or_bpt (guint64 method_argument, guint64 index)
+static guint64
+debugger_insert_method_breakpoint (guint64 method_argument, guint64 index)
{
MonoMethod *method = GUINT_TO_POINTER ((gsize) method_argument);
- MonoDomain *domain = mono_get_root_domain ();
- MonoJitInfo *info;
+ MonoDebugMethodAddressList *info;
- mono_domain_lock (domain);
+ mono_debugger_lock ();
if (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) {
const char *name = method->name;
}
if (!nm) {
- mono_domain_unlock (domain);
- return -1;
+ mono_debugger_unlock ();
+ return 0;
}
method = nm;
}
- if ((info = mono_internal_hash_table_lookup (&domain->jit_code_hash, method))) {
- mono_domain_unlock (domain);
- return (gint64) (gssize) info->code_start;
- }
+ info = mono_debugger_insert_method_breakpoint (method, index);
- mono_debugger_insert_method_breakpoint (method, index);
- mono_domain_unlock (domain);
- return 0;
+ mono_debugger_unlock ();
+ return (guint64) (gsize) info;
}
static void
mono_debugger_notification_function (event, data, arg);
}
-static guint64
-debugger_get_current_thread (void)
-{
- return (guint64) (gsize) mono_thread_current ();
-}
-
static void
debugger_gc_thread_created (pthread_t thread, void *stack_ptr)
{
- mono_debugger_event (MONO_DEBUGGER_EVENT_THREAD_CREATED,
+ mono_debugger_event (MONO_DEBUGGER_EVENT_GC_THREAD_CREATED,
(guint64) (gsize) stack_ptr, thread);
}
static void
debugger_gc_thread_exited (pthread_t thread, void *stack_ptr)
{
- mono_debugger_event (MONO_DEBUGGER_EVENT_THREAD_EXITED,
+ mono_debugger_event (MONO_DEBUGGER_EVENT_GC_THREAD_EXITED,
(guint64) (gsize) stack_ptr, thread);
}
mono_debugger_init ();
mono_debugger_event_handler = debugger_event_handler;
- mono_debugger_notification_function (MONO_DEBUGGER_EVENT_INITIALIZE_MANAGED_CODE, 0, 0);
-
debugger_init_threads ();
- GC_mono_debugger_add_all_threads ();
}
static void
/*
* Initialize the thread manager.
+ *
+ * NOTE: We only reference the `MONO_DEBUGGER__debugger_info_ptr' here to prevent the
+ * linker from removing the .mdb_debug_info section.
*/
mono_debugger_notification_function (MONO_DEBUGGER_EVENT_INITIALIZE_THREAD_MANAGER,
- GetCurrentThreadId (), 0);
+ (guint64) (gssize) MONO_DEBUGGER__debugger_info_ptr, 0);
}
typedef struct
main_method = mono_get_method (image, mono_image_get_entry_point (image), NULL);
/*
- * Reload symbol tables.
- *
- * NOTE: We only reference the `MONO_DEBUGGER__debugger_info_ptr' here to prevent the
- * linker from removing the .mdb_debug_info section.
+ * Initialize managed code.
*/
mono_debugger_notification_function (MONO_DEBUGGER_EVENT_INITIALIZE_MANAGED_CODE,
- (guint64) (gssize) MONO_DEBUGGER__debugger_info_ptr, 0);
- mono_debugger_unlock ();
+ (guint64) (gssize) main_method, 0);
/*
* Start the main thread and wait until it's ready.