2010-02-23 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Tue, 23 Feb 2010 00:23:56 +0000 (00:23 -0000)
committerZoltan Varga <vargaz@gmail.com>
Tue, 23 Feb 2010 00:23:56 +0000 (00:23 -0000)
* 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
mono/mini/debugger-agent.c

index 772836ba444fd981c75cf35c6fdabb2001eeac57..9088f0f28f398830294fa88ec3dc1de107b67096 100755 (executable)
@@ -1,3 +1,8 @@
+2010-02-23  Zoltan Varga  <vargaz@gmail.com>
+
+       * debugger-agent.c: Add support for the caught/uncaught flags on exception
+       event requests. Bump protocol minor version.
+
 2010-02-22  Zoltan Varga  <vargaz@gmail.com>
 
        * decompose.c (mono_decompose_long_opts): Handle OP_LCONV_TO_OVF_I8 here too.
 2010-02-22  Zoltan Varga  <vargaz@gmail.com>
 
        * decompose.c (mono_decompose_long_opts): Handle OP_LCONV_TO_OVF_I8 here too.
index 0bfe5cc41223f9fba3a8ddae398e28eb601fabdb..80cda417cb207c536b38e1c1af05317416cb88f6 100644 (file)
@@ -217,7 +217,7 @@ typedef struct {
 #define HEADER_LENGTH 11
 
 #define MAJOR_VERSION 2
 #define HEADER_LENGTH 11
 
 #define MAJOR_VERSION 2
-#define MINOR_VERSION 0
+#define MINOR_VERSION 1
 
 typedef enum {
        CMD_SET_VM = 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;
                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{
 } Modifier;
 
 typedef struct{
@@ -448,6 +449,16 @@ typedef struct {
        GSList *bps;
 } SingleStepReq;
 
        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;
 /* 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*
  * 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;
 {
        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_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;
                                                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:
  *
 /*
  * 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);
 
 
        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 ();
        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 ();
 
        mono_loader_unlock ();
 
-       ei.exc = (MonoObject*)exc;
        process_event (EVENT_KIND_EXCEPTION, &ei, 0, throw_ctx, events, suspend_policy);
 }
 
        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;
 
                                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;
 
                                if (exc_class) {
                                        req->modifiers [i].data.exc_class = exc_class;