@@ -3787,7 +3787,7 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx
3787
3787
default :
3788
3788
g_assert_not_reached ();
3789
3789
}
3790
- #ifdef HOST_WASI
3790
+ #ifdef HOST_WASI
3791
3791
resumed_from_wasi = FALSE;
3792
3792
while (suspend_policy != SUSPEND_POLICY_NONE && !resumed_from_wasi )
3793
3793
{
@@ -4122,7 +4122,14 @@ jit_end (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo)
4122
4122
dbg_unlock ();
4123
4123
4124
4124
if (assembly ) {
4125
- process_profiler_event (EVENT_KIND_ASSEMBLY_LOAD , assembly );
4125
+ DebuggerTlsData * tls ;
4126
+ tls = (DebuggerTlsData * )mono_native_tls_get_value (debugger_tls_id );
4127
+ if (tls -> invoke == NULL ) {
4128
+ process_profiler_event (EVENT_KIND_ASSEMBLY_LOAD , assembly );
4129
+ } else {
4130
+ assembly_load (prof , assembly ); //send later
4131
+ break ;
4132
+ }
4126
4133
} else {
4127
4134
break ;
4128
4135
}
@@ -5043,20 +5050,16 @@ buffer_add_info_for_null_value (Buffer* buf, MonoType* t, MonoDomain* domain)
5043
5050
{
5044
5051
buffer_add_byte (buf , t -> type );
5045
5052
switch (t -> type ) {
5046
- case MONO_TYPE_CLASS :
5047
- case MONO_TYPE_STRING :
5048
- buffer_add_typeid (buf , domain , mono_class_from_mono_type_internal (t ));
5049
- break ;
5050
- case MONO_TYPE_SZARRAY :
5051
- case MONO_TYPE_ARRAY :
5052
- buffer_add_byte (buf , m_class_get_byval_arg (m_class_get_element_class (mono_class_from_mono_type_internal (t )))-> type );
5053
- buffer_add_int (buf , m_class_get_rank (mono_class_from_mono_type_internal (t )));
5054
- if (m_class_get_byval_arg (m_class_get_element_class (mono_class_from_mono_type_internal (t )))-> type == MONO_TYPE_CLASS )
5055
- buffer_add_typeid (buf , domain , m_class_get_element_class (mono_class_from_mono_type_internal (t )));
5056
- buffer_add_typeid (buf , domain , mono_class_from_mono_type_internal (t ));
5057
- break ;
5058
- default :
5059
- buffer_add_typeid (buf , domain , mono_class_from_mono_type_internal (t ));
5053
+ case MONO_TYPE_SZARRAY :
5054
+ case MONO_TYPE_ARRAY :
5055
+ buffer_add_byte (buf , m_class_get_byval_arg (m_class_get_element_class (mono_class_from_mono_type_internal (t )))-> type );
5056
+ buffer_add_int (buf , m_class_get_rank (mono_class_from_mono_type_internal (t )));
5057
+ if (m_class_get_byval_arg (m_class_get_element_class (mono_class_from_mono_type_internal (t )))-> type == MONO_TYPE_CLASS )
5058
+ buffer_add_typeid (buf , domain , m_class_get_element_class (mono_class_from_mono_type_internal (t )));
5059
+ buffer_add_typeid (buf , domain , mono_class_from_mono_type_internal (t ));
5060
+ break ;
5061
+ default :
5062
+ buffer_add_typeid (buf , domain , mono_class_from_mono_type_internal (t ));
5060
5063
}
5061
5064
}
5062
5065
/*
@@ -5073,6 +5076,9 @@ buffer_add_value_full (Buffer *buf, MonoType *t, void *addr, MonoDomain *domain,
5073
5076
MonoObject * obj ;
5074
5077
gboolean boxed_vtype = FALSE;
5075
5078
5079
+ if (CHECK_ICORDBG (TRUE))
5080
+ buffer_add_byte (buf , !!m_type_is_byref (t ));
5081
+
5076
5082
if (m_type_is_byref (t )) {
5077
5083
if (!(* (void * * )addr )) {
5078
5084
/* This can happen with compiler generated locals */
@@ -5273,6 +5279,8 @@ buffer_add_value_full (Buffer *buf, MonoType *t, void *addr, MonoDomain *domain,
5273
5279
if (mono_vtype_get_field_addr (addr , f ) == addr && mono_class_from_mono_type_internal (t ) == mono_class_from_mono_type_internal (f -> type ) && !boxed_vtype ) //to avoid infinite recursion
5274
5280
{
5275
5281
gssize val = * (gssize * )addr ;
5282
+ if (CHECK_ICORDBG (TRUE))
5283
+ buffer_add_byte (buf , !!m_type_is_byref (f -> type ));
5276
5284
buffer_add_byte (buf , MONO_TYPE_PTR );
5277
5285
buffer_add_long (buf , val );
5278
5286
if (CHECK_PROTOCOL_VERSION (2 , 46 ))
@@ -7092,6 +7100,8 @@ vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf)
7092
7100
minor_version = decode_int (p , & p , end );
7093
7101
if (p < end )
7094
7102
using_icordbg = decode_byte (p , & p , end );
7103
+ if (using_icordbg )
7104
+ mono_de_set_using_icordbg ();
7095
7105
protocol_version_set = TRUE;
7096
7106
PRINT_DEBUG_MSG (1 , "[dbg] Protocol version %d.%d, client protocol version %d.%d.\n" , MAJOR_VERSION , MINOR_VERSION , major_version , minor_version );
7097
7107
break ;
@@ -7115,7 +7125,7 @@ vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf)
7115
7125
wait_for_suspend ();
7116
7126
break ;
7117
7127
case CMD_VM_RESUME :
7118
- #ifndef HOST_WASI
7128
+ #ifndef HOST_WASI
7119
7129
if (suspend_count == 0 ) {
7120
7130
if (agent_config .defer && !agent_config .suspend )
7121
7131
// Workaround for issue in debugger-libs when running in defer attach mode.
@@ -7703,7 +7713,7 @@ event_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
7703
7713
7704
7714
if (req -> event_kind == EVENT_KIND_BREAKPOINT ) {
7705
7715
g_assert (method );
7706
-
7716
+
7707
7717
req -> info = mono_de_set_breakpoint (method , location , req , error );
7708
7718
if (!is_ok (error )) {
7709
7719
g_free (req );
@@ -7940,6 +7950,42 @@ domain_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
7940
7950
buffer_add_objid (buf , o );
7941
7951
break ;
7942
7952
}
7953
+ case MDBGPROT_CMD_APPDOMAIN_GET_ARRAY_OR_POINTER_TYPE : {
7954
+ MonoClass * klass ;
7955
+ domain = decode_domainid (p , & p , end , NULL , & err );
7956
+ MonoTypeEnum type = decode_int (p , & p , end );
7957
+ klass = decode_typeid (p , & p , end , NULL , & err );
7958
+ int rank = decode_int (p , & p , end );
7959
+ if (type == MONO_TYPE_SZARRAY || type == MONO_TYPE_ARRAY )
7960
+ klass = mono_class_create_array (klass , rank );
7961
+ else
7962
+ return ERR_INVALID_ARGUMENT ;
7963
+ buffer_add_typeid (buf , domain , klass );
7964
+ break ;
7965
+ }
7966
+
7967
+ case MDBGPROT_CMD_APPDOMAIN_CREATE_ARRAY : {
7968
+ ERROR_DECL (error );
7969
+ MonoClass * klass ;
7970
+ MonoArray * arr ;
7971
+ domain = decode_domainid (p , & p , end , NULL , & err );
7972
+ klass = decode_typeid (p , & p , end , NULL , & err );
7973
+ int rank = decode_int (p , & p , end );
7974
+ uintptr_t * lengths = g_newa (uintptr_t , rank );
7975
+ intptr_t * lower_bounds = g_newa (intptr_t , rank );
7976
+ for (int i = 0 ; i < rank ; i ++ )
7977
+ {
7978
+ lengths [i ] = decode_int (p , & p , end );
7979
+ }
7980
+ for (int i = 0 ; i < rank ; i ++ )
7981
+ {
7982
+ lower_bounds [i ] = decode_int (p , & p , end );
7983
+ }
7984
+ arr = mono_array_new_full_checked (klass , lengths , lower_bounds , error );
7985
+ buffer_add_objid (buf , (MonoObject * ) arr );
7986
+ break ;
7987
+ }
7988
+
7943
7989
default :
7944
7990
return ERR_NOT_IMPLEMENTED ;
7945
7991
}
@@ -8282,6 +8328,21 @@ field_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
8282
8328
}
8283
8329
break ;
8284
8330
}
8331
+ case MDBGPROT_CMD_FIELD_GET_TOKEN_AND_TYPE : {
8332
+ MonoClassField * f = decode_fieldid (p , & p , end , & domain , & err );
8333
+ if (G_UNLIKELY (!f -> type )) {
8334
+ ERROR_DECL (field_error );
8335
+ mono_field_resolve_type (f , field_error );
8336
+ mono_error_cleanup (field_error );
8337
+ if (!f -> type )
8338
+ return ERR_INVALID_OBJECT ;
8339
+ }
8340
+ buffer_add_int (buf , mono_class_get_field_token (f ));
8341
+ buffer_add_byte (buf , GINT_TO_UINT8 (m_class_is_valuetype (mono_class_from_mono_type_internal (f -> type ))));
8342
+ buffer_add_int (buf , f -> type -> type );
8343
+ buffer_add_typeid (buf , domain , mono_class_from_mono_type_internal (f -> type ));
8344
+ break ;
8345
+ }
8285
8346
default :
8286
8347
return ERR_NOT_IMPLEMENTED ;
8287
8348
}
@@ -8471,6 +8532,19 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
8471
8532
buffer_add_int (buf , 0 );
8472
8533
}
8473
8534
}
8535
+ if (CHECK_ICORDBG (TRUE))
8536
+ {
8537
+ if (type -> type == MONO_TYPE_FNPTR )
8538
+ {
8539
+ buffer_add_int (buf , 1 + type -> data .method -> param_count );
8540
+ buffer_add_typeid (buf , domain , mono_class_from_mono_type_internal (type -> data .method -> ret ));
8541
+ for (int j = 0 ; j < type -> data .method -> param_count ; ++ j ) {
8542
+ buffer_add_typeid (buf , domain , mono_class_from_mono_type_internal (type -> data .method -> params [j ]));
8543
+ }
8544
+ } else {
8545
+ buffer_add_int (buf , 0 );
8546
+ }
8547
+ }
8474
8548
break ;
8475
8549
}
8476
8550
case CMD_TYPE_GET_METHODS : {
@@ -8886,43 +8960,8 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
8886
8960
if (CHECK_ICORDBG (TRUE))
8887
8961
{
8888
8962
buffer_add_byte (buf , GINT_TO_UINT8 (m_class_is_valuetype (klass )));
8889
- if (m_class_is_valuetype (klass ))
8890
- {
8891
- int nfields = 0 ;
8892
- gpointer iter = NULL ;
8893
- while ((f = mono_class_get_fields_internal (klass , & iter ))) {
8894
- if (G_UNLIKELY (!f -> type )) {
8895
- ERROR_DECL (field_error );
8896
- mono_field_resolve_type (f , field_error );
8897
- mono_error_cleanup (field_error );
8898
- if (!f -> type )
8899
- continue ;
8900
- }
8901
- if (f -> type -> attrs & FIELD_ATTRIBUTE_STATIC )
8902
- continue ;
8903
- if (mono_field_is_deleted (f ))
8904
- continue ;
8905
- nfields ++ ;
8906
- }
8907
- buffer_add_int (buf , nfields );
8908
-
8909
- iter = NULL ;
8910
- while ((f = mono_class_get_fields_internal (klass , & iter ))) {
8911
- if (G_UNLIKELY (!f -> type )) {
8912
- ERROR_DECL (field_error );
8913
- mono_field_resolve_type (f , field_error );
8914
- mono_error_cleanup (field_error );
8915
- if (!f -> type )
8916
- continue ;
8917
- }
8918
- if (f -> type -> attrs & FIELD_ATTRIBUTE_STATIC )
8919
- continue ;
8920
- if (mono_field_is_deleted (f ))
8921
- continue ;
8922
- buffer_add_int (buf , mono_class_get_field_token (f ));
8923
- buffer_add_byte (buf , f -> type -> type );
8924
- }
8925
- }
8963
+ buffer_add_int (buf , m_class_get_byval_arg (klass )-> type );
8964
+ buffer_add_typeid (buf , domain , klass );
8926
8965
}
8927
8966
break ;
8928
8967
}
@@ -9002,6 +9041,33 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
9002
9041
buffer_add_byte (buf , m_class_get_rank (klass ));
9003
9042
break ;
9004
9043
}
9044
+ case MDBGPROT_CMD_TYPE_GET_FIELD_RVA :
9045
+ {
9046
+ gpointer iter = NULL ;
9047
+ int field_token = decode_int (p , & p , end );
9048
+ while ((f = mono_class_get_fields_internal (klass , & iter ))) {
9049
+ if (mono_class_get_field_token (f ) == field_token )
9050
+ {
9051
+ if (G_UNLIKELY (!f -> type )) {
9052
+ ERROR_DECL (field_error );
9053
+ mono_field_resolve_type (f , field_error );
9054
+ mono_error_cleanup (field_error );
9055
+ if (!f -> type )
9056
+ continue ;
9057
+ }
9058
+ if (f -> type -> attrs & FIELD_ATTRIBUTE_HAS_FIELD_RVA )
9059
+ {
9060
+ gint32 count = 0 ;
9061
+ const char * arr = mono_get_span_data_from_field (f , f -> type , f -> type , & count );
9062
+ m_dbgprot_buffer_add_byte_array (buf , (uint8_t * )arr , count );
9063
+ err = ERR_NONE ;
9064
+ goto exit ;
9065
+ }
9066
+ }
9067
+ }
9068
+ m_dbgprot_buffer_add_int (buf , 0 );
9069
+ break ;
9070
+ }
9005
9071
default :
9006
9072
err = ERR_NOT_IMPLEMENTED ;
9007
9073
goto exit ;
@@ -10181,7 +10247,7 @@ array_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
10181
10247
MonoTypeEnum type = m_class_get_byval_arg (m_class_get_element_class (arr -> obj .vtable -> klass ))-> type ;
10182
10248
buffer_add_byte (buf , type );
10183
10249
buffer_add_int (buf , m_class_get_rank (arr -> obj .vtable -> klass ));
10184
- if (type == MONO_TYPE_CLASS || type == MONO_TYPE_GENERICINST || type == MONO_TYPE_OBJECT )
10250
+ if (type == MONO_TYPE_CLASS || type == MONO_TYPE_GENERICINST || type == MONO_TYPE_OBJECT || ( CHECK_ICORDBG (TRUE) && ( type == MONO_TYPE_VALUETYPE || type == MONO_TYPE_PTR )) )
10185
10251
{
10186
10252
buffer_add_typeid (buf , arr -> obj .vtable -> domain , m_class_get_element_class (arr -> obj .vtable -> klass ));
10187
10253
if (CHECK_ICORDBG (TRUE))
@@ -10389,8 +10455,7 @@ object_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
10389
10455
break ;
10390
10456
}
10391
10457
}
10392
- if (!k )
10393
- goto invalid_fieldid ;
10458
+
10394
10459
while ((f = mono_class_get_fields_internal (k , & iter ))) {
10395
10460
if (mono_class_get_field_token (f ) == field_token ) {
10396
10461
goto get_field_value ;
0 commit comments