X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fmono-debug-debugger.c;h=981072583fd341d0601cadea1bf54d6edf05d81a;hb=cd0f05d6fd528c0f63327a908e2be2f4a9620933;hp=2af08acb134ea99b69dd89d3a93e8118c8a14136;hpb=21d1fdc48703514b1164ea2a76fc3bbf3d40871f;p=mono.git diff --git a/mono/metadata/mono-debug-debugger.c b/mono/metadata/mono-debug-debugger.c index 2af08acb134..981072583fd 100644 --- a/mono/metadata/mono-debug-debugger.c +++ b/mono/metadata/mono-debug-debugger.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -21,16 +22,6 @@ static gboolean must_reload_symtabs = FALSE; static gboolean mono_debugger_use_debugger = FALSE; static MonoObject *last_exception = NULL; -struct _MonoDebuggerMetadataInfo { - int size; - int mono_defaults_size; - MonoDefaults *mono_defaults; - int klass_field_offset; - int klass_methods_offset; - int klass_method_count_offset; - int field_info_size; -}; - void (*mono_debugger_event_handler) (MonoDebuggerEvent event, guint64 data, guint64 arg) = NULL; #define WRITE_UINT32(ptr,value) G_STMT_START { \ @@ -54,17 +45,6 @@ typedef struct { 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 @@ -108,28 +88,10 @@ mono_debugger_add_symbol_file (MonoDebugHandle *handle) g_assert (mono_debugger_use_debugger); mono_debugger_lock (); - mono_debugger_event (MONO_DEBUGGER_EVENT_ADD_MODULE, GPOINTER_TO_UINT (handle), 0); + mono_debugger_event (MONO_DEBUGGER_EVENT_ADD_MODULE, (guint64) (gsize) handle, 0); mono_debugger_unlock (); } -void -mono_debugger_add_builtin_types (MonoDebugHandle *symfile) -{ - MonoDebuggerMetadataInfo *info; - MonoClass klass; - - mono_symbol_table->corlib = symfile; - mono_symbol_table->metadata_info = info = g_new0 (MonoDebuggerMetadataInfo, 1); - - info->size = sizeof (MonoDebuggerMetadataInfo); - info->mono_defaults = &mono_defaults; - info->mono_defaults_size = sizeof (MonoDefaults); - info->klass_field_offset = (guint8*)&klass.fields - (guint8*)&klass; - info->klass_methods_offset = (guint8*)&klass.methods - (guint8*)&klass; - info->klass_method_count_offset = (guint8*)&klass.method.count - (guint8*)&klass; - info->field_info_size = sizeof (MonoClassField); -} - void mono_debugger_start_add_type (MonoDebugHandle *symfile, MonoClass *klass) { @@ -146,7 +108,8 @@ mono_debugger_event (MonoDebuggerEvent event, guint64 data, guint64 arg) void mono_debugger_cleanup (void) { - /* Do nothing yet. */ + mono_debugger_event (MONO_DEBUGGER_EVENT_FINALIZE_MANAGED_CODE, 0, 0); + mono_debugger_event_handler = NULL; } /* @@ -235,19 +198,29 @@ mono_debugger_method_has_breakpoint (MonoMethod *method) void mono_debugger_breakpoint_callback (MonoMethod *method, guint32 index) { - mono_debugger_event (MONO_DEBUGGER_EVENT_BREAKPOINT, GPOINTER_TO_UINT (method), index); + mono_debugger_event (MONO_DEBUGGER_EVENT_JIT_BREAKPOINT, (guint64) (gsize) method, index); } gboolean mono_debugger_unhandled_exception (gpointer addr, gpointer stack, MonoObject *exc) { + const gchar *name; + if (!mono_debugger_use_debugger) return FALSE; // Prevent the object from being finalized. last_exception = exc; + + name = mono_class_get_name (mono_object_get_class (exc)); + if (!strcmp (name, "ThreadAbortException")) { + MonoThread *thread = mono_thread_current (); + mono_debugger_event (MONO_DEBUGGER_EVENT_THREAD_ABORT, 0, thread->tid); + mono_thread_exit (); + } + mono_debugger_event (MONO_DEBUGGER_EVENT_UNHANDLED_EXCEPTION, - GPOINTER_TO_UINT (exc), GPOINTER_TO_UINT (addr)); + (guint64) (gsize) exc, (guint64) (gsize) addr); return TRUE; } @@ -266,8 +239,8 @@ mono_debugger_handle_exception (gpointer addr, gpointer stack, MonoObject *exc) info.exception_obj = exc; info.stop = 0; - mono_debugger_event (MONO_DEBUGGER_EVENT_EXCEPTION, GPOINTER_TO_UINT (&info), - GPOINTER_TO_UINT (addr)); + mono_debugger_event (MONO_DEBUGGER_EVENT_HANDLE_EXCEPTION, (guint64) (gsize) &info, + (guint64) (gsize) addr); } gboolean @@ -285,8 +258,8 @@ mono_debugger_throw_exception (gpointer addr, gpointer stack, MonoObject *exc) info.exception_obj = exc; info.stop = 0; - mono_debugger_event (MONO_DEBUGGER_EVENT_THROW_EXCEPTION, GPOINTER_TO_UINT (&info), - GPOINTER_TO_UINT (addr)); + mono_debugger_event (MONO_DEBUGGER_EVENT_THROW_EXCEPTION, (guint64) (gsize) &info, + (guint64) (gsize) addr); return info.stop != 0; }