@@ -1149,7 +1149,8 @@ mono_debugger_run_debugger_thread_func(void* arg)
11491149}
11501150
11511151typedef struct {
1152- void (* il2cpp_debugger_save_thread_context )(Il2CppThreadUnwindState * context );
1152+ void (* il2cpp_debugger_save_thread_context )(Il2CppThreadUnwindState * context , int frameCountAdjust );
1153+ void (* il2cpp_debugger_free_thread_context )(Il2CppThreadUnwindState * context );
11531154} MonoDebuggerRuntimeCallbacks ;
11541155
11551156static MonoDebuggerRuntimeCallbacks callbacks ;
@@ -2679,7 +2680,7 @@ save_thread_context (MonoContext *ctx)
26792680 else
26802681 mono_thread_state_init_from_current (& tls -> context );
26812682#else
2682- callbacks .il2cpp_debugger_save_thread_context (& tls -> il2cpp_context );
2683+ callbacks .il2cpp_debugger_save_thread_context (& tls -> il2cpp_context , 0 );
26832684#endif // !RUNTIME_IL2CPP
26842685}
26852686
@@ -4213,6 +4214,8 @@ thread_end (MonoProfiler *prof, uintptr_t tid)
42134214 /* Can't remove from tid_to_thread, as that would defeat the check in thread_start () */
42144215#ifndef RUNTIME_IL2CPP
42154216 MONO_GC_UNREGISTER_ROOT (tls -> thread );
4217+ #else
4218+ callbacks .il2cpp_debugger_free_thread_context (& tls -> il2cpp_context );
42164219#endif
42174220 tls -> thread = NULL ;
42184221 }
@@ -12321,6 +12324,19 @@ gboolean unity_sequence_point_active(Il2CppSequencePoint *seqPoint)
1232112324 return FALSE;
1232212325}
1232312326
12327+ void il2cpp_save_current_thread_context_func_exit ()
12328+ {
12329+ DebuggerTlsData * tls ;
12330+
12331+ MonoInternalThread * thread = mono_thread_internal_current ();
12332+
12333+ mono_loader_lock ();
12334+ tls = (DebuggerTlsData * )mono_g_hash_table_lookup (thread_to_tls , thread );
12335+ mono_loader_unlock ();
12336+
12337+ callbacks .il2cpp_debugger_save_thread_context (& tls -> il2cpp_context , -1 );
12338+ }
12339+
1232412340#endif // RUNTIME_IL2CPP
1232512341
1232612342#else /* DISABLE_DEBUGGER_AGENT */
0 commit comments