Author: martin
Date: 2006-04-25 08:00:02 -0400 (Tue, 25 Apr 2006)
New Revision: 59841
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/mono-debug.h
trunk/mono/mono/metadata/threads.c
trunk/mono/mono/metadata/threads.h
Log:
2006-04-25 Martin Baulig <[EMAIL PROTECTED]>
* mono-debug.h (MONO_DEBUGGER_VERSION): Bump to 56.
* threads.c (mono_thread_attach): Set `thread->stack_ptr' and call
debugger_thread_created().
(debugger_gc_push_all_stacks): Don't handle the main thread in any
special way.
(mono_debugger_init_threads): Removed the `main_thread_stack' arg.
(mono_debugger_finalize_threads): New function; undo the effects
of mono_debugger_init_threads().
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2006-04-25 11:51:37 UTC (rev 59840)
+++ trunk/mono/mono/metadata/ChangeLog 2006-04-25 12:00:02 UTC (rev 59841)
@@ -1,3 +1,15 @@
+2006-04-25 Martin Baulig <[EMAIL PROTECTED]>
+
+ * mono-debug.h (MONO_DEBUGGER_VERSION): Bump to 56.
+
+ * threads.c (mono_thread_attach): Set `thread->stack_ptr' and call
+ debugger_thread_created().
+ (debugger_gc_push_all_stacks): Don't handle the main thread in any
+ special way.
+ (mono_debugger_init_threads): Removed the `main_thread_stack' arg.
+ (mono_debugger_finalize_threads): New function; undo the effects
+ of mono_debugger_init_threads().
+
2006-04-24 Zoltan Varga <[EMAIL PROTECTED]>
* image.c (mono_image_close): Tidy up trace messages.
Modified: trunk/mono/mono/metadata/mono-debug.h
===================================================================
--- trunk/mono/mono/metadata/mono-debug.h 2006-04-25 11:51:37 UTC (rev
59840)
+++ trunk/mono/mono/metadata/mono-debug.h 2006-04-25 12:00:02 UTC (rev
59841)
@@ -177,7 +177,7 @@
guint32 end_scope;
};
-#define MONO_DEBUGGER_VERSION 55
+#define MONO_DEBUGGER_VERSION 56
#define MONO_DEBUGGER_MAGIC 0x7aff65af4253d427ULL
extern MonoSymbolTable *mono_symbol_table;
Modified: trunk/mono/mono/metadata/threads.c
===================================================================
--- trunk/mono/mono/metadata/threads.c 2006-04-25 11:51:37 UTC (rev 59840)
+++ trunk/mono/mono/metadata/threads.c 2006-04-25 12:00:02 UTC (rev 59841)
@@ -447,6 +447,7 @@
thread->handle=thread_handle;
thread->tid=tid;
+ thread->stack_ptr = &tid;
MONO_OBJECT_SETREF (thread, synch_lock, mono_object_new (domain,
mono_defaults.object_class));
THREAD_DEBUG (g_message ("%s: Attached thread ID %"G_GSIZE_FORMAT"
(handle %p)", __func__, tid, thread_handle));
@@ -458,6 +459,8 @@
SET_CURRENT_OBJECT (thread);
mono_domain_set (domain, TRUE);
+ debugger_thread_created (thread);
+
thread_adjust_static_data (thread);
if (mono_thread_attach_cb) {
@@ -2817,10 +2820,6 @@
#if MONO_DEBUGGER_SUPPORTED
-static guint64 debugger_main_thread_id = -1;
-static gpointer debugger_main_thread_stack_ptr = NULL;
-static gpointer debugger_main_thread_end_stack = NULL;
-
extern void GC_push_all_stack (gpointer b, gpointer t);
static void
@@ -2836,8 +2835,10 @@
end_stack = (thread->tid == GetCurrentThreadId ()) ? &key :
thread->end_stack;
- if (!end_stack || !thread->stack_ptr)
+ if (!end_stack || !thread->stack_ptr) {
+ g_warning (G_STRLOC ": Cannot push stack of thread %Lx",
thread->tid);
return;
+ }
GC_push_all_stack (end_stack, thread->stack_ptr);
}
@@ -2848,11 +2849,6 @@
static void
debugger_gc_push_all_stacks (void)
{
- gpointer end_stack = (debugger_main_thread_id == GetCurrentThreadId ())
?
- &end_stack : debugger_main_thread_end_stack;
-
- GC_push_all_stack (end_stack, debugger_main_thread_stack_ptr);
-
if (threads != NULL)
mono_g_hash_table_foreach (threads, debugger_gc_push_stack,
NULL);
}
@@ -2891,30 +2887,46 @@
debugger_gc_start_world
};
+static GCThreadFunctions *old_gc_thread_vtable = NULL;
+
/**
* mono_debugger_init_threads:
*
* This is used when running inside the Mono Debugger.
*/
void
-mono_debugger_init_threads (gpointer main_thread_stack)
+mono_debugger_init_threads (void)
{
+ old_gc_thread_vtable = gc_thread_vtable;
gc_thread_vtable = &debugger_thread_vtable;
+ debugger_thread_created (mono_thread_current ());
+}
- debugger_main_thread_id = GetCurrentThreadId ();
- debugger_main_thread_stack_ptr = main_thread_stack;
-
- mono_debugger_event (MONO_DEBUGGER_EVENT_THREAD_CREATED,
- (guint64) (gsize) &debugger_main_thread_end_stack,
- debugger_main_thread_id);
+/**
+ * mono_debugger_finalize_threads:
+ *
+ * This is used when running inside the Mono Debugger.
+ * Undo the effects of mono_debugger_init_threads(); this is called
+ * prior to detaching from a process.
+ */
+void
+mono_debugger_finalize_threads (void)
+{
+ gc_thread_vtable = old_gc_thread_vtable;
}
#else /* WITH_INCLUDED_LIBGC */
void
-mono_debugger_init_threads (gpointer main_thread_stack)
+mono_debugger_init_threads (void)
{
g_assert_not_reached ();
}
+void
+mono_debugger_finalize_threads (void)
+{
+ g_assert_not_reached ();
+}
+
#endif
Modified: trunk/mono/mono/metadata/threads.h
===================================================================
--- trunk/mono/mono/metadata/threads.h 2006-04-25 11:51:37 UTC (rev 59840)
+++ trunk/mono/mono/metadata/threads.h 2006-04-25 12:00:02 UTC (rev 59841)
@@ -64,7 +64,8 @@
extern void mono_thread_force_interruption_checkpoint (void);
extern gint32* mono_thread_interruption_request_flag (void);
extern void mono_debugger_create_all_threads (void);
-extern void mono_debugger_init_threads (gpointer main_thread_stack);
+extern void mono_debugger_init_threads (void);
+extern void mono_debugger_finalize_threads (void);
G_END_DECLS
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches