2009-02-25 Zoltan Varga <vargaz@gmail.com>
+ * mini-exceptions.c (mono_handle_native_sigsegv): Implement the
+ suspend-on-sigsegv functionality.
+
+ * mini.c (mini_parse_debug_options): Add a new 'suspend-on-sigsegv' option
+ to suspend when a native SIGSEGV is received. This is useful for debugging
+ crashes which don't happen under gdb, since a live process contains more
+ information than a core file.
+
+ * mini-exceptions.c (mono_print_thread_dump): Use
+ MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX instead of platform defines.
+
+ * mini-x86.h (MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX): New define.
+
+ * mini-amd64.h (MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX): Ditto.
+
* basic-float.cs: Disable the tests which currently fail on amd64.
* tramp-amd64.c (mono_arch_nullify_class_init_trampoline): Pass a non-null
if (handling_sigsegv)
return;
+ if (mini_get_debug_options ()->suspend_on_sigsegv) {
+ fprintf (stderr, "Received SIGSEGV, suspending...");
+ while (1)
+ ;
+ }
+
/* To prevent infinite loops when the stack walk causes a crash */
handling_sigsegv = TRUE;
free (wapi_desc);
#endif
- /* FIXME: */
-#if defined(__i386__) || defined(__x86_64__)
+#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
if (!sigctx)
MONO_INIT_CONTEXT_FROM_FUNC (&ctx, mono_print_thread_dump);
else
#define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1
#define MONO_ARCH_HAVE_LIVERANGE_OPS 1
#define MONO_ARCH_HAVE_XP_UNWIND 1
+#define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1
#if defined(__linux__) && !defined(HAVE_MOVING_COLLECTOR)
#define MONO_ARCH_MONITOR_OBJECT_REG X86_EAX
#endif
debug_options.break_on_unverified = TRUE;
else if (!strcmp (arg, "no-gdb-backtrace"))
debug_options.no_gdb_backtrace = TRUE;
+ else if (!strcmp (arg, "suspend-on-sigsegv"))
+ debug_options.suspend_on_sigsegv = TRUE;
else if (!strcmp (arg, "dont-free-domains"))
mono_dont_free_domains = TRUE;
else {
fprintf (stderr, "Invalid option for the MONO_DEBUG env variable: %s\n", arg);
- fprintf (stderr, "Available options: 'handle-sigint', 'keep-delegates', 'collect-pagefault-stats', 'break-on-unverified', 'no-gdb-backtrace', 'dont-free-domains'\n");
+ fprintf (stderr, "Available options: 'handle-sigint', 'keep-delegates', 'collect-pagefault-stats', 'break-on-unverified', 'no-gdb-backtrace', 'dont-free-domains', 'suspend-on-sigsegv'\n");
exit (1);
}
}
gboolean better_cast_details;
gboolean mdb_optimizations;
gboolean no_gdb_backtrace;
+ gboolean suspend_on_sigsegv;
} MonoDebugOptions;
enum {