Merge pull request #1668 from alexanderkyte/bug1856
[mono.git] / mono / mini / exceptions-x86.c
old mode 100755 (executable)
new mode 100644 (file)
index 3ca3114..d7d4f72
@@ -31,7 +31,7 @@
 static gpointer signal_exception_trampoline;
 
 gpointer
-mono_x86_get_signal_exception_trampoline (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
+mono_x86_get_signal_exception_trampoline (MonoTrampInfo **info, gboolean aot);
 
 #ifdef TARGET_WIN32
 static void (*restore_stack) (void *);
@@ -109,6 +109,9 @@ mono_win32_get_handle_stackoverflow (void)
        /* return */
        x86_ret (code);
 
+       mono_arch_flush_icache (start, code - start);
+       mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL);
+
        return start;
 }
 
@@ -354,6 +357,9 @@ mono_arch_get_restore_context (MonoTrampInfo **info, gboolean aot)
                g_slist_free (unwind_ops);
        }
 
+       mono_arch_flush_icache (start, code - start);
+       mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL);
+
        return start;
 }
 
@@ -431,6 +437,9 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot)
                g_slist_free (unwind_ops);
        }
 
+       mono_arch_flush_icache (start, code - start);
+       mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL);
+
        g_assert ((code - start) < kMaxCodeSize);
        return start;
 }
@@ -463,8 +472,10 @@ mono_x86_throw_exception (mgreg_t *regs, MonoObject *exc,
 
        if (mono_object_isinst (exc, mono_defaults.exception_class)) {
                MonoException *mono_ex = (MonoException*)exc;
-               if (!rethrow)
+               if (!rethrow) {
                        mono_ex->stack_trace = NULL;
+                       mono_ex->trace_ips = NULL;
+               }
        }
 
        /* adjust eip so that it point into the call instruction */
@@ -653,6 +664,9 @@ get_throw_trampoline (const char *name, gboolean rethrow, gboolean llvm, gboolea
                g_slist_free (unwind_ops);
        }
 
+       mono_arch_flush_icache (start, code - start);
+       mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL);
+
        return start;
 }
 
@@ -706,7 +720,7 @@ mono_arch_exceptions_init (void)
  * for SEHs to behave. This requires hotfix http://support.microsoft.com/kb/976038
  * or (eventually) Windows 7 SP1.
  */
-#ifdef HOST_WIN32
+#ifdef TARGET_WIN32
        DWORD flags;
        FARPROC getter;
        FARPROC setter;
@@ -943,6 +957,9 @@ mono_x86_get_signal_exception_trampoline (MonoTrampInfo **info, gboolean aot)
                g_slist_free (unwind_ops);
        }
 
+       mono_arch_flush_icache (start, code - start);
+       mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL);
+
        return start;
 }