From 2a19f878dab8d2e62123e0bf29453de553f5402a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Jul 2022 21:07:54 +0200 Subject: Backport https://github.com/dotnet/runtime/pull/71436 (#21519) Backport https://github.com/dotnet/runtime/pull/71436 Backport of #21516 to 2020-02 Co-authored-by: Thays Grazia --- mono/mini/debugger-agent.c | 38 +++++++++++++++++++------------------- mono/mini/mini-runtime.c | 12 ++++++------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index 54c0ca97801..32bfc471ea2 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -908,6 +908,25 @@ debugger_agent_parse_options (char *options) exit (1); } } + + mini_get_debug_options ()->gen_sdb_seq_points = TRUE; + /* + * This is needed because currently we don't handle liveness info. + */ + mini_get_debug_options ()->mdb_optimizations = TRUE; + +#ifndef MONO_ARCH_HAVE_CONTEXT_SET_INT_REG + /* This is needed because we can't set local variables in registers yet */ + mono_disable_optimizations (MONO_OPT_LINEARS); +#endif + + /* + * The stack walk done from thread_interrupt () needs to be signal safe, but it + * isn't, since it can call into mono_aot_find_jit_info () which is not signal + * safe (#3411). So load AOT info eagerly when the debugger is running as a + * workaround. + */ + mini_get_debug_options ()->load_aot_jit_info_eagerly = TRUE; } void @@ -1035,25 +1054,6 @@ debugger_agent_init (void) objrefs_init (); suspend_init (); - mini_get_debug_options ()->gen_sdb_seq_points = TRUE; - /* - * This is needed because currently we don't handle liveness info. - */ - mini_get_debug_options ()->mdb_optimizations = TRUE; - -#ifndef MONO_ARCH_HAVE_CONTEXT_SET_INT_REG - /* This is needed because we can't set local variables in registers yet */ - mono_disable_optimizations (MONO_OPT_LINEARS); -#endif - - /* - * The stack walk done from thread_interrupt () needs to be signal safe, but it - * isn't, since it can call into mono_aot_find_jit_info () which is not signal - * safe (#3411). So load AOT info eagerly when the debugger is running as a - * workaround. - */ - mini_get_debug_options ()->load_aot_jit_info_eagerly = TRUE; - #ifdef HAVE_SETPGID if (agent_config.setpgid) setpgid (0, 0); diff --git a/mono/mini/mini-runtime.c b/mono/mini/mini-runtime.c index 347ee8a9da9..d982e51a3ab 100644 --- a/mono/mini/mini-runtime.c +++ b/mono/mini/mini-runtime.c @@ -4159,12 +4159,6 @@ mini_init (const char *filename, const char *runtime_version) } #endif - mono_interp_stub_init (); -#ifndef DISABLE_INTERPRETER - if (mono_use_interpreter) - mono_ee_interp_init (mono_interp_opts_string); -#endif - mono_debugger_agent_stub_init (); #ifndef DISABLE_SDB mono_debugger_agent_init (); @@ -4173,6 +4167,12 @@ mini_init (const char *filename, const char *runtime_version) if (sdb_options) mini_get_dbg_callbacks ()->parse_options (sdb_options); + mono_interp_stub_init (); +#ifndef DISABLE_INTERPRETER + if (mono_use_interpreter) + mono_ee_interp_init (mono_interp_opts_string); +#endif + mono_os_mutex_init_recursive (&jit_mutex); mono_cross_helpers_run (); -- cgit v1.2.3