Skip to content

Commit

Permalink
[release/6.0-preview7] [debugger] Export mono_debugger_agent_unhandle…
Browse files Browse the repository at this point in the history
…d_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.
  • Loading branch information
thaystg authored Jul 21, 2021
1 parent 640d3ea commit 743bd89
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/mono/mono/metadata/debug-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ MONO_API char* mono_method_get_reflection_name (MonoMethod *method);

MONO_API char* mono_field_full_name (MonoClassField *field);

MONO_API MONO_RT_EXTERNAL_ONLY void
mono_debugger_agent_unhandled_exception (MonoException *e);

MONO_END_DECLS

#endif /* __MONO_DEBUG_HELPERS_H__ */
Expand Down
9 changes: 9 additions & 0 deletions src/mono/mono/mini/debugger-agent-external.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <glib.h>
#include <mono/metadata/components.h>
#include "debugger-agent-external.h"
#include <mono/metadata/external-only.h>

#ifndef DISABLE_SDB

Expand Down Expand Up @@ -59,4 +60,12 @@ mono_debugger_agent_get_sdb_options (void)
{
return sdb_options;
}

void
mono_debugger_agent_unhandled_exception (MonoException *e)
{
MONO_ENTER_GC_UNSAFE;
MONO_EXTERNAL_ONLY_VOID (mono_component_debugger ()->unhandled_exception (e));
MONO_EXIT_GC_UNSAFE;
}
#endif /* DISABLE_SDB */
5 changes: 0 additions & 5 deletions src/mono/mono/mini/mini-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -4607,11 +4607,6 @@ register_icalls (void)
mono_add_internal_call_internal ("Mono.Runtime::mono_runtime_install_handlers",
mono_runtime_install_handlers);

#if defined(HOST_ANDROID) || defined(TARGET_ANDROID)
mono_add_internal_call_internal ("System.Diagnostics.Debugger::Mono_UnhandledException_internal",
mono_component_debugger ()->unhandled_exception);
#endif

/*
* It's important that we pass `TRUE` as the last argument here, as
* it causes the JIT to omit a wrapper for these icalls. If the JIT
Expand Down

0 comments on commit 743bd89

Please sign in to comment.