@@ -1049,6 +1049,55 @@ mono_debugger_agent_parse_options (char *options)
1049
1049
}
1050
1050
}
1051
1051
1052
+ static gboolean disable_optimizations = TRUE;
1053
+
1054
+ static void
1055
+ update_mdb_optimizations ()
1056
+ {
1057
+ gboolean enable = disable_optimizations ;
1058
+ #ifndef RUNTIME_IL2CPP
1059
+ mini_get_debug_options ()-> gen_sdb_seq_points = enable ;
1060
+ /*
1061
+ * This is needed because currently we don't handle liveness info.
1062
+ */
1063
+ mini_get_debug_options ()-> mdb_optimizations = enable ;
1064
+
1065
+ #ifndef MONO_ARCH_HAVE_CONTEXT_SET_INT_REG
1066
+ /* This is needed because we can't set local variables in registers yet */
1067
+ mono_disable_optimizations (MONO_OPT_LINEARS );
1068
+ #endif
1069
+
1070
+ /*
1071
+ * The stack walk done from thread_interrupt () needs to be signal safe, but it
1072
+ * isn't, since it can call into mono_aot_find_jit_info () which is not signal
1073
+ * safe (#3411). So load AOT info eagerly when the debugger is running as a
1074
+ * workaround.
1075
+ */
1076
+ mini_get_debug_options ()-> load_aot_jit_info_eagerly = enable ;
1077
+ #endif // !RUNTIME_IL2CPP
1078
+ }
1079
+
1080
+ MONO_API void
1081
+ mono_debugger_set_disable_optimizations (gboolean enable )
1082
+ {
1083
+ disable_optimizations = enable ;
1084
+ update_mdb_optimizations ();
1085
+ }
1086
+
1087
+ MONO_API gboolean
1088
+ mono_debugger_get_disable_optimizations ()
1089
+ {
1090
+ return disable_optimizations ;
1091
+ }
1092
+
1093
+ typedef void (* MonoDebuggerAttachFunc )(gboolean attached );
1094
+ static MonoDebuggerAttachFunc attach_func ;
1095
+ MONO_API void
1096
+ mono_debugger_install_attach_detach_callback (MonoDebuggerAttachFunc func )
1097
+ {
1098
+ attach_func = func ;
1099
+ }
1100
+
1052
1101
void
1053
1102
mono_debugger_agent_init (void )
1054
1103
{
@@ -1116,26 +1165,7 @@ mono_debugger_agent_init (void)
1116
1165
breakpoints_init ();
1117
1166
suspend_init ();
1118
1167
1119
- #ifndef RUNTIME_IL2CPP
1120
- mini_get_debug_options ()-> gen_sdb_seq_points = TRUE;
1121
- /*
1122
- * This is needed because currently we don't handle liveness info.
1123
- */
1124
- mini_get_debug_options ()-> mdb_optimizations = TRUE;
1125
-
1126
- #ifndef MONO_ARCH_HAVE_CONTEXT_SET_INT_REG
1127
- /* This is needed because we can't set local variables in registers yet */
1128
- mono_disable_optimizations (MONO_OPT_LINEARS );
1129
- #endif
1130
-
1131
- /*
1132
- * The stack walk done from thread_interrupt () needs to be signal safe, but it
1133
- * isn't, since it can call into mono_aot_find_jit_info () which is not signal
1134
- * safe (#3411). So load AOT info eagerly when the debugger is running as a
1135
- * workaround.
1136
- */
1137
- mini_get_debug_options ()-> load_aot_jit_info_eagerly = TRUE;
1138
- #endif // !RUNTIME_IL2CPP
1168
+ update_mdb_optimizations ();
1139
1169
1140
1170
#ifdef HAVE_SETPGID
1141
1171
if (agent_config .setpgid )
@@ -4630,6 +4660,8 @@ insert_breakpoint (MonoSeqPointInfo *seq_points, MonoDomain *domain, MonoJitInfo
4630
4660
mini_get_interp_callbacks ()-> set_breakpoint (ji , inst -> ip );
4631
4661
} else {
4632
4662
#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED
4663
+ if (ji -> dbg_ignore )
4664
+ return ;
4633
4665
mono_arch_set_breakpoint (ji , inst -> ip );
4634
4666
#else
4635
4667
NOT_IMPLEMENTED ;
@@ -11963,6 +11995,8 @@ debugger_thread (void *arg)
11963
11995
attach_failed = TRUE; // Don't abort process when we can't listen
11964
11996
} else {
11965
11997
mono_set_is_debugger_attached (TRUE);
11998
+ if (attach_func )
11999
+ attach_func (TRUE);
11966
12000
/* Send start event to client */
11967
12001
process_profiler_event (EVENT_KIND_VM_START , mono_thread_get_main ());
11968
12002
#ifdef RUNTIME_IL2CPP
@@ -11979,6 +12013,8 @@ debugger_thread (void *arg)
11979
12013
}
11980
12014
} else {
11981
12015
mono_set_is_debugger_attached (TRUE);
12016
+ if (attach_func )
12017
+ attach_func (TRUE);
11982
12018
}
11983
12019
11984
12020
while (!attach_failed ) {
@@ -12113,6 +12149,8 @@ debugger_thread (void *arg)
12113
12149
}
12114
12150
12115
12151
mono_set_is_debugger_attached (FALSE);
12152
+ if (attach_func )
12153
+ attach_func (FALSE);
12116
12154
12117
12155
#ifdef RUNTIME_IL2CPP
12118
12156
il2cpp_mono_free_method_signatures ();
0 commit comments