@@ -1050,6 +1050,61 @@ mono_debugger_agent_parse_options (char *options)
1050
1050
}
1051
1051
}
1052
1052
1053
+ static gboolean disable_optimizations = TRUE;
1054
+
1055
+ static void
1056
+ update_mdb_optimizations ()
1057
+ {
1058
+ gboolean enable = disable_optimizations ;
1059
+ #ifndef RUNTIME_IL2CPP
1060
+ mini_get_debug_options ()-> gen_sdb_seq_points = enable ;
1061
+ /*
1062
+ * This is needed because currently we don't handle liveness info.
1063
+ */
1064
+ mini_get_debug_options ()-> mdb_optimizations = enable ;
1065
+
1066
+ #ifndef MONO_ARCH_HAVE_CONTEXT_SET_INT_REG
1067
+ /* This is needed because we can't set local variables in registers yet */
1068
+ mono_disable_optimizations (MONO_OPT_LINEARS );
1069
+ #endif
1070
+
1071
+ /*
1072
+ * The stack walk done from thread_interrupt () needs to be signal safe, but it
1073
+ * isn't, since it can call into mono_aot_find_jit_info () which is not signal
1074
+ * safe (#3411). So load AOT info eagerly when the debugger is running as a
1075
+ * workaround.
1076
+ */
1077
+ mini_get_debug_options ()-> load_aot_jit_info_eagerly = enable ;
1078
+ #endif // !RUNTIME_IL2CPP
1079
+ }
1080
+
1081
+ MONO_API void
1082
+ mono_debugger_set_generate_debug_info (gboolean enable )
1083
+ {
1084
+ disable_optimizations = enable ;
1085
+ update_mdb_optimizations ();
1086
+ }
1087
+
1088
+ MONO_API gboolean
1089
+ mono_debugger_get_generate_debug_info ()
1090
+ {
1091
+ return disable_optimizations ;
1092
+ }
1093
+
1094
+ MONO_API void
1095
+ mono_debugger_disconnect (const char * message )
1096
+ {
1097
+ stop_debugger_thread ();
1098
+ }
1099
+
1100
+ typedef void (* MonoDebuggerAttachFunc )(gboolean attached );
1101
+ static MonoDebuggerAttachFunc attach_func ;
1102
+ MONO_API void
1103
+ mono_debugger_install_attach_detach_callback (MonoDebuggerAttachFunc func )
1104
+ {
1105
+ attach_func = func ;
1106
+ }
1107
+
1053
1108
void
1054
1109
mono_debugger_agent_init (void )
1055
1110
{
@@ -1117,26 +1172,7 @@ mono_debugger_agent_init (void)
1117
1172
breakpoints_init ();
1118
1173
suspend_init ();
1119
1174
1120
- #ifndef RUNTIME_IL2CPP
1121
- mini_get_debug_options ()-> gen_sdb_seq_points = TRUE;
1122
- /*
1123
- * This is needed because currently we don't handle liveness info.
1124
- */
1125
- mini_get_debug_options ()-> mdb_optimizations = TRUE;
1126
-
1127
- #ifndef MONO_ARCH_HAVE_CONTEXT_SET_INT_REG
1128
- /* This is needed because we can't set local variables in registers yet */
1129
- mono_disable_optimizations (MONO_OPT_LINEARS );
1130
- #endif
1131
-
1132
- /*
1133
- * The stack walk done from thread_interrupt () needs to be signal safe, but it
1134
- * isn't, since it can call into mono_aot_find_jit_info () which is not signal
1135
- * safe (#3411). So load AOT info eagerly when the debugger is running as a
1136
- * workaround.
1137
- */
1138
- mini_get_debug_options ()-> load_aot_jit_info_eagerly = TRUE;
1139
- #endif // !RUNTIME_IL2CPP
1175
+ update_mdb_optimizations ();
1140
1176
1141
1177
#ifdef HAVE_SETPGID
1142
1178
if (agent_config .setpgid )
@@ -4659,6 +4695,8 @@ insert_breakpoint (MonoSeqPointInfo *seq_points, MonoDomain *domain, MonoJitInfo
4659
4695
mini_get_interp_callbacks ()-> set_breakpoint (ji , inst -> ip );
4660
4696
} else {
4661
4697
#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED
4698
+ if (ji -> dbg_ignore )
4699
+ return ;
4662
4700
mono_arch_set_breakpoint (ji , inst -> ip );
4663
4701
#else
4664
4702
NOT_IMPLEMENTED ;
@@ -11992,6 +12030,8 @@ debugger_thread (void *arg)
11992
12030
attach_failed = TRUE; // Don't abort process when we can't listen
11993
12031
} else {
11994
12032
mono_set_is_debugger_attached (TRUE);
12033
+ if (attach_func )
12034
+ attach_func (TRUE);
11995
12035
/* Send start event to client */
11996
12036
process_profiler_event (EVENT_KIND_VM_START , mono_thread_get_main ());
11997
12037
#ifdef RUNTIME_IL2CPP
@@ -12008,6 +12048,8 @@ debugger_thread (void *arg)
12008
12048
}
12009
12049
} else {
12010
12050
mono_set_is_debugger_attached (TRUE);
12051
+ if (attach_func )
12052
+ attach_func (TRUE);
12011
12053
}
12012
12054
12013
12055
while (!attach_failed ) {
@@ -12142,6 +12184,8 @@ debugger_thread (void *arg)
12142
12184
}
12143
12185
12144
12186
mono_set_is_debugger_attached (FALSE);
12187
+ if (attach_func )
12188
+ attach_func (FALSE);
12145
12189
12146
12190
#ifdef RUNTIME_IL2CPP
12147
12191
il2cpp_mono_free_method_signatures ();
0 commit comments