X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fdebug-debugger.c;h=a103595c0bf72426da06cef43e283fb219b22e1a;hb=0d40321933ac575314ab51efa3c62e8cf535a9d2;hp=23283d12675d2d1b5ebe4b668afca966c13f9d42;hpb=336d6582dfdc77a90067b61ed05b0ca0210f116d;p=mono.git diff --git a/mono/mini/debug-debugger.c b/mono/mini/debug-debugger.c index 23283d12675..a103595c0bf 100644 --- a/mono/mini/debug-debugger.c +++ b/mono/mini/debug-debugger.c @@ -1,3 +1,12 @@ +/* + * debug-debugger.c: Hard debugger support (mdb) + * + * Author: + * + * Copyright 2006-2010 Novell, Inc. + */ +#if MONO_DEBUGGER_SUPPORTED + #include #include #include @@ -20,10 +29,8 @@ * configure.in checks whether we're using the included libgc and disables the debugger if not. */ -#if !defined(MONO_DEBUGGER_SUPPORTED) -#error "Some clown tried to compile debug-debugger.c on an unsupported platform - fix Makefile.am!" -#elif !defined(USE_INCLUDED_LIBGC) -#error "Some clown #defined MONO_DEBUGGER_SUPPORTED without USE_INCLUDED_GC - fix configure.in!" +#if !defined(USE_INCLUDED_LIBGC) +#error "Inconsistency detected: #defined MONO_DEBUGGER_SUPPORTED without USE_INCLUDED_GC - fix configure.in!" #endif static guint64 debugger_compile_method (guint64 method_arg); @@ -50,22 +57,26 @@ static guint64 debugger_register_class_init_callback (guint64 image_argument, gu static void debugger_remove_class_init_callback (guint64 index, G_GNUC_UNUSED guint64 dummy); static guint64 debugger_get_method_signature (guint64 argument1, G_GNUC_UNUSED guint64 argument2); +static guint64 debugger_abort_runtime_invoke (G_GNUC_UNUSED guint64 dummy1, G_GNUC_UNUSED guint64 dummy2); + #define EXECUTABLE_CODE_BUFFER_SIZE 4096 static guint8 *debugger_executable_code_buffer = NULL; static GCThreadFunctions debugger_thread_vtable; +static guint32 debugger_thread_abort_signal = 0; + static MonoDebuggerMetadataInfo debugger_metadata_info = { sizeof (MonoDebuggerMetadataInfo), sizeof (MonoDefaults), &mono_defaults, - sizeof (MonoType), + MONO_SIZEOF_TYPE, sizeof (MonoArrayType), sizeof (MonoClass), - sizeof (MonoThread), - G_STRUCT_OFFSET (MonoThread, tid), - G_STRUCT_OFFSET (MonoThread, stack_ptr), - G_STRUCT_OFFSET (MonoThread, end_stack), + sizeof (MonoInternalThread), + G_STRUCT_OFFSET (MonoInternalThread, tid), + G_STRUCT_OFFSET (MonoInternalThread, stack_ptr), + G_STRUCT_OFFSET (MonoInternalThread, end_stack), G_STRUCT_OFFSET (MonoClass, image), G_STRUCT_OFFSET (MonoClass, instance_size), G_STRUCT_OFFSET (MonoClass, parent), @@ -120,7 +131,7 @@ MonoDebuggerInfo MONO_DEBUGGER__debugger_info = { MONO_DEBUGGER_MAGIC, MONO_DEBUGGER_MAJOR_VERSION, MONO_DEBUGGER_MINOR_VERSION, - 0, /* dummy */ + 0, /* runtime_flags */ sizeof (MonoDebuggerInfo), sizeof (MonoSymbolTable), MONO_TRAMPOLINE_NUM, @@ -167,9 +178,19 @@ MonoDebuggerInfo MONO_DEBUGGER__debugger_info = { debugger_event_handler, &_mono_debug_using_mono_debugger, - (gint32*)&_mono_debugger_interruption_request + (gint32*)&_mono_debugger_interruption_request, + + &debugger_abort_runtime_invoke, + + &debugger_thread_abort_signal }; +static guint64 +debugger_abort_runtime_invoke (G_GNUC_UNUSED guint64 dummy1, G_GNUC_UNUSED guint64 dummy2) +{ + return mono_debugger_abort_runtime_invoke (); +} + static guint64 debugger_compile_method (guint64 method_arg) { @@ -497,6 +518,8 @@ mini_debugger_init (void) debugger_executable_code_buffer = mono_global_codeman_reserve (EXECUTABLE_CODE_BUFFER_SIZE); mono_debugger_event_handler = debugger_event_handler; + debugger_thread_abort_signal = mono_thread_get_abort_signal (); + /* * Use an indirect call so gcc can't optimize it away. */ @@ -515,6 +538,13 @@ mini_debugger_init (void) (guint64) (gssize) MONO_DEBUGGER__debugger_info_ptr, 0); } +void +mini_debugger_set_attach_ok (void) +{ + debugger_thread_abort_signal = mono_thread_get_abort_signal (); + MONO_DEBUGGER__debugger_info.runtime_flags |= DEBUGGER_RUNTIME_FLAGS_ATTACH_OK; +} + typedef struct { MonoDomain *domain; @@ -581,3 +611,4 @@ mini_debugger_main (MonoDomain *domain, MonoAssembly *assembly, int argc, char * return 0; } +#endif /* MONO_DEBUGGER_SUPPORTED */