From 8bcfddd2ddd4def6ed1de3cf113b4b5ef57d18f7 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Tue, 23 Feb 2010 00:23:56 +0000 Subject: [PATCH] 2010-02-23 Zoltan Varga * debugger-agent.c: Add support for the caught/uncaught flags on exception event requests. Bump protocol minor version. svn path=/trunk/mono/; revision=152233 --- mono/mini/ChangeLog | 5 +++++ mono/mini/debugger-agent.c | 37 +++++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index 772836ba444..9088f0f28f3 100755 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,8 @@ +2010-02-23 Zoltan Varga + + * debugger-agent.c: Add support for the caught/uncaught flags on exception + event requests. Bump protocol minor version. + 2010-02-22 Zoltan Varga * decompose.c (mono_decompose_long_opts): Handle OP_LCONV_TO_OVF_I8 here too. diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index 0bfe5cc4122..80cda417cb2 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -217,7 +217,7 @@ typedef struct { #define HEADER_LENGTH 11 #define MAJOR_VERSION 2 -#define MINOR_VERSION 0 +#define MINOR_VERSION 1 typedef enum { CMD_SET_VM = 1, @@ -419,6 +419,7 @@ typedef struct { MonoClass *exc_class; /* For kind == MONO_KIND_EXCEPTION_ONLY */ MonoAssembly **assemblies; /* For kind == MONO_KIND_ASSEMBLY_ONLY */ } data; + gboolean caught, uncaught; /* For kind == MOD_KIND_EXCEPTION_ONLY */ } Modifier; typedef struct{ @@ -448,6 +449,16 @@ typedef struct { GSList *bps; } SingleStepReq; +/* + * Contains additional information for an event + */ +typedef struct { + /* For EVENT_KIND_EXCEPTION */ + MonoObject *exc; + MonoContext catch_ctx; + gboolean caught; +} EventInfo; + /* Dummy structure used for the profiler callbacks */ typedef struct { void* dummy; @@ -2474,7 +2485,7 @@ compute_frame_info (MonoInternalThread *thread, DebuggerTlsData *tls) * LOCKING: Assumes the loader lock is held. */ static GSList* -create_event_list (EventKind event, GPtrArray *reqs, MonoJitInfo *ji, MonoException *exc, int *suspend_policy) +create_event_list (EventKind event, GPtrArray *reqs, MonoJitInfo *ji, EventInfo *ei, int *suspend_policy) { int i, j; GSList *events = NULL; @@ -2508,8 +2519,12 @@ create_event_list (EventKind event, GPtrArray *reqs, MonoJitInfo *ji, MonoExcept } else if (mod->kind == MOD_KIND_THREAD_ONLY) { if (mod->data.thread != mono_thread_internal_current ()) filtered = TRUE; - } else if (mod->kind == MOD_KIND_EXCEPTION_ONLY && exc) { - if (mod->data.exc_class && !mono_class_is_assignable_from (mod->data.exc_class, exc->object.vtable->klass)) + } else if (mod->kind == MOD_KIND_EXCEPTION_ONLY && ei) { + if (mod->data.exc_class && !mono_class_is_assignable_from (mod->data.exc_class, ei->exc->vtable->klass)) + filtered = TRUE; + if (ei->caught && !mod->caught) + filtered = TRUE; + if (!ei->caught && !mod->uncaught) filtered = TRUE; } else if (mod->kind == MOD_KIND_ASSEMBLY_ONLY && ji) { int k; @@ -2565,12 +2580,6 @@ event_to_string (EventKind event) } } -typedef struct { - /* For EVENT_KIND_EXCEPTION */ - MonoObject *exc; - MonoContext catch_ctx; -} EventInfo; - /* * process_event: * @@ -3933,11 +3942,13 @@ mono_debugger_agent_handle_exception (MonoException *exc, MonoContext *throw_ctx ji = mini_jit_info_table_find (mono_domain_get (), MONO_CONTEXT_GET_IP (throw_ctx), NULL); + ei.exc = (MonoObject*)exc; + ei.caught = catch_ctx != NULL; + mono_loader_lock (); - events = create_event_list (EVENT_KIND_EXCEPTION, NULL, ji, exc, &suspend_policy); + events = create_event_list (EVENT_KIND_EXCEPTION, NULL, ji, &ei, &suspend_policy); mono_loader_unlock (); - ei.exc = (MonoObject*)exc; process_event (EVENT_KIND_EXCEPTION, &ei, 0, throw_ctx, events, suspend_policy); } @@ -4833,6 +4844,8 @@ event_commands (int command, guint8 *p, guint8 *end, Buffer *buf) if (err) return err; + req->modifiers [i].caught = decode_byte (p, &p, end); + req->modifiers [i].uncaught = decode_byte (p, &p, end); if (exc_class) { req->modifiers [i].data.exc_class = exc_class; -- 2.25.1