Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[debugger] Fix debugging on Mac and iOS #71436

Merged
merged 1 commit into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,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
Expand Down Expand Up @@ -808,25 +827,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);
Expand Down
8 changes: 5 additions & 3 deletions src/mono/mono/mini/mini-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -4479,13 +4479,15 @@ mini_init (const char *filename)
#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);

Expand Down