From ffcb4b4535f1400029f97eceb129a4154b529747 Mon Sep 17 00:00:00 2001 From: monojenkins Date: Fri, 7 Feb 2020 01:28:53 -0500 Subject: [PATCH] [merp] Add an exception type for managed exceptions (#31678) Addresses https://github.com/mono/mono/issues/18681 Co-authored-by: Alexis Christoforides --- src/mono/mono/metadata/icall.c | 3 +-- src/mono/mono/utils/mono-merp.c | 8 +++++++- src/mono/mono/utils/mono-state.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index f0c67c1..31f9db8 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -6525,8 +6525,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 = mono_get_signame (SIGTERM); + const char *signal = "MANAGED_EXCEPTION"; gboolean success = mono_merp_invoke (crashed_pid, signal, payload, &hashes); if (!success) { diff --git a/src/mono/mono/utils/mono-merp.c b/src/mono/mono/utils/mono-merp.c index cf78dbf..0da6f07 100644 --- a/src/mono/mono/utils/mono-merp.c +++ b/src/mono/mono/utils/mono-merp.c @@ -145,7 +145,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 { @@ -262,6 +263,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 (); @@ -296,6 +299,9 @@ parse_exception_type (const char *signal) if (!strcmp (signal, mono_get_signame (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/src/mono/mono/utils/mono-state.h b/src/mono/mono/utils/mono-state.h index 5a736ef..e1f87f3 100644 --- a/src/mono/mono/utils/mono-state.h +++ b/src/mono/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.7.4