Index: mono/metadata/ChangeLog =================================================================== --- mono/metadata/ChangeLog (revision 55944) +++ mono/metadata/ChangeLog (working copy) @@ -1,5 +1,11 @@ 2006-01-23 Martin Baulig + * mono-debug-debugger.h (MonoDebuggerIOLayer): Removed. + + * mono-debug-debugger.c (mono_debugger_io_layer): Removed. + +2006-01-23 Martin Baulig + * mono-debug.h: Moved the prototypes of some functions which are used by the JIT here from mono-debug-debugger.h. Index: mono/metadata/mono-debug-debugger.c =================================================================== --- mono/metadata/mono-debug-debugger.c (revision 55944) +++ mono/metadata/mono-debug-debugger.c (working copy) @@ -66,17 +66,6 @@ guint32 stop; } MonoDebuggerExceptionInfo; -#ifndef PLATFORM_WIN32 - -MonoDebuggerIOLayer mono_debugger_io_layer = { - InitializeCriticalSection, DeleteCriticalSection, TryEnterCriticalSection, - EnterCriticalSection, LeaveCriticalSection, WaitForSingleObjectEx, SignalObjectAndWait, - WaitForMultipleObjectsEx, CreateSemaphore, ReleaseSemaphore, CreateThread, - GetCurrentThreadId -}; - -#endif - static int initialized = 0; void Index: mono/metadata/mono-debug-debugger.h =================================================================== --- mono/metadata/mono-debug-debugger.h (revision 55944) +++ mono/metadata/mono-debug-debugger.h (working copy) @@ -50,38 +50,7 @@ */ extern guint8 *mono_trampoline_code []; -#if !defined(__WIN32__) - /* - * Functions we export to the debugger. - */ -struct _MonoDebuggerIOLayer -{ - void (*InitializeCriticalSection) (WapiCriticalSection *section); - void (*DeleteCriticalSection) (WapiCriticalSection *section); - gboolean (*TryEnterCriticalSection) (WapiCriticalSection *section); - void (*EnterCriticalSection) (WapiCriticalSection *section); - void (*LeaveCriticalSection) (WapiCriticalSection *section); - - guint32 (*WaitForSingleObject) (gpointer handle, guint32 timeout, - gboolean alertable); - guint32 (*SignalObjectAndWait) (gpointer signal_handle, gpointer wait, - guint32 timeout, gboolean alertable); - guint32 (*WaitForMultipleObjects) (guint32 numobjects, gpointer *handles, - gboolean waitall, guint32 timeout, gboolean alertable); - - gpointer (*CreateSemaphore) (WapiSecurityAttributes *security, - gint32 initial, gint32 max, - const gunichar2 *name); - gboolean (*ReleaseSemaphore) (gpointer handle, gint32 count, gint32 *prevcount); - - gpointer (*CreateThread) (WapiSecurityAttributes *security, - guint32 stacksize, WapiThreadStart start, - gpointer param, guint32 create, guint32 *tid); - gsize (*GetCurrentThreadId) (void); -}; - -/* * There's a global data symbol called `MONO_DEBUGGER__debugger_info' which * contains pointers to global variables and functions which must be accessed * by the debugger. @@ -125,10 +94,6 @@ guint32 main_tid; }; -extern MonoDebuggerIOLayer mono_debugger_io_layer; - -#endif - extern void (*mono_debugger_event_handler) (MonoDebuggerEvent event, guint64 data, guint64 arg); void mono_debugger_initialize (gboolean use_debugger); Index: mono/mini/ChangeLog =================================================================== --- mono/mini/ChangeLog (revision 55939) +++ mono/mini/ChangeLog (working copy) @@ -1,5 +1,15 @@ 2006-01-23 Martin Baulig + * Makefile.am: Only compile debug-debugger.c on supported platforms. + + * debug-debugger.c: Kill the IO_LAYER() hack and use the io-layer + functions directly. + + * driver.c: debug-debugger.c is only available if + `MONO_DEBUGGER_SUPPORTED' is defined. + +2006-01-23 Martin Baulig + * debug-debugger.c: Only enable this on platforms where the Mono Debugger is working (x86 and x86_64). Index: mono/mini/driver.c =================================================================== --- mono/mini/driver.c (revision 55938) +++ mono/mini/driver.c (working copy) @@ -852,8 +852,13 @@ opt |= MONO_OPT_SHARED; enable_debugging = TRUE; +#ifdef MONO_DEBUGGER_SUPPORTED mono_debug_init (MONO_DEBUG_FORMAT_DEBUGGER); mono_debugger_init (); +#else + g_print ("The Mono Debugger is not supported on this platform.\n"); + return 1; +#endif } mono_set_defaults (mini_verbose, opt); @@ -967,6 +972,7 @@ mini_cleanup (domain); return 0; } else if (action == DO_DEBUGGER) { +#ifdef MONO_DEBUGGER_SUPPORTED const char *error; error = mono_check_corlib_version (); @@ -979,6 +985,9 @@ mono_debugger_main (domain, assembly, argc, argv); mini_cleanup (domain); return 0; +#else + return 1; +#endif } desc = mono_method_desc_new (mname, 0); if (!desc) { Index: mono/mini/debug-debugger.c =================================================================== --- mono/mini/debug-debugger.c (revision 55939) +++ mono/mini/debug-debugger.c (working copy) @@ -1,4 +1,4 @@ -#if defined(__i386__) || defined(__x86_64__) +#include #include #include #include @@ -11,8 +11,6 @@ #include #include -#define IO_LAYER(func) (* mono_debugger_io_layer.func) - static GPtrArray *thread_array = NULL; static gpointer main_started_cond; @@ -235,7 +233,7 @@ static void debugger_thread_manager_acquire_global_thread_lock (void) { - int tid = IO_LAYER (GetCurrentThreadId) (); + int tid = GetCurrentThreadId (); mono_debugger_notification_function ( MONO_DEBUGGER_EVENT_ACQUIRE_GLOBAL_THREAD_LOCK, 0, tid); @@ -244,7 +242,7 @@ static void debugger_thread_manager_release_global_thread_lock (void) { - int tid = IO_LAYER (GetCurrentThreadId) (); + int tid = GetCurrentThreadId (); mono_debugger_notification_function ( MONO_DEBUGGER_EVENT_RELEASE_GLOBAL_THREAD_LOCK, 0, tid); @@ -269,7 +267,7 @@ { int i, tid; - tid = IO_LAYER (GetCurrentThreadId) (); + tid = GetCurrentThreadId (); if (!thread_array) return; @@ -309,8 +307,8 @@ void mono_debugger_init (void) { - main_started_cond = IO_LAYER (CreateSemaphore) (NULL, 0, 1, NULL); - main_ready_cond = IO_LAYER (CreateSemaphore) (NULL, 0, 1, NULL); + main_started_cond = CreateSemaphore (NULL, 0, 1, NULL); + main_ready_cond = CreateSemaphore (NULL, 0, 1, NULL); mono_debugger_notification_function = mono_debugger_create_notification_function (&MONO_DEBUGGER__manager.notification_address); @@ -336,19 +334,19 @@ MainThreadArgs *main_args = (MainThreadArgs *) user_data; int retval; - MONO_DEBUGGER__manager.main_tid = IO_LAYER (GetCurrentThreadId) (); + MONO_DEBUGGER__manager.main_tid = GetCurrentThreadId (); MONO_DEBUGGER__manager.main_thread = g_new0 (MonoDebuggerThread, 1); - MONO_DEBUGGER__manager.main_thread->tid = IO_LAYER (GetCurrentThreadId) (); + MONO_DEBUGGER__manager.main_thread->tid = GetCurrentThreadId (); MONO_DEBUGGER__manager.main_thread->start_stack = &main_args; debugger_thread_manager_thread_created (MONO_DEBUGGER__manager.main_thread); - IO_LAYER (ReleaseSemaphore) (main_started_cond, 1, NULL); + ReleaseSemaphore (main_started_cond, 1, NULL); /* * Wait until everything is ready. */ - IO_LAYER (WaitForSingleObject) (main_ready_cond, INFINITE, FALSE); + WaitForSingleObject (main_ready_cond, INFINITE); retval = mono_runtime_run_main (main_args->method, main_args->argc, main_args->argv, NULL); /* @@ -384,7 +382,7 @@ main_args.argv = argv + 2; mono_thread_create (domain, main_thread_handler, &main_args); - IO_LAYER (WaitForSingleObject) (main_started_cond, INFINITE, FALSE); + WaitForSingleObject (main_started_cond, INFINITE); /* * Initialize the thread manager. @@ -405,7 +403,7 @@ /* * Signal the main thread that it can execute the managed Main(). */ - IO_LAYER (ReleaseSemaphore) (main_ready_cond, 1, NULL); + ReleaseSemaphore (main_ready_cond, 1, NULL); /* * This will never return. @@ -414,28 +412,3 @@ return 0; } - -#else /* defined(__x86__) || defined(__x86_64__) */ -/* - * We're on an unsupported platform for the debugger. - */ -#include "mini.h" - -void -mono_debugger_init (void) -{ - /* - * This method is only called when we're running inside the Mono Debugger, but - * since the debugger doesn't work on this platform, this line should never be reached. - */ - g_error ("The Mono Debugger is not supported on this platform."); -} - -int -mono_debugger_main (MonoDomain *domain, MonoAssembly *assembly, int argc, char **argv) -{ - g_assert_not_reached (); - return 0; -} - -#endif Index: mono/mini/Makefile.am =================================================================== --- mono/mini/Makefile.am (revision 55938) +++ mono/mini/Makefile.am (working copy) @@ -198,7 +198,6 @@ ssapre-mini-ops.h \ driver.c \ debug-mini.c \ - debug-debugger.c\ linear-scan.c \ aot.c \ graph.c \ @@ -222,13 +221,19 @@ test_sources2 = generics.2.cs +if MONO_DEBUGGER_SUPPORTED +mono_debugger_sources = debug-debugger.c +else +mono_debugger_sources = +endif + regtests=basic.exe arrays.exe basic-float.exe basic-math.exe basic-long.exe objects.exe basic-calls.exe iltests.exe exceptions.exe bench.exe regtests2=generics.exe common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-float.brg if X86 libmono_la_SOURCES = \ - $(common_sources) $(x86_sources) + $(common_sources) $(x86_sources) $(mono_debugger_sources) arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-x86.brg arch_built=cpu-pentium.h @@ -236,7 +241,7 @@ if AMD64 libmono_la_SOURCES = \ - $(common_sources) $(amd64_sources) + $(common_sources) $(amd64_sources) $(mono_debugger_sources) arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-amd64.brg arch_built=cpu-amd64.h endif Index: configure.in =================================================================== --- configure.in (revision 55938) +++ configure.in (working copy) @@ -1643,6 +1643,22 @@ fi fi +mono_debugger_supported=no +if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then + case "$host" in + *-*-*linux*) + mono_debugger_supported=yes + ;; + esac +fi + +AC_MSG_CHECKING(if the Mono Debugger is supported on this platform) +if test "x$mono_debugger_supported" = "xyes"; then + AC_DEFINE(MONO_DEBUGGER_SUPPORTED,1,[The Mono Debugger is supported on this platform]) +fi +AC_MSG_RESULT($mono_debugger_supported) +AM_CONDITIONAL(MONO_DEBUGGER_SUPPORTED, test x$mono_debugger_supported = xyes) + if test "x$with_tls" = "x__thread"; then AC_DEFINE(HAVE_KW_THREAD) # Pass the information to libgc Index: ChangeLog =================================================================== --- ChangeLog (revision 55938) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2006-01-23 Martin Baulig + + * configure.in: Added configure check whether the Mono Debugger is + supported on this platform; AC_DEFINE(MONO_DEBUGGER_SUPPORTED) and + also added a `MONO_DEBUGGER_SUPPORTED' automake conditional. + 2006-01-13 Raja R Harinath * data/net_2_0/machine.config: Fix a couple of typos in type names.