Skip to content

Commit 743bd89

Browse files
authored
[release/6.0-preview7] [debugger] Export mono_debugger_agent_unhandled_exception to avoid usage of Debugger.Mono_UnhandledException (#56071)
* Avoid regressing behavior that we had on mono/mono. Xamarin Android team will be able to use mono_debugger_agent_unhandled_exception, and do not use Debugger.Mono_UnhandledException(as it does not exist on net6). * Exporting headers * Fixing implementation.
1 parent 640d3ea commit 743bd89

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/mono/mono/metadata/debug-helpers.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ MONO_API char* mono_method_get_reflection_name (MonoMethod *method);
4848

4949
MONO_API char* mono_field_full_name (MonoClassField *field);
5050

51+
MONO_API MONO_RT_EXTERNAL_ONLY void
52+
mono_debugger_agent_unhandled_exception (MonoException *e);
53+
5154
MONO_END_DECLS
5255

5356
#endif /* __MONO_DEBUG_HELPERS_H__ */

src/mono/mono/mini/debugger-agent-external.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <glib.h>
66
#include <mono/metadata/components.h>
77
#include "debugger-agent-external.h"
8+
#include <mono/metadata/external-only.h>
89

910
#ifndef DISABLE_SDB
1011

@@ -59,4 +60,12 @@ mono_debugger_agent_get_sdb_options (void)
5960
{
6061
return sdb_options;
6162
}
63+
64+
void
65+
mono_debugger_agent_unhandled_exception (MonoException *e)
66+
{
67+
MONO_ENTER_GC_UNSAFE;
68+
MONO_EXTERNAL_ONLY_VOID (mono_component_debugger ()->unhandled_exception (e));
69+
MONO_EXIT_GC_UNSAFE;
70+
}
6271
#endif /* DISABLE_SDB */

src/mono/mono/mini/mini-runtime.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4607,11 +4607,6 @@ register_icalls (void)
46074607
mono_add_internal_call_internal ("Mono.Runtime::mono_runtime_install_handlers",
46084608
mono_runtime_install_handlers);
46094609

4610-
#if defined(HOST_ANDROID) || defined(TARGET_ANDROID)
4611-
mono_add_internal_call_internal ("System.Diagnostics.Debugger::Mono_UnhandledException_internal",
4612-
mono_component_debugger ()->unhandled_exception);
4613-
#endif
4614-
46154610
/*
46164611
* It's important that we pass `TRUE` as the last argument here, as
46174612
* it causes the JIT to omit a wrapper for these icalls. If the JIT

0 commit comments

Comments
 (0)