#endif
if (mono_dump_start ())
- mono_handle_native_crash (mono_get_signame (SIGSEGV), NULL, NULL, NULL);
+ mono_handle_native_crash (mono_get_signame (SIGSEGV), NULL, NULL);
return EXCEPTION_CONTINUE_SEARCH;
}
if (!ji || (!stack_ovf && !nullref)) {
if (mono_dump_start ())
- mono_handle_native_crash (mono_get_signame (SIGSEGV), ctx, NULL, NULL);
+ mono_handle_native_crash (mono_get_signame (SIGSEGV), ctx, NULL);
// if couldn't dump or if mono_handle_native_crash returns, abort
abort ();
}
}
if (!ji)
if (mono_dump_start ())
- mono_handle_native_crash (mono_get_signame (SIGSEGV), (MonoContext*)sigctx, siginfo, sigctx);
+ mono_handle_native_crash (mono_get_signame (SIGSEGV), (MonoContext*)sigctx, siginfo);
/* setup a call frame on the real stack so that control is returned there
* and exception handling can continue.
* The frame looks like:
}
#endif
if (mono_dump_start ())
- mono_handle_native_crash (mono_get_signame (SIGSEGV), NULL, NULL, NULL);
+ mono_handle_native_crash (mono_get_signame (SIGSEGV), NULL, NULL);
return EXCEPTION_CONTINUE_SEARCH;
}
MonoContext mctx;
mono_sigctx_to_monoctx (sigctx, &mctx);
if (mono_dump_start ())
- mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, siginfo, sigctx);
+ mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, siginfo);
else
abort ();
}
* printing diagnostic information and aborting.
*/
void
-mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, void *context)
+mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info)
{
MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
sigemptyset (&sa.sa_mask);
sa.sa_flags = 0;
- /* Mono has crashed - remove our handlers except SIGTERM, which is used by crash reporting */
- /* TODO: Combine with mono_runtime_cleanup_handlers (but with an option to not de-allocate anything) */
- if (mini_debug_options.handle_sigint) {
- g_assert (sigaction (SIGINT, &sa, NULL) != -1);
- }
-
+ /* Remove our SIGABRT handler */
g_assert (sigaction (SIGABRT, &sa, NULL) != -1);
- g_assert (sigaction (SIGFPE, &sa, NULL) != -1);
- g_assert (sigaction (SIGSYS, &sa, NULL) != -1);
- g_assert (sigaction (SIGSEGV, &sa, NULL) != -1);
- g_assert (sigaction (SIGQUIT, &sa, NULL) != -1);
- g_assert (sigaction (SIGBUS, &sa, NULL) != -1);
+
+ /* On some systems we get a SIGILL when calling abort (), because it might
+ * fail to raise SIGABRT */
g_assert (sigaction (SIGILL, &sa, NULL) != -1);
+
+ /* Remove SIGCHLD, it uses the finalizer thread */
g_assert (sigaction (SIGCHLD, &sa, NULL) != -1);
+
+ /* Remove SIGQUIT, we are already dumping threads */
g_assert (sigaction (SIGQUIT, &sa, NULL) != -1);
#endif
g_async_safe_printf ("=================================================================\n");
}
- mono_post_native_crash_handler (signal, mctx, info, mono_do_crash_chaining, context);
+ mono_post_native_crash_handler (signal, mctx, info, mono_do_crash_chaining);
}
#else
void
-mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, void *context)
+mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info)
{
g_assert_not_reached ();
}
return;
mono_sigctx_to_monoctx (ctx, &mctx);
if (mono_dump_start ())
- mono_handle_native_crash (mono_get_signame (info->si_signo), &mctx, info, ctx);
+ mono_handle_native_crash (mono_get_signame (info->si_signo), &mctx, info);
else
abort ();
}
// running. Returns FALSE on unrecoverable error.
if (mono_dump_start ()) {
// Process was killed from outside since crash reporting wasn't running yet.
- mono_handle_native_crash (mono_get_signame (info->si_signo), &mctx, NULL, ctx);
+ mono_handle_native_crash (mono_get_signame (info->si_signo), &mctx, NULL);
} else {
// Crash reporting already running and we got a second SIGTERM from as part of thread-summarizing
if (!mono_threads_summarize_execute (&mctx, &output, &hashes, FALSE, NULL, 0))
}
void
-mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining, void *context)
+mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining)
{
if (!crash_chaining) {
/*Android abort is a fluke, it doesn't abort, it triggers another segv. */
abort ();
#endif
}
- mono_chain_signal (info->si_signo, info, context);
-
- // we remove Mono's signal handlers from crashing signals in mono_handle_native_crash(), so re-raising will now allow the OS to handle the crash
- // TODO: perhaps we can always use this to abort, instead of explicit exit()/abort() as we do above
- raise (info->si_signo);
}
#endif /* !MONO_CROSS_COMPILE */
mono_sigctx_to_monoctx (ctx, &mctx);
if (mono_dump_start ())
- mono_handle_native_crash (mono_get_signame (SIGFPE), &mctx, info, ctx);
- goto exit;
+ mono_handle_native_crash (mono_get_signame (SIGFPE), &mctx, info);
+ if (mono_do_crash_chaining) {
+ mono_chain_signal (MONO_SIG_HANDLER_PARAMS);
+ goto exit;
+ }
}
mono_arch_handle_exception (ctx, exc);
mono_sigctx_to_monoctx (ctx, &mctx);
if (mono_dump_start ())
#if defined(HAVE_SIG_INFO) && !defined(HOST_WIN32) // info is a siginfo_t
- mono_handle_native_crash (mono_get_signame (info->si_signo), &mctx, info, ctx);
+ mono_handle_native_crash (mono_get_signame (info->si_signo), &mctx, info);
#else
- mono_handle_native_crash (mono_get_signame (SIGTERM), &mctx, info, ctx);
+ mono_handle_native_crash (mono_get_signame (SIGTERM), &mctx, info);
#endif
+ if (mono_do_crash_chaining) {
+ mono_chain_signal (MONO_SIG_HANDLER_PARAMS);
+ return;
+ }
}
#if defined(MONO_ARCH_USE_SIGACTION) || defined(HOST_WIN32)
if (!mono_do_crash_chaining && mono_chain_signal (MONO_SIG_HANDLER_PARAMS))
return;
if (mono_dump_start())
- mono_handle_native_crash (mono_get_signame (signo), &mctx, info, ctx);
+ mono_handle_native_crash (mono_get_signame (signo), &mctx, info);
+ if (mono_do_crash_chaining) {
+ mono_chain_signal (MONO_SIG_HANDLER_PARAMS);
+ return;
+ }
}
#endif
} else {
// FIXME: This shouldn't run on the altstack
if (mono_dump_start ())
- mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, info, ctx);
+ mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, info);
}
#endif
}
return;
if (mono_dump_start ())
- mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, (MONO_SIG_HANDLER_INFO_TYPE*)info, ctx);
+ mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, (MONO_SIG_HANDLER_INFO_TYPE*)info);
+
+ if (mono_do_crash_chaining) {
+ mono_chain_signal (MONO_SIG_HANDLER_PARAMS);
+ return;
+ }
}
if (mono_is_addr_implicit_null_check (fault_addr)) {
mono_arch_handle_exception (ctx, NULL);
} else {
if (mono_dump_start ())
- mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, (MONO_SIG_HANDLER_INFO_TYPE*)info, ctx);
+ mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, (MONO_SIG_HANDLER_INFO_TYPE*)info);
+ if (mono_do_crash_chaining) {
+ mono_chain_signal (MONO_SIG_HANDLER_PARAMS);
+ return;
+ }
}
#endif
}
mono_dump_native_crash_info (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info);
void
-mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining, void *context);
+mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining);
gboolean
mono_is_addr_implicit_null_check (void *addr);
}
void
-mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining, void *context)
+mono_post_native_crash_handler (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining)
{
if (!crash_chaining)
abort ();
void mono_exceptions_init (void);
gboolean mono_handle_exception (MonoContext *ctx, gpointer obj);
-void mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo, void *context);
+void mono_handle_native_crash (const char *signal, MonoContext *mctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo);
MONO_API void mono_print_thread_dump (void *sigctx);
MONO_API void mono_print_thread_dump_from_ctx (MonoContext *ctx);
void mono_walk_stack_with_ctx (MonoJitStackWalk func, MonoContext *start_ctx, MonoUnwindOptions unwind_options, void *user_data);