@@ -163,6 +163,8 @@ typedef struct
163
163
MonoContext ctx ;
164
164
#ifndef RUNTIME_IL2CPP
165
165
MonoDebugMethodJitInfo * jit ;
166
+ #else
167
+ Il2CppSequencePointExecutionContext * frame_context ;
166
168
#endif
167
169
MonoJitInfo * ji ;
168
170
MonoInterpFrameHandle interp_frame ;
@@ -3431,7 +3433,8 @@ compute_frame_info (MonoInternalThread *thread, DebuggerTlsData *tls)
3431
3433
StackFrame * frame = g_new0 (StackFrame , 1 );
3432
3434
MonoMethod * sp_method = il2cpp_get_seq_point_method (seq_point );
3433
3435
frame -> method = sp_method ;
3434
- frame -> actual_method = sp_method ;
3436
+ frame -> actual_method = tls -> il2cpp_context .executionContexts [frame_index ]-> method ;
3437
+ frame -> frame_context = tls -> il2cpp_context .executionContexts [frame_index ];
3435
3438
frame -> api_method = sp_method ;
3436
3439
frame -> il_offset = seq_point -> ilOffset ;
3437
3440
frame -> native_offset = 0 ;
@@ -4802,7 +4805,7 @@ set_breakpoint (MonoMethod *method, long il_offset, EventRequest *req, MonoError
4802
4805
Il2CppSequencePoint * seqPoint ;
4803
4806
while (seqPoint = il2cpp_get_method_sequence_points (method , & seqPointIter ))
4804
4807
{
4805
- if (bp_matches_method ( bp , il2cpp_get_seq_point_method ( seqPoint )) && seqPoint -> ilOffset == bp -> il_offset )
4808
+ if (seqPoint -> ilOffset == bp -> il_offset )
4806
4809
{
4807
4810
if (req -> event_kind == EVENT_KIND_BREAKPOINT && seqPoint -> kind == kSequencePointKind_StepOut )
4808
4811
continue ;
@@ -10253,34 +10256,6 @@ static void GetSequencePointsAndSourceFilesUniqueSequencePoints(MonoMethod* meth
10253
10256
}
10254
10257
}
10255
10258
10256
- static void GetExecutionContextAndHeaderInfo (MonoMethod * method , uint32_t * executionContextInfoCount , const Il2CppMethodExecutionContextInfo * * executionContextInfo , const Il2CppMethodHeaderInfo * * headerInfo , const Il2CppMethodScope * * scopes )
10257
- {
10258
- void * seqPointIter = NULL ;
10259
- Il2CppSequencePoint * seqPoint ;
10260
- while (seqPoint = il2cpp_get_method_sequence_points (method , & seqPointIter ))
10261
- {
10262
- if (il2cpp_mono_methods_match (il2cpp_get_seq_point_method (seqPoint ), method ))
10263
- {
10264
- Il2CppMethodExecutionContextInfoIndex * index = & g_il2cpp_metadata -> methodExecutionContextInfoIndexes [seqPoint -> methodIndex ];
10265
- if (index -> count != -1 )
10266
- {
10267
- * executionContextInfoCount = index -> count ;
10268
- * executionContextInfo = & g_il2cpp_metadata -> methodExecutionContextInfos [index -> tableIndex ][index -> startIndex ];
10269
- }
10270
- else
10271
- {
10272
- * executionContextInfoCount = 0 ;
10273
- * executionContextInfo = NULL ;
10274
- }
10275
- * headerInfo = & g_il2cpp_metadata -> methodHeaderInfos [seqPoint -> methodIndex ];
10276
- * scopes = & g_il2cpp_metadata -> methodScopes [(* headerInfo )-> startScope ];
10277
- return ;
10278
- }
10279
- }
10280
-
10281
- g_assert (FALSE); // shouldn't be ever reached
10282
- }
10283
-
10284
10259
#endif // RUNTIME_IL2CPP
10285
10260
10286
10261
static ErrorCode
@@ -10535,12 +10510,12 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g
10535
10510
mono_debug_free_locals (locals );
10536
10511
g_free (locals_map );
10537
10512
#else
10538
- uint32_t executionInfoCount , localVariableCount = 0 , i ;
10513
+ uint32_t executionInfoCount , i ;
10539
10514
const Il2CppMethodExecutionContextInfo * executionContextInfo = NULL ;
10540
10515
const Il2CppMethodHeaderInfo * headerInfo ;
10541
- const Il2CppMethodScope * scopes ;
10516
+ const Il2CppMethodScope * scopes ;
10542
10517
10543
- GetExecutionContextAndHeaderInfo (method , & executionInfoCount , & executionContextInfo , & headerInfo , & scopes );
10518
+ il2cpp_debugger_get_method_execution_context_and_header_Info (method , & executionInfoCount , & executionContextInfo , & headerInfo , & scopes );
10544
10519
10545
10520
if (CHECK_PROTOCOL_VERSION (2 , 43 )) {
10546
10521
if (headerInfo )
@@ -10558,32 +10533,18 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g
10558
10533
}
10559
10534
}
10560
10535
10561
- for (i = 0 ; i < executionInfoCount ; i ++ )
10562
- {
10563
- if (executionContextInfo [i ].variableKind == kMethodVariableKind_LocalVariable )
10564
- localVariableCount ++ ;
10565
- }
10566
-
10567
- buffer_add_int (buf , localVariableCount );
10536
+ buffer_add_int (buf , executionInfoCount );
10568
10537
10569
10538
for (i = 0 ; i < executionInfoCount ; i ++ )
10570
- {
10571
- if (executionContextInfo [i ].variableKind == kMethodVariableKind_LocalVariable )
10572
- buffer_add_typeid (buf , domain , mono_class_from_mono_type (il2cpp_get_type_from_index (executionContextInfo [i ].typeIndex )));
10573
- }
10539
+ buffer_add_typeid (buf , domain , mono_class_from_mono_type (il2cpp_type_inflate (il2cpp_get_type_from_index (executionContextInfo [i ].typeIndex ), il2cpp_mono_method_get_context (method ))));
10574
10540
10575
10541
for (i = 0 ; i < executionInfoCount ; i ++ )
10576
- {
10577
- if (executionContextInfo [i ].variableKind == kMethodVariableKind_LocalVariable )
10578
- buffer_add_string (buf , g_il2cpp_metadata -> methodExecutionContextInfoStrings [executionContextInfo [i ].nameIndex ]);
10579
- }
10542
+ buffer_add_string (buf , g_il2cpp_metadata -> methodExecutionContextInfoStrings [executionContextInfo [i ].nameIndex ]);
10580
10543
10581
10544
for (i = 0 ; i < executionInfoCount ; i ++ )
10582
10545
{
10583
- if (executionContextInfo [i ].variableKind == kMethodVariableKind_LocalVariable ) {
10584
- buffer_add_int (buf , executionContextInfo [i ].startOffset );
10585
- buffer_add_int (buf , executionContextInfo [i ].endOffset );
10586
- }
10546
+ buffer_add_int (buf , g_il2cpp_metadata -> methodScopes [executionContextInfo [i ].scopeIndex ].startOffset );
10547
+ buffer_add_int (buf , g_il2cpp_metadata -> methodScopes [executionContextInfo [i ].scopeIndex ].endOffset );
10587
10548
}
10588
10549
#endif // !RUNTIME_IL2CPP
10589
10550
break ;
@@ -11016,42 +10977,31 @@ thread_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
11016
10977
11017
10978
#ifdef RUNTIME_IL2CPP
11018
10979
11019
- static uint32_t GetExecutionContextIndexAndType ( const Il2CppSequencePoint * sequencePoint , MethodVariableKind variableKind , uint32_t variablePosition , MonoType * * type )
10980
+ static void GetVariable ( DebuggerTlsData * tls , StackFrame * frame , MethodVariableKind variableKind , uint32_t variablePosition , MonoType * * type , void * * var )
11020
10981
{
11021
- uint32_t executionContextPosition , variablesIterated = 0 ;
11022
-
11023
- Il2CppMethodExecutionContextInfoIndex * index = & g_il2cpp_metadata -> methodExecutionContextInfoIndexes [sequencePoint -> methodIndex ];
11024
- Il2CppMethodExecutionContextInfo * executionContextInfos = & g_il2cpp_metadata -> methodExecutionContextInfos [index -> tableIndex ][index -> startIndex ];
11025
-
11026
- for (executionContextPosition = 0 ;; executionContextPosition ++ )
11027
- {
11028
- g_assert (executionContextPosition < index -> count );
11029
-
11030
- if (executionContextInfos [executionContextPosition ].variableKind == variableKind )
11031
- {
11032
- if (variablesIterated == variablePosition )
11033
- {
11034
- * type = il2cpp_get_type_from_index (executionContextInfos [executionContextPosition ].typeIndex );
11035
- return executionContextPosition ;
11036
- }
10982
+ switch (variableKind )
10983
+ {
10984
+ case kMethodVariableKind_Parameter : {
10985
+ * var = frame -> frame_context -> params [variablePosition ];
10986
+ * type = il2cpp_method_get_param (frame -> actual_method , variablePosition );
10987
+ }
10988
+ break ;
10989
+ case kMethodVariableKind_LocalVariable : {
10990
+ uint32_t executionInfoCount , localVariableCount = 0 , i ;
10991
+ const Il2CppMethodExecutionContextInfo * executionContextInfo = NULL ;
10992
+ const Il2CppMethodHeaderInfo * headerInfo ;
10993
+ const Il2CppMethodScope * scopes ;
11037
10994
11038
- variablesIterated ++ ;
11039
- }
11040
- }
11041
- }
10995
+ il2cpp_debugger_get_method_execution_context_and_header_Info (frame -> actual_method , & executionInfoCount , & executionContextInfo , & headerInfo , & scopes );
11042
10996
11043
- static void GetVariable (DebuggerTlsData * tls , StackFrame * frame , MethodVariableKind variableKind , uint32_t variablePosition , MonoType * * type , void * * var )
11044
- {
11045
- for (int frame_index = 0 ; frame_index < tls -> il2cpp_context .frameCount ; ++ frame_index )
11046
- {
11047
- if (il2cpp_get_seq_point_method (tls -> il2cpp_context .sequencePoints [frame_index ]) == frame -> actual_method )
11048
- {
11049
- Il2CppSequencePoint * sequencePoint = tls -> il2cpp_context .sequencePoints [frame_index ];
11050
- Il2CppSequencePointExecutionContext * executionContext = tls -> il2cpp_context .executionContexts [frame_index ];
11051
- uint32_t executionContextPosition = GetExecutionContextIndexAndType (sequencePoint , variableKind , variablePosition , type );
11052
- * var = executionContext -> values [executionContextPosition ];
11053
- }
11054
- }
10997
+ * var = frame -> frame_context -> locals [variablePosition ];
10998
+ * type = il2cpp_type_inflate ( il2cpp_get_type_from_index (executionContextInfo [variablePosition ].typeIndex ), il2cpp_mono_method_get_context (frame -> actual_method ));
10999
+ }
11000
+ break ;
11001
+ case kMethodVariableKind_This :
11002
+ default :
11003
+ g_assert_not_reached ();
11004
+ }
11055
11005
}
11056
11006
11057
11007
static void SendVariableData (DebuggerTlsData * tls , StackFrame * frame , Buffer * buf , MethodVariableKind variableKind , uint32_t variablePosition )
@@ -11217,14 +11167,8 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
11217
11167
add_var (buf , jit , & frame -> actual_method -> klass -> this_arg , jit -> this_var , & frame -> ctx , frame -> domain , TRUE);
11218
11168
}
11219
11169
#else
11220
- for (int frame_index = 0 ; frame_index < tls -> il2cpp_context .frameCount ; ++ frame_index )
11221
- {
11222
- if (il2cpp_get_seq_point_method (tls -> il2cpp_context .sequencePoints [frame_index ]) == frame -> actual_method )
11223
- {
11224
- buffer_add_value_full (buf , & frame -> actual_method -> klass -> this_arg , tls -> il2cpp_context .executionContexts [frame_index ]-> values [0 ], frame -> domain , TRUE, NULL );
11225
- break ;
11226
- }
11227
- }
11170
+ buffer_add_value_full (buf , & frame -> actual_method -> klass -> this_arg , * frame -> frame_context -> thisArg , frame -> domain , FALSE, NULL );
11171
+ break ;
11228
11172
#endif
11229
11173
}
11230
11174
} else {
@@ -11243,7 +11187,7 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
11243
11187
add_var (buf , jit , & frame -> api_method -> klass -> byval_arg , jit -> this_var , & frame -> ctx , frame -> domain , TRUE);
11244
11188
}
11245
11189
#else
11246
- SendVariableData ( tls , frame , buf , kMethodVariableKind_This , 0 );
11190
+ buffer_add_value_full ( buf , & frame -> actual_method -> klass -> byval_arg , * frame -> frame_context -> thisArg , frame -> domain , FALSE, NULL );
11247
11191
#endif
11248
11192
}
11249
11193
}
@@ -11365,8 +11309,7 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
11365
11309
set_var (& frame -> actual_method -> klass -> this_arg , var , & frame -> ctx , frame -> domain , val_buf , frame -> reg_locations , & tls -> restore_state .ctx );
11366
11310
}
11367
11311
#else
11368
- GetVariable (tls , frame , kMethodVariableKind_This , 0 , & t , & var );
11369
- il2cpp_set_var (val_buf , var , & frame -> actual_method -> klass -> this_arg );
11312
+ il2cpp_set_var (val_buf , * frame -> frame_context -> thisArg , & frame -> actual_method -> klass -> this_arg );
11370
11313
#endif
11371
11314
break ;
11372
11315
}
0 commit comments