Skip to content

Commit

Permalink
[mono][debugger]Adding more information about the array type (#89304)
Browse files Browse the repository at this point in the history
* Adding more information about the array type.

* Adding more changes

* Update src/mono/mono/component/debugger-agent.c

* Only add this info for icordbg.

---------

Co-authored-by: Larry Ewing <lewing@microsoft.com>
  • Loading branch information
thaystg and lewing authored Aug 14, 2023
1 parent e9c4d48 commit b0d4502
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b0d4502

Please sign in to comment.