@@ -1050,6 +1050,63 @@ 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 ()
1096
+ {
1097
+ stop_debugger_thread ();
1098
+ transport_connect (agent_config .address );
1099
+ start_debugger_thread ();
1100
+ }
1101
+
1102
+ typedef void (* MonoDebuggerAttachFunc )(gboolean attached );
1103
+ static MonoDebuggerAttachFunc attach_func ;
1104
+ MONO_API void
1105
+ mono_debugger_install_attach_detach_callback (MonoDebuggerAttachFunc func )
1106
+ {
1107
+ attach_func = func ;
1108
+ }
1109
+
1053
1110
void
1054
1111
mono_debugger_agent_init (void )
1055
1112
{
@@ -1117,26 +1174,7 @@ mono_debugger_agent_init (void)
1117
1174
breakpoints_init ();
1118
1175
suspend_init ();
1119
1176
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
1177
+ update_mdb_optimizations ();
1140
1178
1141
1179
#ifdef HAVE_SETPGID
1142
1180
if (agent_config .setpgid )
@@ -4659,6 +4697,8 @@ insert_breakpoint (MonoSeqPointInfo *seq_points, MonoDomain *domain, MonoJitInfo
4659
4697
mini_get_interp_callbacks ()-> set_breakpoint (ji , inst -> ip );
4660
4698
} else {
4661
4699
#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED
4700
+ if (ji -> dbg_ignore )
4701
+ return ;
4662
4702
mono_arch_set_breakpoint (ji , inst -> ip );
4663
4703
#else
4664
4704
NOT_IMPLEMENTED ;
@@ -12003,6 +12043,8 @@ debugger_thread (void *arg)
12003
12043
attach_failed = TRUE; // Don't abort process when we can't listen
12004
12044
} else {
12005
12045
mono_set_is_debugger_attached (TRUE);
12046
+ if (attach_func )
12047
+ attach_func (TRUE);
12006
12048
/* Send start event to client */
12007
12049
process_profiler_event (EVENT_KIND_VM_START , mono_thread_get_main ());
12008
12050
#ifdef RUNTIME_IL2CPP
@@ -12019,6 +12061,8 @@ debugger_thread (void *arg)
12019
12061
}
12020
12062
} else {
12021
12063
mono_set_is_debugger_attached (TRUE);
12064
+ if (attach_func )
12065
+ attach_func (TRUE);
12022
12066
}
12023
12067
12024
12068
while (!attach_failed ) {
@@ -12153,6 +12197,8 @@ debugger_thread (void *arg)
12153
12197
}
12154
12198
12155
12199
mono_set_is_debugger_attached (FALSE);
12200
+ if (attach_func )
12201
+ attach_func (FALSE);
12156
12202
12157
12203
#ifdef RUNTIME_IL2CPP
12158
12204
il2cpp_mono_free_method_signatures ();
0 commit comments