From 342941de0a55f8dc2700754bb533312676d56c1a Mon Sep 17 00:00:00 2001 From: Thays Date: Wed, 6 Jul 2022 17:45:34 -0300 Subject: [PATCH] Backport 71436 --- src/mono/mono/component/debugger-agent.c | 38 ++++++++++++------------ src/mono/mono/mini/mini-runtime.c | 7 +++-- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/mono/mono/component/debugger-agent.c b/src/mono/mono/component/debugger-agent.c index 35b06bfbd5c143..fdd07a5f8d1eea 100644 --- a/src/mono/mono/component/debugger-agent.c +++ b/src/mono/mono/component/debugger-agent.c @@ -702,6 +702,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 @@ -823,25 +842,6 @@ debugger_agent_init (MonoDefaults *mono_defaults) 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/src/mono/mono/mini/mini-runtime.c b/src/mono/mono/mini/mini-runtime.c index d609531e6b948b..812a8348c5f438 100644 --- a/src/mono/mono/mini/mini-runtime.c +++ b/src/mono/mono/mini/mini-runtime.c @@ -4384,13 +4384,14 @@ mini_init (const char *filename, const char *runtime_version) #endif mono_interp_stub_init (); + mono_components_init (); + + mono_component_debugger ()->parse_options (mono_debugger_agent_get_sdb_options ()); + #ifndef DISABLE_INTERPRETER if (mono_use_interpreter) mono_ee_interp_init (mono_interp_opts_string); #endif - mono_components_init (); - - mono_component_debugger ()->parse_options (mono_debugger_agent_get_sdb_options ()); mono_os_mutex_init_recursive (&jit_mutex);