122
122
#ifdef RUNTIME_IL2CPP
123
123
extern Il2CppMonoDefaults il2cpp_mono_defaults ;
124
124
extern Il2CppMonoDebugOptions il2cpp_mono_debug_options ;
125
- const Il2CppDebuggerMetadataRegistration * g_il2cpp_metadata ;
126
125
#endif
127
126
128
127
@@ -2300,10 +2299,9 @@ static GPtrArray *ids [ID_NUM];
2300
2299
2301
2300
static GHashTable * s_jit_info_hashtable ;
2302
2301
2303
- void mono_debugger_il2cpp_init (const Il2CppDebuggerMetadataRegistration * data )
2302
+ void mono_debugger_il2cpp_init ()
2304
2303
{
2305
2304
s_jit_info_hashtable = g_hash_table_new_full (mono_aligned_addr_hash , NULL , NULL , NULL );
2306
- g_il2cpp_metadata = data ;
2307
2305
debug_options .native_debugger_break = FALSE;
2308
2306
}
2309
2307
@@ -3882,7 +3880,7 @@ static void
3882
3880
#ifndef RUNTIME_IL2CPP
3883
3881
process_event (EventKind event , gpointer arg , gint32 il_offset , MonoContext * ctx , GSList * events , int suspend_policy )
3884
3882
#else
3885
- process_event (EventKind event , gpointer arg , gint32 il_offset , MonoContext * ctx , GSList * events , int suspend_policy , uint64_t il2cpp_seqpoint_id )
3883
+ process_event (EventKind event , gpointer arg , gint32 il_offset , MonoContext * ctx , GSList * events , int suspend_policy , Il2CppSequencePoint * sequencePoint )
3886
3884
#endif
3887
3885
{
3888
3886
Buffer buf ;
@@ -3973,7 +3971,7 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx
3973
3971
case EVENT_KIND_METHOD_EXIT :
3974
3972
buffer_add_methodid (& buf , domain , (MonoMethod * )arg );
3975
3973
#if defined(RUNTIME_IL2CPP ) && defined(IL2CPP_DEBUGGER_TESTS )
3976
- buffer_add_long (& buf , il2cpp_seqpoint_id );
3974
+ buffer_add_long (& buf , sequencePoint -> id );
3977
3975
#endif
3978
3976
break ;
3979
3977
case EVENT_KIND_ASSEMBLY_LOAD :
@@ -3998,7 +3996,7 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx
3998
3996
buffer_add_methodid (& buf , domain , (MonoMethod * )arg );
3999
3997
buffer_add_long (& buf , il_offset );
4000
3998
#if defined(RUNTIME_IL2CPP ) && defined(IL2CPP_DEBUGGER_TESTS )
4001
- buffer_add_long (& buf , il2cpp_seqpoint_id );
3999
+ buffer_add_long (& buf , sequencePoint -> id );
4002
4000
#endif
4003
4001
break ;
4004
4002
case EVENT_KIND_VM_START :
@@ -4012,7 +4010,7 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx
4012
4010
DebuggerEventInfo * ei = (DebuggerEventInfo * )arg ;
4013
4011
buffer_add_objid (& buf , ei -> exc );
4014
4012
#if defined(RUNTIME_IL2CPP ) && defined(IL2CPP_DEBUGGER_TESTS )
4015
- buffer_add_long (& buf , il2cpp_seqpoint_id );
4013
+ buffer_add_long (& buf , sequencePoint -> id );
4016
4014
#endif
4017
4015
/*
4018
4016
* We are not yet suspending, so get_objref () will not keep this object alive. So we need to do it
@@ -4117,7 +4115,7 @@ process_profiler_event (EventKind event, gpointer arg)
4117
4115
#ifndef RUNTIME_IL2CPP
4118
4116
process_event (event , arg , 0 , NULL , events , suspend_policy );
4119
4117
#else
4120
- process_event (event , arg , 0 , NULL , events , suspend_policy , 0 );
4118
+ process_event (event , arg , 0 , NULL , events , suspend_policy , NULL );
4121
4119
#endif
4122
4120
}
4123
4121
@@ -5719,7 +5717,7 @@ mono_debugger_agent_user_break (void)
5719
5717
#ifndef RUNTIME_IL2CPP
5720
5718
process_event (EVENT_KIND_USER_BREAK , NULL , 0 , & ctx , events , suspend_policy );
5721
5719
#else
5722
- process_event (EVENT_KIND_USER_BREAK , NULL , 0 , & ctx , events , suspend_policy , 0 );
5720
+ process_event (EVENT_KIND_USER_BREAK , NULL , 0 , & ctx , events , suspend_policy , NULL );
5723
5721
#endif
5724
5722
} else if (debug_options .native_debugger_break ) {
5725
5723
G_BREAKPOINT ();
@@ -5746,7 +5744,7 @@ static void
5746
5744
#ifndef RUNTIME_IL2CPP
5747
5745
process_single_step_inner (DebuggerTlsData * tls , gboolean from_signal )
5748
5746
#else
5749
- process_single_step_inner (DebuggerTlsData * tls , gboolean from_signal , int sequencePointId )
5747
+ process_single_step_inner (DebuggerTlsData * tls , gboolean from_signal , Il2CppSequencePoint * sequencePoint )
5750
5748
#endif
5751
5749
{
5752
5750
MonoJitInfo * ji ;
@@ -5862,7 +5860,7 @@ process_single_step_inner (DebuggerTlsData *tls, gboolean from_signal, int seque
5862
5860
#ifndef RUNTIME_IL2CPP
5863
5861
events = create_event_list (EVENT_KIND_STEP , reqs , ji , NULL , & suspend_policy );
5864
5862
#else
5865
- events = create_event_list (EVENT_KIND_STEP , reqs , il2cpp_get_sequence_point ( sequencePointId ) , NULL , & suspend_policy );
5863
+ events = create_event_list (EVENT_KIND_STEP , reqs , sequencePoint , NULL , & suspend_policy );
5866
5864
#endif
5867
5865
5868
5866
g_ptr_array_free (reqs , TRUE);
@@ -5898,7 +5896,7 @@ process_single_step_inner (DebuggerTlsData *tls, gboolean from_signal, int seque
5898
5896
if (!ss_update_il2cpp (ss_req ,tls ,ctx ,sequence_pt ))
5899
5897
return ;
5900
5898
5901
- process_event (EVENT_KIND_STEP , sp_method , sequence_pt -> ilOffset , NULL , events , suspend_policy , sequencePointId );
5899
+ process_event (EVENT_KIND_STEP , sp_method , sequence_pt -> ilOffset , NULL , events , suspend_policy , sequencePoint );
5902
5900
#endif
5903
5901
}
5904
5902
@@ -5943,7 +5941,7 @@ void
5943
5941
#ifndef RUNTIME_IL2CPP
5944
5942
debugger_agent_single_step_from_context (MonoContext * ctx )
5945
5943
#else
5946
- debugger_agent_single_step_from_context (MonoContext * ctx , int sequencePointId )
5944
+ debugger_agent_single_step_from_context (MonoContext * ctx , Il2CppSequencePoint * sequencePoint )
5947
5945
#endif
5948
5946
{
5949
5947
DebuggerTlsData * tls ;
@@ -5972,7 +5970,7 @@ debugger_agent_single_step_from_context (MonoContext *ctx, int sequencePointId)
5972
5970
#else
5973
5971
save_thread_context (NULL );
5974
5972
5975
- process_single_step_inner (tls , FALSE, sequencePointId );
5973
+ process_single_step_inner (tls , FALSE, sequencePoint );
5976
5974
#endif
5977
5975
}
5978
5976
@@ -6745,7 +6743,7 @@ mono_debugger_agent_debug_log (int level, MonoString *category, MonoString *mess
6745
6743
#ifndef RUNTIME_IL2CPP
6746
6744
process_event (EVENT_KIND_USER_LOG , & ei , 0 , NULL , events , suspend_policy );
6747
6745
#else
6748
- process_event (EVENT_KIND_USER_LOG , & ei , 0 , NULL , events , suspend_policy , 0 );
6746
+ process_event (EVENT_KIND_USER_LOG , & ei , 0 , NULL , events , suspend_policy , NULL );
6749
6747
#endif
6750
6748
6751
6749
g_free (ei .category );
@@ -6780,7 +6778,7 @@ mono_debugger_agent_unhandled_exception (MonoException *exc)
6780
6778
#ifndef RUNTIME_IL2CPP
6781
6779
process_event (EVENT_KIND_EXCEPTION , & ei , 0 , NULL , events , suspend_policy );
6782
6780
#else
6783
- process_event (EVENT_KIND_EXCEPTION , & ei , 0 , NULL , events , suspend_policy , 0 );
6781
+ process_event (EVENT_KIND_EXCEPTION , & ei , 0 , NULL , events , suspend_policy , NULL );
6784
6782
#endif
6785
6783
}
6786
6784
#endif
@@ -6930,7 +6928,7 @@ unity_debugger_agent_handle_exception(MonoException *exc, Il2CppSequencePoint *s
6930
6928
}
6931
6929
}
6932
6930
6933
- process_event (EVENT_KIND_EXCEPTION , & ei , 0 , NULL , events , suspend_policy , sequencePoint ? sequencePoint -> id : 0 );
6931
+ process_event (EVENT_KIND_EXCEPTION , & ei , 0 , NULL , events , suspend_policy , sequencePoint );
6934
6932
6935
6933
if (tls )
6936
6934
tls -> exception = NULL ;
@@ -6975,7 +6973,7 @@ mono_debugger_agent_handle_exception (MonoException *exc, MonoContext *throw_ctx
6975
6973
#ifndef RUNTIME_IL2CPP
6976
6974
process_event (EVENT_KIND_EXCEPTION , & ei , 0 , throw_ctx , events , SUSPEND_POLICY_ALL );
6977
6975
#else
6978
- process_event (EVENT_KIND_EXCEPTION , & ei , 0 , throw_ctx , events , SUSPEND_POLICY_ALL , 0 );
6976
+ process_event (EVENT_KIND_EXCEPTION , & ei , 0 , throw_ctx , events , SUSPEND_POLICY_ALL , NULL );
6979
6977
#endif
6980
6978
return ;
6981
6979
}
@@ -7004,7 +7002,7 @@ mono_debugger_agent_handle_exception (MonoException *exc, MonoContext *throw_ctx
7004
7002
#ifndef RUNTIME_IL2CPP
7005
7003
process_event (EVENT_KIND_EXCEPTION , & ei , 0 , throw_ctx , events , SUSPEND_POLICY_ALL );
7006
7004
#else
7007
- process_event (EVENT_KIND_EXCEPTION , & ei , 0 , throw_ctx , events , SUSPEND_POLICY_ALL , 0 );
7005
+ process_event (EVENT_KIND_EXCEPTION , & ei , 0 , throw_ctx , events , SUSPEND_POLICY_ALL , NULL );
7008
7006
#endif
7009
7007
return ;
7010
7008
}
@@ -7064,7 +7062,7 @@ mono_debugger_agent_handle_exception (MonoException *exc, MonoContext *throw_ctx
7064
7062
#ifndef RUNTIME_IL2CPP
7065
7063
process_event (EVENT_KIND_EXCEPTION , & ei , 0 , throw_ctx , events , suspend_policy );
7066
7064
#else
7067
- process_event (EVENT_KIND_EXCEPTION , & ei , 0 , throw_ctx , events , suspend_policy , 0 );
7065
+ process_event (EVENT_KIND_EXCEPTION , & ei , 0 , throw_ctx , events , suspend_policy , NULL );
7068
7066
#endif
7069
7067
7070
7068
if (tls )
@@ -10404,15 +10402,17 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g
10404
10402
buffer_add_int (buf , uniqueFileSequencePoints -> len );
10405
10403
for (i = 0 ; i < uniqueFileSequencePoints -> len ; ++ i ) {
10406
10404
Il2CppSequencePoint * sequencePoint = g_ptr_array_index (uniqueFileSequencePoints , i );
10407
- buffer_add_string (buf , g_il2cpp_metadata -> sequencePointSourceFiles [sequencePoint -> sourceFileIndex ].file );
10405
+ Il2CppSequencePointSourceFile * sourceFile = il2cpp_debug_get_source_file (mono_class_get_image (mono_method_get_class (method )), sequencePoint -> sourceFileIndex );
10406
+ buffer_add_string (buf , sourceFile -> file );
10408
10407
if (CHECK_PROTOCOL_VERSION (2 , 14 )) {
10409
- buffer_add_data (buf , g_il2cpp_metadata -> sequencePointSourceFiles [ sequencePoint -> sourceFileIndex ]. hash , 16 );
10408
+ buffer_add_data (buf , sourceFile -> hash , 16 );
10410
10409
}
10411
10410
}
10412
10411
}
10413
10412
else {
10414
10413
if (uniqueFileSequencePoints -> len > 0 ) {
10415
- buffer_add_string (buf , g_il2cpp_metadata -> sequencePointSourceFiles [((Il2CppSequencePoint * )g_ptr_array_index (uniqueFileSequencePoints , 0 ))-> sourceFileIndex ].file );
10414
+ Il2CppSequencePointSourceFile * sourceFile = il2cpp_debug_get_source_file (mono_class_get_image (mono_method_get_class (method )), ((Il2CppSequencePoint * )g_ptr_array_index (uniqueFileSequencePoints , 0 ))-> sourceFileIndex );
10415
+ buffer_add_string (buf , sourceFile -> file );
10416
10416
} else {
10417
10417
buffer_add_string (buf , "" );
10418
10418
}
@@ -10436,7 +10436,7 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g
10436
10436
if (sequencePoint -> kind == kSequencePointKind_StepOut )
10437
10437
continue ;
10438
10438
10439
- DEBUG_PRINTF (10 , "IL%x -> %s:%d %d %d %d\n" , sequencePoint -> ilOffset , g_il2cpp_metadata -> sequencePointSourceFiles [ sequencePoint -> sourceFileIndex ] ,
10439
+ DEBUG_PRINTF (10 , "IL%x -> %s:%d %d %d %d\n" , sequencePoint -> ilOffset , il2cpp_debug_get_source_file ( mono_class_get_image ( mono_method_get_class ( method )), sequencePoint -> sourceFileIndex ) -> file ,
10440
10440
sequencePoint -> lineStart , sequencePoint -> columnStart , sequencePoint -> lineEnd , sequencePoint -> columnEnd );
10441
10441
buffer_add_int (buf , sequencePoint -> ilOffset );
10442
10442
buffer_add_int (buf , sequencePoint -> lineStart );
@@ -10588,12 +10588,13 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g
10588
10588
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 ))));
10589
10589
10590
10590
for (i = 0 ; i < executionInfoCount ; i ++ )
10591
- buffer_add_string (buf , g_il2cpp_metadata -> methodExecutionContextInfoStrings [ executionContextInfo [i ].nameIndex ] );
10591
+ buffer_add_string (buf , il2cpp_debug_get_local_name ( mono_class_get_image ( mono_method_get_class ( method )), executionContextInfo [i ].nameIndex ) );
10592
10592
10593
10593
for (i = 0 ; i < executionInfoCount ; i ++ )
10594
10594
{
10595
- buffer_add_int (buf , g_il2cpp_metadata -> methodScopes [executionContextInfo [i ].scopeIndex ].startOffset );
10596
- buffer_add_int (buf , g_il2cpp_metadata -> methodScopes [executionContextInfo [i ].scopeIndex ].endOffset );
10595
+ Il2CppMethodScope * scope = il2cpp_debug_get_local_scope (mono_class_get_image (mono_method_get_class (method )), executionContextInfo [i ].scopeIndex );
10596
+ buffer_add_int (buf , scope -> startOffset );
10597
+ buffer_add_int (buf , scope -> endOffset );
10597
10598
}
10598
10599
#endif // !RUNTIME_IL2CPP
10599
10600
break ;
@@ -12308,11 +12309,11 @@ unity_process_breakpoint_inner(DebuggerTlsData *tls, gboolean from_signal, Il2Cp
12308
12309
* resume.
12309
12310
*/
12310
12311
if (ss_events )
12311
- process_event (EVENT_KIND_STEP , method , 0 , ctx , ss_events , suspend_policy , sequencePoint -> id );
12312
+ process_event (EVENT_KIND_STEP , method , 0 , ctx , ss_events , suspend_policy , sequencePoint );
12312
12313
if (bp_events )
12313
- process_event (kind , method , 0 , ctx , bp_events , suspend_policy , sequencePoint -> id );
12314
+ process_event (kind , method , 0 , ctx , bp_events , suspend_policy , sequencePoint );
12314
12315
if (enter_leave_events )
12315
- process_event (kind , method , 0 , ctx , enter_leave_events , suspend_policy , sequencePoint -> id );
12316
+ process_event (kind , method , 0 , ctx , enter_leave_events , suspend_policy , sequencePoint );
12316
12317
}
12317
12318
12318
12319
void
0 commit comments