Skip to content

Commit fdd29ba

Browse files
author
Josh Peterson
committed
Set the frame ID for the debugger
This code is a bit odd. It depends on the `i` variable value after the `for` loop. If that `for` loop does not execute (even if the loop body does nothing), the code won't set the frame ID properly. This causes locals to be reported for the wrong frame in the `GET_FRAME_INFO` command. On a side note, maybe we should implement something for IL2CPP in the body of for loop, but that is a different issue. This syncs with the debugger code in the IL2CPP repo.
1 parent ca762c2 commit fdd29ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mono/mini/debugger-agent.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3453,18 +3453,18 @@ compute_frame_info (MonoInternalThread *thread, DebuggerTlsData *tls)
34533453
for (tmp = user_data.frames; tmp; tmp = tmp->next) {
34543454
f = (StackFrame *)tmp->data;
34553455

3456-
#ifndef RUNTIME_IL2CPP
34573456
/*
34583457
* Reuse the id for already existing stack frames, so invokes don't invalidate
34593458
* the still valid stack frames.
34603459
*/
34613460
for (i = 0; i < tls->frame_count; ++i) {
3461+
#ifndef RUNTIME_IL2CPP
34623462
if (MONO_CONTEXT_GET_SP (&tls->frames [i]->ctx) == MONO_CONTEXT_GET_SP (&f->ctx)) {
34633463
f->id = tls->frames [i]->id;
34643464
break;
34653465
}
3466-
}
34673466
#endif // !RUNTIME_IL2CPP
3467+
}
34683468

34693469
if (i >= tls->frame_count)
34703470
f->id = mono_atomic_inc_i32 (&frame_id);

0 commit comments

Comments
 (0)