mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 01:41:18 -10:00
Add new public API function mono_set_crash_chaining.
mono_set_crash_chaining tells mono to chain crash signals instead of just running the next one. This allows us to get the crash info from both mono and the native system.
This commit is contained in:
1 parent
199edbc851
commit
8ffc4070a9
5 files changed
+33
-6
No files matched your search
@@ -2253,3 +2253,16 @@ mono_set_signal_chaining (gboolean chain_signals)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -30,6 +30,9 @@ mono_jit_set_trace_options (const char* options);
|
||||
MONO_API void
|
||||
mono_set_signal_chaining (mono_bool chain_signals);
|
||||
|
||||
MONO_API void
|
||||
mono_set_crash_chaining (mono_bool chain_signals);
|
||||
|
||||
MONO_API void
|
||||
mono_jit_set_aot_only (mono_bool aot_only);
|
||||
|
||||
|
||||
@@ -2334,12 +2334,14 @@ mono_handle_native_sigsegv (int signal, void *ctx)
|
||||
|
||||
#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
|
||||
|
||||
+11
-3
@@ -101,6 +101,7 @@ int mono_break_at_bb_bb_num;
|
||||
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;
|
||||
|
||||
@@ -6753,10 +6754,12 @@ SIG_HANDLER_FUNC (, mono_sigfpe_signal_handler)
|
||||
#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);
|
||||
@@ -6804,9 +6807,11 @@ SIG_HANDLER_FUNC (, mono_sigsegv_signal_handler)
|
||||
|
||||
/* 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));
|
||||
@@ -6845,10 +6850,13 @@ SIG_HANDLER_FUNC (, mono_sigsegv_signal_handler)
|
||||
#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);
|
||||
|
||||
@@ -526,6 +526,7 @@ extern gboolean mono_dont_free_global_codeman;
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user