+2009-07-02 jonas echterhoff <jonas@unity3d.com>
+
+ * darwin_stop_world.c: make debugger code compile on
+ OS X.
+
+ * pthread_support.c: give mach ports to the debugger instead of pthreads,
+ as those can be iterated over from another executable.
+
2009-06-22 Neale Ferguson <neale@sinenomine.net>
* include/private/gc_locks.h: Fix typo in 390 version of GC_compare_and_exchange
# if defined(GC_DARWIN_THREADS)
+#include "mono/utils/mono-compiler.h"
+
+#ifdef MONO_DEBUGGER_SUPPORTED
+#include "include/libgc-mono-debugger.h"
+#endif
+
/* From "Inside Mac OS X - Mach-O Runtime Architecture" published by Apple
Page 49:
"The space beneath the stack pointer, where a new stack frame would normally
GC_use_mach_handler_thread = 1;
}
+#ifdef MONO_DEBUGGER_SUPPORTED
+GCThreadFunctions *gc_thread_vtable = NULL;
+
+void *
+GC_mono_debugger_get_stack_ptr (void)
+{
+ GC_thread me;
+
+ me = GC_lookup_thread (pthread_self ());
+ return &me->stop_info.stack_ptr;
+}
+#endif
+
#endif
struct thread_stop_info {
mach_port_t mach_thread;
+
+ int signal;
+ word last_stop_count; /* GC_last_stop_count value when thread */
+ /* last successfully handled a suspend */
+ /* signal. */
+ ptr_t stack_ptr; /* Valid only when stopped. */
};
struct GC_mach_thread {
t -> flags = DETACHED | MAIN_THREAD;
#ifdef MONO_DEBUGGER_SUPPORTED
if (gc_thread_vtable && gc_thread_vtable->thread_created)
- gc_thread_vtable->thread_created (pthread_self (), &t->stop_info.stack_ptr);
+# ifdef GC_DARWIN_THREADS
+ gc_thread_vtable->thread_created (mach_thread_self (), &t->stop_info.stack_ptr);
+# else
+ gc_thread_vtable->thread_created (pthread_self (), &t->stop_info.stack_ptr);
+# endif
#endif
GC_stop_init();
# endif /* IA64 */
#ifdef MONO_DEBUGGER_SUPPORTED
if (gc_thread_vtable && gc_thread_vtable->thread_created)
- gc_thread_vtable->thread_created (my_pthread, &me->stop_info.stack_ptr);
+# ifdef GC_DARWIN_THREADS
+ gc_thread_vtable->thread_created (mach_thread_self(), &me->stop_info.stack_ptr);
+# else
+ gc_thread_vtable->thread_created (my_pthread, &me->stop_info.stack_ptr);
+# endif
#endif
UNLOCK();