From 5ef6ad0ef7279120900f8ef9fc91070ff913f23e Mon Sep 17 00:00:00 2001 From: monojenkins Date: Thu, 6 Feb 2020 16:31:17 -0500 Subject: [PATCH] [merp] Add an exception type for managed exceptions (#18723) Addresses https://github.com/mono/mono/issues/18681 Co-authored-by: Alexis Christoforides --- mono/metadata/icall.c | 3 +-- mono/utils/mono-merp.c | 8 +++++++- mono/utils/mono-state.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index f0e40654b12..19001eae024 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -6515,8 +6515,7 @@ ves_icall_Mono_Runtime_SendMicrosoftTelemetry (const char *payload, guint64 port hashes.offset_free_hash = portable_hash; hashes.offset_rich_hash = unportable_hash; - // Tells mono that we want to send the HANG EXC_TYPE. - const char *signal = "SIGTERM"; + const char *signal = "MANAGED_EXCEPTION"; gboolean success = mono_merp_invoke (crashed_pid, signal, payload, &hashes); if (!success) { diff --git a/mono/utils/mono-merp.c b/mono/utils/mono-merp.c index bab766dc2a1..8e75680b38c 100644 --- a/mono/utils/mono-merp.c +++ b/mono/utils/mono-merp.c @@ -144,7 +144,8 @@ typedef enum MERP_EXC_SIGFPE = 7 , MERP_EXC_SIGTRAP = 8, MERP_EXC_SIGKILL = 9, - MERP_EXC_HANG = 10 + MERP_EXC_HANG = 10, + MERP_EXC_MANAGED_EXCEPTION = 11 } MERPExcType; typedef struct { @@ -261,6 +262,8 @@ get_merp_exctype (MERPExcType exc) return "0x04000000"; case MERP_EXC_HANG: return "0x02000000"; + case MERP_EXC_MANAGED_EXCEPTION: + return "0x05000000"; case MERP_EXC_NONE: // Exception type documented as optional, not optional g_assert_not_reached (); @@ -289,6 +292,9 @@ parse_exception_type (const char *signal) if (!strcmp (signal, "SIGTERM")) return MERP_EXC_HANG; + if (!strcmp (signal, "MANAGED_EXCEPTION")) + return MERP_EXC_MANAGED_EXCEPTION; + // FIXME: There are no other such signal // strings passed to mono_handle_native_crash at the // time of writing this diff --git a/mono/utils/mono-state.h b/mono/utils/mono-state.h index 5a736efaf49..e1f87f37b5b 100644 --- a/mono/utils/mono-state.h +++ b/mono/utils/mono-state.h @@ -18,7 +18,7 @@ #include #include -#define MONO_NATIVE_STATE_PROTOCOL_VERSION "0.0.5" +#define MONO_NATIVE_STATE_PROTOCOL_VERSION "0.0.6" typedef enum { MonoSummaryNone = 0, -- 2.11.4.GIT