{
mono_do_signal_chaining = chain_signals;
}
+
+/**
+ * mono_set_crash_chaining:
+ *
+ * Enable/disable crash chaining due to signals. When a fatal signal is delivered and
+ * Mono doesn't know how to handle it, it will invoke the crash handler. If chrash chaining
+ * is enabled, it will first print its crash information and then try to chain with the native handler.
+ */
+void
+mono_set_crash_chaining (gboolean chain_crashes)
+{
+ mono_do_crash_chaining = chain_crashes;
+}
#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
+ }
}
static void
gboolean mono_do_x86_stack_align = TRUE;
const char *mono_build_date;
gboolean mono_do_signal_chaining;
+gboolean mono_do_crash_chaining;
static gboolean mono_using_xdebug;
static int mini_verbose = 0;
#endif
if (!ji) {
- if (mono_chain_signal (SIG_HANDLER_PARAMS))
+ if (!mono_do_crash_chaining && mono_chain_signal (SIG_HANDLER_PARAMS))
return;
mono_handle_native_sigsegv (SIGSEGV, ctx);
+ if (mono_do_crash_chaining)
+ mono_chain_signal (SIG_HANDLER_PARAMS);
}
mono_arch_handle_exception (ctx, exc);
/* The thread might no be registered with the runtime */
if (!mono_domain_get () || !jit_tls) {
- if (mono_chain_signal (SIG_HANDLER_PARAMS))
+ if (!mono_do_crash_chaining && mono_chain_signal (SIG_HANDLER_PARAMS))
return;
mono_handle_native_sigsegv (SIGSEGV, ctx);
+ if (mono_do_crash_chaining)
+ mono_chain_signal (SIG_HANDLER_PARAMS);
}
ji = mono_jit_info_table_find (mono_domain_get (), mono_arch_ip_from_context (ctx));
#else
if (!ji) {
- if (mono_chain_signal (SIG_HANDLER_PARAMS))
+ if (!mono_do_crash_chaining && mono_chain_signal (SIG_HANDLER_PARAMS))
return;
mono_handle_native_sigsegv (SIGSEGV, ctx);
+
+ if (mono_do_crash_chaining)
+ mono_chain_signal (SIG_HANDLER_PARAMS);
}
mono_arch_handle_exception (ctx, NULL);
extern gboolean mono_do_x86_stack_align;
extern const char *mono_build_date;
extern gboolean mono_do_signal_chaining;
+extern gboolean mono_do_crash_chaining;
extern gboolean mono_use_llvm;
extern gboolean mono_do_single_method_regression;
extern guint32 mono_single_method_regression_opt;