From 2d37a163a572bf0a1bbb64a24d340f9f6b45a7fc Mon Sep 17 00:00:00 2001 From: jonas Date: Thu, 2 Jul 2009 07:59:30 +0000 Subject: [PATCH] 2009-07-02 jonas echterhoff svn path=/trunk/mono/; revision=137261 --- ChangeLog | 8 ++++++++ darwin_stop_world.c | 19 +++++++++++++++++++ include/private/darwin_stop_world.h | 6 ++++++ pthread_support.c | 12 ++++++++++-- 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58a1fcfe..f7e78a27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-07-02 jonas echterhoff + + * 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 * include/private/gc_locks.h: Fix typo in 390 version of GC_compare_and_exchange diff --git a/darwin_stop_world.c b/darwin_stop_world.c index d3b94feb..f9ba57c0 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -2,6 +2,12 @@ # 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 @@ -682,4 +688,17 @@ void GC_darwin_register_mach_handler_thread(mach_port_t thread) { 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 diff --git a/include/private/darwin_stop_world.h b/include/private/darwin_stop_world.h index f6f5314e..068e020f 100644 --- a/include/private/darwin_stop_world.h +++ b/include/private/darwin_stop_world.h @@ -10,6 +10,12 @@ 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 { diff --git a/pthread_support.c b/pthread_support.c index 11d2cd6a..46a5f1f4 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -1010,7 +1010,11 @@ void GC_thr_init() 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(); @@ -1324,7 +1328,11 @@ void * GC_start_routine_head(void * arg, void *base_addr, # 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(); -- 2.40.0