if (!err)
return (gpointer)-1;
+ if (*lmf && ((*lmf) != jit_tls->first_lmf) && ((gpointer)MONO_CONTEXT_GET_SP (new_ctx) >= (gpointer)(*lmf))) {
+ /*
+ * Remove any unused lmf.
+ * Mask out the lower bits which might be used to hold additional information.
+ */
+ *lmf = (gpointer)(((gsize)(*lmf)->previous_lmf) & ~(SIZEOF_VOID_P -1));
+ }
+
/* Convert between the new and the old APIs */
switch (frame.type) {
case FRAME_TYPE_MANAGED:
if (!err)
return FALSE;
+ if (*lmf && ((*lmf) != jit_tls->first_lmf) && ((gpointer)MONO_CONTEXT_GET_SP (new_ctx) >= (gpointer)(*lmf))) {
+ /*
+ * Remove any unused lmf.
+ * Mask out the lower bits which might be used to hold additional information.
+ */
+ *lmf = (gpointer)(((gsize)(*lmf)->previous_lmf) & ~(SIZEOF_VOID_P -1));
+ }
+
if (frame->ji && !frame->ji->async)
method = jinfo_get_method (frame->ji);
MonoContext initial_ctx;
MonoMethod *method;
int frame_count = 0;
- gint32 filter_idx, first_filter_idx;
+ gint32 filter_idx, first_filter_idx = 0;
int i;
MonoObject *ex_obj;
MonoObject *non_exception = NULL;
mono_ex = (MonoException*)obj;
+ if (mini_get_debug_options ()->suspend_on_exception) {
+ mono_runtime_printf_err ("Exception thrown, suspending...");
+ while (1)
+ ;
+ }
+
if (mono_object_isinst (obj, mono_defaults.exception_class)) {
mono_ex = (MonoException*)obj;
} else {
mono_profiler_exception_clause_handler (method, ei->flags, i);
jit_tls->orig_ex_ctx_set = FALSE;
MONO_CONTEXT_SET_IP (ctx, ei->handler_start);
- *(mono_get_lmf_addr ()) = lmf;
+ mono_set_lmf (lmf);
#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->exceptions_depth += frame_count;
#endif
#ifndef DISABLE_PERFCOUNTERS
mono_perfcounters->exceptions_finallys++;
#endif
- *(mono_get_lmf_addr ()) = lmf;
+ mono_set_lmf (lmf);
if (ji->from_llvm) {
/*
* LLVM compiled finally handlers follow the design
if (mono_running_on_valgrind ())
return;
- mono_thread_get_stack_bounds (&staddr, &stsize);
+ mono_thread_info_get_stack_bounds (&staddr, &stsize);
g_assert (staddr);
int count;
} PrintOverflowUserData;
+#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
static gboolean
print_overflow_stack_frame (StackFrameInfo *frame, MonoContext *ctx, gpointer data)
{
return FALSE;
}
+#endif
void
mono_handle_hard_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, guint8* fault_addr)
{
+#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
PrintOverflowUserData ud;
MonoContext mctx;
+#endif
/* we don't do much now, but we can warn the user with a useful message */
mono_runtime_printf_err ("Stack overflow: IP: %p, fault addr: %p", mono_arch_ip_from_context (ctx), fault_addr);
return FALSE;
}
+#ifndef MONO_CROSS_COMPILE
+
static gboolean handling_sigsegv = FALSE;
/*
if (mini_get_debug_options ()->suspend_on_sigsegv) {
mono_runtime_printf_err ("Received SIGSEGV, suspending...");
+#ifdef HOST_WIN32
+ while (1)
+ ;
+#else
while (1) {
- sleep (0);
+ sleep (1);
}
+#endif
}
/* To prevent infinite loops when the stack walk causes a crash */
#endif
- /*Android abort is a fluke, it doesn't abort, it triggers another segv. */
+ if (!mono_do_crash_chaining) {
+ /*Android abort is a fluke, it doesn't abort, it triggers another segv. */
#if defined (PLATFORM_ANDROID)
- exit (-1);
+ exit (-1);
#else
- abort ();
+ abort ();
#endif
+ }
+}
+
+#else
+
+void
+mono_handle_native_sigsegv (int signal, void *ctx)
+{
+ g_assert_not_reached ();
}
+#endif /* !MONO_CROSS_COMPILE */
+
static void
mono_print_thread_dump_internal (void *sigctx, MonoContext *start_ctx)
{
MonoContext ctx;
#endif
GString* text = g_string_new (0);
- char *name, *wapi_desc;
+ char *name;
+#ifndef HOST_WIN32
+ char *wapi_desc;
+#endif
GError *error = NULL;
if (thread->name) {
g_assert_not_reached ();
}
+/*
+ * mono_jinfo_get_unwind_info:
+ *
+ * Return the unwind info for JI.
+ */
+guint8*
+mono_jinfo_get_unwind_info (MonoJitInfo *ji, guint32 *unwind_info_len)
+{
+ if (ji->from_aot)
+ return mono_aot_get_unwind_info (ji, unwind_info_len);
+ else
+ return mono_get_cached_unwind_info (ji->unwind_info, unwind_info_len);
+}
+
+int
+mono_jinfo_get_epilog_size (MonoJitInfo *ji)
+{
+ MonoArchEHJitInfo *info;
+
+ info = mono_jit_info_get_arch_eh_info (ji);
+ g_assert (info);
+
+ return info->epilog_size;
+}