diff --git a/src/mono/mono/component/debugger-agent.c b/src/mono/mono/component/debugger-agent.c index b2a979a56802d..a210242c1eb69 100644 --- a/src/mono/mono/component/debugger-agent.c +++ b/src/mono/mono/component/debugger-agent.c @@ -8709,11 +8709,6 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint goto invalid_object; } buffer_add_objid (buf, o); - if (CHECK_ICORDBG (TRUE)) - { - MonoType *object_type = m_class_get_byval_arg (m_class_get_element_class (klass)); - buffer_add_value (buf, object_type, o, domain); - } break; } case CMD_TYPE_GET_SOURCE_FILES: @@ -8855,10 +8850,36 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint } case CMD_TYPE_CREATE_INSTANCE: { MonoObject *obj; - obj = mono_object_new_checked (klass, error); mono_error_assert_ok (error); buffer_add_objid (buf, obj); + if (CHECK_ICORDBG (TRUE)) + { + buffer_add_byte(buf, m_class_is_valuetype (klass)); + if (m_class_is_valuetype (klass)) + { + int nfields = 0; + gpointer iter = NULL; + while ((f = mono_class_get_fields_internal (klass, &iter))) { + if (f->type->attrs & FIELD_ATTRIBUTE_STATIC) + continue; + if (mono_field_is_deleted (f)) + continue; + nfields ++; + } + buffer_add_int (buf, nfields); + + iter = NULL; + while ((f = mono_class_get_fields_internal (klass, &iter))) { + if (f->type->attrs & FIELD_ATTRIBUTE_STATIC) + continue; + if (mono_field_is_deleted (f)) + continue; + buffer_add_int (buf, mono_class_get_field_token (f)); + buffer_add_byte (buf, f->type->type); + } + } + } break; } case CMD_TYPE_GET_VALUE_SIZE: { @@ -10113,10 +10134,15 @@ array_commands (int command, guint8 *p, guint8 *end, Buffer *buf) switch (command) { case CMD_ARRAY_REF_GET_TYPE: { - buffer_add_byte(buf, m_class_get_byval_arg (m_class_get_element_class (arr->obj.vtable->klass))->type); + MonoTypeEnum type = m_class_get_byval_arg (m_class_get_element_class (arr->obj.vtable->klass))->type; + buffer_add_byte(buf, type); buffer_add_int (buf, m_class_get_rank (arr->obj.vtable->klass)); - if (m_class_get_byval_arg (m_class_get_element_class (arr->obj.vtable->klass))->type == MONO_TYPE_CLASS) + if (type == MONO_TYPE_CLASS || type == MONO_TYPE_GENERICINST || type == MONO_TYPE_OBJECT) + { buffer_add_typeid (buf, arr->obj.vtable->domain, m_class_get_element_class (arr->obj.vtable->klass)); + if (CHECK_ICORDBG (TRUE)) + buffer_add_byte (buf, MONO_TYPE_ISSTRUCT (m_class_get_byval_arg (m_class_get_element_class (arr->obj.vtable->klass)))); + } } break; case CMD_ARRAY_REF_GET_LENGTH: