Skip to content

Commit

Permalink
[mono] Remove MERP crash reporting (#57641)
Browse files Browse the repository at this point in the history
* Remove MERP crash reporting

   Not used in any .NET 7 mono scenario

* whitespace

* remove dead code in debugger-agent
  • Loading branch information
lambdageek authored Aug 19, 2021
1 parent a169ca9 commit 0c90347
Show file tree
Hide file tree
Showing 26 changed files with 17 additions and 3,754 deletions.
2 changes: 0 additions & 2 deletions src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS")
set(PTHREAD_POINTER_ID 1)
set(USE_MACH_SEMA 1)
set(DISABLE_EXECUTABLES 1)
set(DISABLE_CRASH_REPORTING 1)
set(ENABLE_MONOTOUCH 1)
add_definitions("-DSMALL_CONFIG")
add_definitions("-D_XOPEN_SOURCE")
Expand Down Expand Up @@ -235,7 +234,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(HOST_WIN32 1)
set(EXE_SUFFIX ".exe")
set(DISABLE_CRASH_REPORTING 1)
set(HOST_NO_SYMLINKS 1)
set(MONO_KEYWORD_THREAD "__declspec (thread)")
set(MONO_ZERO_LEN_ARRAY 1)
Expand Down
6 changes: 0 additions & 6 deletions src/mono/cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1019,9 +1019,6 @@
/* Enable private types checked build */
#cmakedefine ENABLE_CHECKED_BUILD_PRIVATE_TYPES 1

/* Enable private types checked build */
#cmakedefine ENABLE_CHECKED_BUILD_CRASH_REPORTING 1

/* Enable EventPipe library support */
#cmakedefine ENABLE_PERFTRACING 1

Expand All @@ -1043,9 +1040,6 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H 1

/* Disable crash reporting subsystem */
#cmakedefine DISABLE_CRASH_REPORTING 1

/* Enable lazy gc thread creation by the embedding host */
#cmakedefine LAZY_GC_THREAD_CREATION 1

Expand Down
2 changes: 0 additions & 2 deletions src/mono/cmake/defines-todo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@
#option (ENABLE_CHECKED_BUILD_METADATA "Enable metadata checked build")
#option (ENABLE_CHECKED_BUILD_THREAD "Enable thread checked build")
#option (ENABLE_CHECKED_BUILD_PRIVATE_TYPES "Enable private types checked build")
#option (ENABLE_CHECKED_BUILD_CRASH_REPORTING "Enable private types checked build")
#option (HAVE_BTLS "BoringTls is supported")
#option (ENABLE_JIT_DUMP "Enable jit dump support on Linux")
#option (DISABLE_CRASH_REPORTING)
#option (ENABLE_CXX)
#option (STATIC_ICU)
1 change: 0 additions & 1 deletion src/mono/cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ option (DISABLE_SGEN_BINARY_PROTOCOL "Disable binary protocol logging in SGEN")
option (DISABLE_PROCESSES "Disable process support")
option (DISABLE_EVENTPIPE "Disable EventPipe support")
option (DISABLE_EXECUTABLES "Disable the build of the runtime executables")
option (DISABLE_CRASH_REPORTING "Disable crash reporting subsystem")
option (DISABLE_ICALL_TABLES "Enable separate icall table library")
option (DISABLE_QCALLS "Disable support for QCalls")
option (DISABLE_LOG_DEST "Disable MONO_LOG_DEST support")
Expand Down
2 changes: 0 additions & 2 deletions src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@
<_MonoCMakeArgs Include="-DENABLE_MINIMAL=jit,sgen_major_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,sgen_toggleref,sgen_debug_helpers,sgen_binary_protocol,logging,shared_perfcounters,interpreter,threads,qcalls$(_MonoMinimal)"/>
<_MonoCMakeArgs Include="-DENABLE_INTERP_LIB=1"/>
<_MonoCMakeArgs Include="-DDISABLE_ICALL_TABLES=1"/>
<_MonoCMakeArgs Include="-DDISABLE_CRASH_REPORTING=1"/>
<_MonoCMakeArgs Include="-DENABLE_ICALL_EXPORT=1"/>
<_MonoCMakeArgs Include="-DENABLE_LAZY_GC_THREAD_CREATION=1"/>
<_MonoCMakeArgs Include="-DENABLE_LLVM_RUNTIME=1"/>
Expand Down Expand Up @@ -384,7 +383,6 @@
<_MonoCMakeArgs Condition="'$(Platform)' == 'x64'" Include="-DANDROID_ABI=x86_64" />
<_MonoCMakeArgs Include="-DENABLE_MINIMAL=ssa,logging" />
<_MonoCMakeArgs Include="-DENABLE_SIGALTSTACK=1"/>
<_MonoCMakeArgs Include="-DDISABLE_CRASH_REPORTING=1"/>

<_MonoCFLAGS Condition="'$(Platform)' == 'arm'" Include="-march=armv7-a" />
<_MonoCFLAGS Condition="'$(Platform)' == 'arm'" Include="-mtune=cortex-a8" />
Expand Down
62 changes: 1 addition & 61 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,6 @@ typedef struct {
char *category, *message;
/* For EVENT_KIND_TYPE_LOAD */
MonoClass *klass;
/* For EVENT_KIND_CRASH */
char *dump;
MonoStackHash *hashes;
} EventInfo;

typedef struct {
Expand Down Expand Up @@ -3632,9 +3629,7 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx
buffer_add_int (&buf, mono_environment_exitcode_get ());
break;
case EVENT_KIND_CRASH: {
EventInfo *ei = (EventInfo *)arg;
buffer_add_long (&buf, ei->hashes->offset_free_hash);
buffer_add_string (&buf, ei->dump);
g_assert_not_reached ();
break;
}
case EVENT_KIND_EXCEPTION: {
Expand Down Expand Up @@ -4706,60 +4701,6 @@ ss_clear_for_assembly (SingleStepReq *req, MonoAssembly *assembly)
}
}

/*
* This takes a lot of locks and stuff. Do this at the end, after
* other things have dumped us, so that getting stuck here won't
* prevent seeing other crash information
*/
static void
mono_debugger_agent_send_crash (char *json_dump, MonoStackHash *hashes, int pause)
{
MONO_ENTER_GC_UNSAFE;
#ifndef DISABLE_CRASH_REPORTING
int suspend_policy;
GSList *events;
EventInfo ei;

if (!agent_config.enabled)
return;

// Don't send the event if the client doesn't expect it
if (!CHECK_PROTOCOL_VERSION (2, 49))
return;

// It doesn't make sense to wait for lldb/gdb to finish if we're not
// actually enabled. Therefore we do the wait here.
sleep (pause);

// Don't heap allocate when we can avoid it
EventRequest request;
memset (&request, 0, sizeof (request));
request.event_kind = EVENT_KIND_CRASH;

gpointer pdata [1];
pdata [0] = &request;
GPtrArray array;
memset (&array, 0, sizeof (array));
array.pdata = pdata;
array.len = 1;

mono_loader_lock ();
events = create_event_list (EVENT_KIND_CRASH, &array, NULL, NULL, &suspend_policy);
mono_loader_unlock ();

ei.dump = json_dump;
ei.hashes = hashes;

g_assert (events != NULL);

process_event (EVENT_KIND_CRASH, &ei, 0, NULL, events, suspend_policy);

// Don't die before it is sent.
sleep (4);
#endif
MONO_EXIT_GC_UNSAFE;
}

/*
* Called from metadata by the icall for System.Diagnostics.Debugger:Log ().
*/
Expand Down Expand Up @@ -10354,7 +10295,6 @@ debugger_agent_add_function_pointers(MonoComponentDebugger* fn_table)
fn_table->user_break = mono_dbg_debugger_agent_user_break;
fn_table->debug_log = debugger_agent_debug_log;
fn_table->debug_log_is_enabled = debugger_agent_debug_log_is_enabled;
fn_table->send_crash = mono_debugger_agent_send_crash;
fn_table->transport_handshake = debugger_agent_transport_handshake;
fn_table->send_enc_delta = send_enc_delta;
}
Expand Down
9 changes: 0 additions & 9 deletions src/mono/mono/component/debugger-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ stub_debugger_single_step_from_context (MonoContext *ctx);
static void
stub_debugger_breakpoint_from_context (MonoContext *ctx);

static void
stub_debugger_send_crash (char *json_dump, MonoStackHash *hashes, int pause);

static gboolean
stub_debugger_transport_handshake (void);

Expand Down Expand Up @@ -85,7 +82,6 @@ static MonoComponentDebugger fn_table = {
&stub_debugger_end_exception_filter,
&stub_debugger_debug_log,
&stub_debugger_debug_log_is_enabled,
&stub_debugger_send_crash,
&stub_debugger_transport_handshake,

//wasm
Expand Down Expand Up @@ -187,11 +183,6 @@ stub_debugger_breakpoint_from_context (MonoContext *ctx)
g_assert_not_reached ();
}

static void
stub_debugger_send_crash (char *json_dump, MonoStackHash *hashes, int pause)
{
}

static gboolean
stub_debugger_transport_handshake (void)
{
Expand Down
1 change: 0 additions & 1 deletion src/mono/mono/component/debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ typedef struct MonoComponentDebugger {
void (*end_exception_filter) (MonoException *exc, MonoContext *ctx, MonoContext *orig_ctx);
void (*debug_log) (int level, MonoString *category, MonoString *message);
gboolean (*debug_log_is_enabled) (void);
void (*send_crash) (char *json_dump, MonoStackHash *hashes, int pause);
gboolean (*transport_handshake) (void);

//wasm
Expand Down
18 changes: 0 additions & 18 deletions src/mono/mono/metadata/exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,24 +1160,6 @@ mono_exception_handle_get_native_backtrace (MonoExceptionHandle exc)
#endif
}

MonoStringHandle
ves_icall_Mono_Runtime_GetNativeStackTrace (MonoExceptionHandle exc, MonoError *error)
{
char *trace;
MonoStringHandle res;
error_init (error);

if (MONO_HANDLE_IS_NULL (exc)) {
mono_error_set_argument_null (error, "exception", "");
return NULL_HANDLE_STRING;
}

trace = mono_exception_handle_get_native_backtrace (exc);
res = mono_string_new_handle (trace, error);
g_free (trace);
return res;
}

/**
* mono_error_raise_exception_deprecated:
* \param target_error the exception to raise
Expand Down
16 changes: 0 additions & 16 deletions src/mono/mono/metadata/icall-def-netcore.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
ICALL_TYPE(RUNTIME, "Mono.Runtime", RUNTIME_20)
NOHANDLES(ICALL(RUNTIME_20, "AnnotateMicrosoftTelemetry_internal", ves_icall_Mono_Runtime_AnnotateMicrosoftTelemetry))
NOHANDLES(ICALL(RUNTIME_19, "CheckCrashReportLog_internal", ves_icall_Mono_Runtime_CheckCrashReportingLog))
NOHANDLES(ICALL(RUNTIME_1, "DisableMicrosoftTelemetry", ves_icall_Mono_Runtime_DisableMicrosoftTelemetry))
HANDLES(RUNTIME_15, "DumpStateSingle_internal", ves_icall_Mono_Runtime_DumpStateSingle, MonoString, 2, (guint64_ref, guint64_ref))
HANDLES(RUNTIME_16, "DumpStateTotal_internal", ves_icall_Mono_Runtime_DumpStateTotal, MonoString, 2, (guint64_ref, guint64_ref))
NOHANDLES(ICALL(RUNTIME_18, "EnableCrashReportLog_internal", ves_icall_Mono_Runtime_EnableCrashReportingLog))
HANDLES(RUNTIME_2, "EnableMicrosoftTelemetry_internal", ves_icall_Mono_Runtime_EnableMicrosoftTelemetry, void, 6, (const_char_ptr, const_char_ptr, const_char_ptr, const_char_ptr, const_char_ptr, const_char_ptr))
HANDLES(RUNTIME_3, "ExceptionToState_internal", ves_icall_Mono_Runtime_ExceptionToState, MonoString, 3, (MonoException, guint64_ref, guint64_ref))
HANDLES(RUNTIME_4, "GetDisplayName", ves_icall_Mono_Runtime_GetDisplayName, MonoString, 0, ())
HANDLES(RUNTIME_12, "GetNativeStackTrace", ves_icall_Mono_Runtime_GetNativeStackTrace, MonoString, 1, (MonoException))
NOHANDLES(ICALL(RUNTIME_21, "RegisterReportingForAllNativeLibs_internal", ves_icall_Mono_Runtime_RegisterReportingForAllNativeLibs))
NOHANDLES(ICALL(RUNTIME_17, "RegisterReportingForNativeLib_internal", ves_icall_Mono_Runtime_RegisterReportingForNativeLib))
HANDLES(RUNTIME_13, "SendMicrosoftTelemetry_internal", ves_icall_Mono_Runtime_SendMicrosoftTelemetry, void, 3, (const_char_ptr, guint64, guint64))
HANDLES(RUNTIME_14, "WriteStateToFile_internal", ves_icall_Mono_Runtime_DumpTelemetry, void, 3, (const_char_ptr, guint64, guint64))

ICALL_TYPE(RTCLASS, "Mono.RuntimeClassHandle", RTCLASS_1)
NOHANDLES(ICALL(RTCLASS_1, "GetTypeFromClass", ves_icall_Mono_RuntimeClassHandle_GetTypeFromClass))

Expand Down
Loading

0 comments on commit 0c90347

Please sign in to comment.