Skip to content

Commit c39d8e9

Browse files
jechterjoncham
authored andcommitted
cache pause point active state
1 parent 0e2663d commit c39d8e9

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

mono/mini/debugger-agent.c

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static SingleStepReq *ss_req;
741741
static int ss_count;
742742
#endif
743743

744+
bool g_unity_pause_point_active;
745+
744746
/* The protocol version of the client */
745747
static int major_version, minor_version;
746748

@@ -1165,13 +1167,27 @@ void mono_debugger_install_sequence_point_check(volatile uint32_t* check)
11651167
g_unity_check = check;
11661168
}
11671169

1170+
gboolean unity_debugger_agent_is_global_breakpoint_active()
1171+
{
1172+
if (!ss_req)
1173+
return FALSE;
1174+
else
1175+
return ss_req->global;
1176+
}
1177+
1178+
int32_t unity_debugger_agent_is_single_stepping ()
1179+
{
1180+
return ss_count;
1181+
}
1182+
11681183
#define INC_PAUSE_COUNT() do { mono_atomic_inc_i32 (g_unity_check); } while (0)
11691184
#define DEC_PAUSE_COUNT() do { mono_atomic_dec_i32 (g_unity_check); } while (0)
1170-
1185+
#define UPDATE_PAUSE_STATE() do { g_unity_pause_point_active = unity_debugger_agent_is_global_breakpoint_active() || unity_debugger_agent_is_single_stepping(); } while (0)
11711186
#else
11721187

11731188
#define INC_PAUSE_COUNT()
11741189
#define DEC_PAUSE_COUNT()
1190+
#define UPDATE_PAUSE_STATE()
11751191

11761192
#endif // RUNTIME_IL2CPP
11771193

@@ -6014,6 +6030,7 @@ start_single_stepping (void)
60146030
{
60156031
#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED
60166032
int val = mono_atomic_inc_i32 (&ss_count);
6033+
UPDATE_PAUSE_STATE();
60176034
INC_PAUSE_COUNT();
60186035

60196036
if (val == 1) {
@@ -6032,6 +6049,7 @@ stop_single_stepping (void)
60326049
{
60336050
#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED
60346051
int val = mono_atomic_dec_i32 (&ss_count);
6052+
UPDATE_PAUSE_STATE();
60356053
DEC_PAUSE_COUNT();
60366054

60376055
if (val == 0) {
@@ -6068,6 +6086,7 @@ ss_stop (SingleStepReq *ss_req)
60686086
if (ss_req->global) {
60696087
stop_single_stepping ();
60706088
ss_req->global = FALSE;
6089+
UPDATE_PAUSE_STATE();
60716090
}
60726091
}
60736092

@@ -6435,6 +6454,7 @@ ss_start (SingleStepReq *ss_req, MonoMethod *method, SeqPoint* sp, MonoSeqPointI
64356454
} else {
64366455
ss_req->global = FALSE;
64376456
}
6457+
UPDATE_PAUSE_STATE();
64386458

64396459
if (ss_req_bp_cache)
64406460
g_hash_table_destroy (ss_req_bp_cache);
@@ -6508,6 +6528,7 @@ ss_start_il2cpp(SingleStepReq *ss_req, DebuggerTlsData *tls, Il2CppSequencePoint
65086528
{
65096529
ss_req->global = FALSE;
65106530
}
6531+
UPDATE_PAUSE_STATE();
65116532
}
65126533

65136534
#endif // RUNTIME_IL2CPP
@@ -12342,17 +12363,9 @@ unity_debugger_agent_breakpoint(Il2CppSequencePoint* sequencePoint)
1234212363
unity_process_breakpoint_inner(tls, FALSE, sequencePoint);
1234312364
}
1234412365

12345-
gboolean unity_debugger_agent_is_global_breakpoint_active()
12346-
{
12347-
if (!ss_req)
12348-
return FALSE;
12349-
else
12350-
return ss_req->global;
12351-
}
12352-
12353-
int32_t unity_debugger_agent_is_single_stepping ()
12366+
gboolean unity_pause_point_active()
1235412367
{
12355-
return ss_count;
12368+
return unity_debugger_agent_is_global_breakpoint_active() || unity_debugger_agent_is_single_stepping();
1235612369
}
1235712370

1235812371
gboolean unity_sequence_point_active(Il2CppSequencePoint *seqPoint)

0 commit comments

Comments
 (0)