2004-10-14 Joe Shaw <joeshaw@novell.com>
[mono.git] / mono / mini / exceptions-s390x.c
index 0b4c920e084c37a9d42df6fd36b53e226eb638cb..5ddd5822aa445ed540447f897f33bfc01801a1fb 100644 (file)
@@ -480,6 +480,10 @@ throw_exception (MonoObject *exc, unsigned long ip, unsigned long sp,
        MONO_CONTEXT_SET_BP (&ctx, sp);
        MONO_CONTEXT_SET_IP (&ctx, ip);
        
+       if (mono_object_isinst (exc, mono_defaults.exception_class)) {
+               MonoException *mono_ex = (MonoException*)exc;
+               mono_ex->stack_trace = NULL;
+       }
        mono_arch_handle_exception (&ctx, exc, FALSE);
        setcontext(&ctx);
 
@@ -856,7 +860,7 @@ ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info
 /*------------------------------------------------------------------*/
 
 void
-mono_jit_walk_stack (MonoStackWalk func, gpointer user_data) {
+mono_jit_walk_stack (MonoStackWalk func, gboolean do_il_offset, gpointer user_data) {
        MonoDomain *domain = mono_domain_get ();
        MonoJitTlsData *jit_tls = TlsGetValue (mono_jit_tls_id);
        MonoLMF *lmf = jit_tls->lmf;
@@ -878,7 +882,7 @@ mono_jit_walk_stack (MonoStackWalk func, gpointer user_data) {
                if (ji == (gpointer)-1)
                        return;
 
-               il_offset = mono_debug_il_offset_from_address (ji->method, native_offset, domain);
+               il_offset = do_il_offset ? mono_debug_il_offset_from_address (ji->method, native_offset, domain): -1;
 
                if (func (ji->method, native_offset, il_offset, managed, user_data))
                        return;
@@ -1028,7 +1032,7 @@ mono_arch_handle_exception (void *uc, gpointer obj, gboolean test_only)
                        if (test_only && ji->method->wrapper_type != MONO_WRAPPER_RUNTIME_INVOKE && mono_ex) {
                                char *tmp, *strace;
 
-                               trace_ips = g_list_append (trace_ips, MONO_CONTEXT_GET_IP (ctx));
+                               trace_ips = g_list_prepend (trace_ips, MONO_CONTEXT_GET_IP (ctx));
 
                                if (!mono_ex->stack_trace)
                                        strace = g_strdup ("");
@@ -1059,8 +1063,10 @@ mono_arch_handle_exception (void *uc, gpointer obj, gboolean test_only)
                                                    ((ei->flags == MONO_EXCEPTION_CLAUSE_FILTER &&
                                                      call_filter (ctx, ei->data.filter, obj)))) {
                                                        if (test_only) {
-                                                               if (mono_ex)
+                                                               if (mono_ex) {
+                                                                       trace_ips = g_list_reverse (trace_ips);
                                                                        mono_ex->trace_ips = glist_to_array (trace_ips);
+                                                               }
                                                                g_list_free (trace_ips);
                                                                g_free (trace);
                                                                return TRUE;
@@ -1103,8 +1109,10 @@ mono_arch_handle_exception (void *uc, gpointer obj, gboolean test_only)
                                jit_tls->abort_func (obj);
                                g_assert_not_reached ();
                        } else {
-                               if (mono_ex)
+                               if (mono_ex) {
+                                       trace_ips = g_list_reverse (trace_ips);
                                        mono_ex->trace_ips = glist_to_array (trace_ips);
+                               }
                                g_list_free (trace_ips);
                                return FALSE;
                        }