Skip to content

Commit a782c27

Browse files
jechterjoncham
authored andcommitted
Inline Sequence Point checks; hard code sequence point reference into macro invocation instead of looking up from index; hard code sequence point type into macro invocation
1 parent c39d8e9 commit a782c27

File tree

1 file changed

+36
-15
lines changed

1 file changed

+36
-15
lines changed

mono/mini/debugger-agent.c

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3458,7 +3458,7 @@ compute_frame_info (MonoInternalThread *thread, DebuggerTlsData *tls)
34583458
} else if (tls->il2cpp_context->frameCount > 0) {
34593459
for (int frame_index = tls->il2cpp_context->frameCount - 1; frame_index >= 0; --frame_index)
34603460
{
3461-
Il2CppSequencePoint* seq_point = il2cpp_get_sequence_point (tls->il2cpp_context->executionContexts[frame_index]->currentSequencePoint);
3461+
Il2CppSequencePoint* seq_point = tls->il2cpp_context->executionContexts[frame_index]->currentSequencePoint;
34623462
StackFrame* frame = g_new0(StackFrame, 1);
34633463
MonoMethod *sp_method = il2cpp_get_seq_point_method(seq_point);
34643464
frame->method = sp_method;
@@ -5886,7 +5886,7 @@ process_single_step_inner (DebuggerTlsData *tls, gboolean from_signal, Il2CppSeq
58865886
#ifndef RUNTIME_IL2CPP
58875887
process_event (EVENT_KIND_STEP, jinfo_get_method (ji), il_offset, ctx, events, suspend_policy);
58885888
#else
5889-
Il2CppSequencePoint* sequence_pt = il2cpp_get_sequence_point(tls->il2cpp_context->executionContexts[tls->il2cpp_context->frameCount - 1]->currentSequencePoint);
5889+
Il2CppSequencePoint* sequence_pt = tls->il2cpp_context->executionContexts[tls->il2cpp_context->frameCount - 1]->currentSequencePoint;
58905890
MonoMethod *sp_method = il2cpp_get_seq_point_method(sequence_pt);
58915891

58925892
/*
@@ -6481,7 +6481,7 @@ ss_start_il2cpp(SingleStepReq *ss_req, DebuggerTlsData *tls, Il2CppSequencePoint
64816481
} else {
64826482
if (ss_req->depth == STEP_DEPTH_OVER)
64836483
{
6484-
MonoMethod* currentMethod = il2cpp_get_seq_point_method(il2cpp_get_sequence_point(tls->il2cpp_context->executionContexts[tls->il2cpp_context->frameCount - 1]->currentSequencePoint));
6484+
MonoMethod* currentMethod = il2cpp_get_seq_point_method(tls->il2cpp_context->executionContexts[tls->il2cpp_context->frameCount - 1]->currentSequencePoint);
64856485

64866486
void *seqPointIter = NULL;
64876487
Il2CppSequencePoint *seqPoint;
@@ -6497,7 +6497,7 @@ ss_start_il2cpp(SingleStepReq *ss_req, DebuggerTlsData *tls, Il2CppSequencePoint
64976497

64986498
if (tls->il2cpp_context->frameCount > 1)
64996499
{
6500-
Il2CppSequencePoint* sequencePointForStepOut = il2cpp_get_sequence_point(tls->il2cpp_context->executionContexts[tls->il2cpp_context->frameCount - 2]->currentSequencePoint);
6500+
Il2CppSequencePoint* sequencePointForStepOut = tls->il2cpp_context->executionContexts[tls->il2cpp_context->frameCount - 2]->currentSequencePoint;
65016501
g_assert(sequencePointForStepOut->kind == kSequencePointKind_StepOut);
65026502
ss_bp_add_one_il2cpp(ss_req, &ss_req_bp_count, &ss_req_bp_cache, sequencePointForStepOut);
65036503
}
@@ -6593,7 +6593,7 @@ ss_create (MonoInternalThread *thread, StepSize size, StepDepth depth, StepFilte
65936593

65946594
if (tls->il2cpp_context->frameCount > 0)
65956595
{
6596-
Il2CppSequencePoint* seq_point = il2cpp_get_sequence_point(tls->il2cpp_context->executionContexts[tls->il2cpp_context->frameCount - 1]->currentSequencePoint);
6596+
Il2CppSequencePoint* seq_point = tls->il2cpp_context->executionContexts[tls->il2cpp_context->frameCount - 1]->currentSequencePoint;
65976597
MonoMethod *sp_method = il2cpp_get_seq_point_method(seq_point);
65986598
ss_req->start_method = sp_method;
65996599
ss_req->last_method = sp_method;
@@ -6829,7 +6829,7 @@ static Il2CppSequencePoint* il2cpp_find_catch_sequence_point(DebuggerTlsData *tl
68296829
int frameIndex = tls->il2cpp_context->frameCount - 1;
68306830
while (frameIndex >= 0)
68316831
{
6832-
Il2CppSequencePoint* sp = il2cpp_find_catch_sequence_point_in_method(il2cpp_get_sequence_point(tls->il2cpp_context->executionContexts[frameIndex]->currentSequencePoint), tls->exception);
6832+
Il2CppSequencePoint* sp = il2cpp_find_catch_sequence_point_in_method(tls->il2cpp_context->executionContexts[frameIndex]->currentSequencePoint, tls->exception);
68336833
if (sp)
68346834
return sp;
68356835

@@ -6853,7 +6853,7 @@ static Il2CppSequencePoint* il2cpp_find_catch_sequence_point_from_exeption(Debug
68536853
int frameIndex = tls->il2cpp_context->frameCount - 1;
68546854
while (frameIndex >= 0)
68556855
{
6856-
sp = il2cpp_find_catch_sequence_point_in_method(il2cpp_get_sequence_point(tls->il2cpp_context->executionContexts[frameIndex]->currentSequencePoint), exc);
6856+
sp = il2cpp_find_catch_sequence_point_in_method(tls->il2cpp_context->executionContexts[frameIndex]->currentSequencePoint, exc);
68576857
if (sp)
68586858
return sp;
68596859

@@ -12363,27 +12363,48 @@ unity_debugger_agent_breakpoint(Il2CppSequencePoint* sequencePoint)
1236312363
unity_process_breakpoint_inner(tls, FALSE, sequencePoint);
1236412364
}
1236512365

12366+
void unity_debugger_agent_pausepoint()
12367+
{
12368+
if (is_debugger_thread())
12369+
return;
12370+
12371+
save_thread_context(NULL);
12372+
suspend_current();
12373+
}
12374+
1236612375
gboolean unity_pause_point_active()
1236712376
{
12368-
return unity_debugger_agent_is_global_breakpoint_active() || unity_debugger_agent_is_single_stepping();
12377+
return unity_debugger_agent_is_global_breakpoint_active() || unity_debugger_agent_is_single_stepping();
1236912378
}
1237012379

12371-
gboolean unity_sequence_point_active(Il2CppSequencePoint *seqPoint)
12380+
gboolean unity_sequence_point_active_entry(Il2CppSequencePoint *seqPoint)
1237212381
{
12373-
gboolean global = unity_debugger_agent_is_global_breakpoint_active();
12382+
int i = 0;
12383+
while (i < event_requests->len)
12384+
{
12385+
EventRequest *req = (EventRequest *)g_ptr_array_index (event_requests, i);
1237412386

12375-
if ((seqPoint->ilOffset != METHOD_ENTRY_IL_OFFSET) && (seqPoint->ilOffset != METHOD_EXIT_IL_OFFSET))
12376-
return seqPoint->isActive || global || unity_debugger_agent_is_single_stepping ();
12387+
if (req->event_kind == EVENT_KIND_METHOD_ENTRY)
12388+
{
12389+
return seqPoint->isActive || g_unity_pause_point_active;
12390+
}
12391+
12392+
++i;
12393+
}
1237712394

12395+
return FALSE;
12396+
}
12397+
12398+
gboolean unity_sequence_point_active_exit(Il2CppSequencePoint *seqPoint)
12399+
{
1237812400
int i = 0;
1237912401
while (i < event_requests->len)
1238012402
{
1238112403
EventRequest *req = (EventRequest *)g_ptr_array_index (event_requests, i);
1238212404

12383-
if ((req->event_kind == EVENT_KIND_METHOD_ENTRY && seqPoint->ilOffset == METHOD_ENTRY_IL_OFFSET) ||
12384-
(req->event_kind == EVENT_KIND_METHOD_EXIT && seqPoint->ilOffset == METHOD_EXIT_IL_OFFSET))
12405+
if (req->event_kind == EVENT_KIND_METHOD_EXIT)
1238512406
{
12386-
return seqPoint->isActive || global || unity_debugger_agent_is_single_stepping ();
12407+
return seqPoint->isActive || g_unity_pause_point_active;
1238712408
}
1238812409

1238912410
++i;

0 commit comments

Comments
 (0)