2003-01-27 Zoltan Varga <vargaz@freemail.hu>
authorZoltan Varga <vargaz@gmail.com>
Mon, 27 Jan 2003 20:11:29 +0000 (20:11 -0000)
committerZoltan Varga <vargaz@gmail.com>
Mon, 27 Jan 2003 20:11:29 +0000 (20:11 -0000)
* exception.c (ves_icall_get_trace): avoid crash if the exception is
not yet thrown.

* exception.c (ves_icall_get_trace): avoid crash on unmanaged frames.

svn path=/trunk/mono/; revision=10960

mono/jit/ChangeLog
mono/jit/exception.c

index 2f7e8fe37948b888816c30bb1245b2815f6f24e1..34d60c2923755ce399b023cce195ebe1bac740c2 100644 (file)
@@ -1,3 +1,10 @@
+2003-01-27  Zoltan Varga  <vargaz@freemail.hu>
+
+       * exception.c (ves_icall_get_trace): avoid crash if the exception is 
+       not yet thrown.
+
+       * exception.c (ves_icall_get_trace): avoid crash on unmanaged frames.
+
 2003-01-26  Martin Baulig  <martin@ximian.com>
 
        * debug.c (mono_debug_init): Take a boolean argument which
index fb623774527a08ae10b145d0c730723fab4477b7..d23a4cfce5213796eb24674ea7899493057aa63f 100644 (file)
@@ -686,6 +686,11 @@ ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info
        MonoArray *res;
        MonoArray *ta = exc->trace_ips;
        int i, len;
+
+       if (ta == NULL) {
+               /* Exception is not thrown yet */
+               return mono_array_new (domain, mono_defaults.stack_frame_class, 0);
+       }
        
        len = mono_array_length (ta);
 
@@ -697,6 +702,12 @@ ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info
                gpointer ip = mono_array_get (ta, gpointer, i);
 
                ji = mono_jit_info_table_find (domain, ip);
+               if (ji == NULL) {
+                       /* Unmanaged frame */
+                       mono_array_set (res, gpointer, i, sf);
+                       continue;
+               }
+
                g_assert (ji != NULL);
 
                sf->method = mono_method_get_object (domain, ji->method, NULL);
@@ -939,3 +950,4 @@ arch_handle_exception (MonoContext *ctx, gpointer obj, gboolean test_only)
        g_assert_not_reached ();
 }
 
+