Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hot reload][debugger] Resolve field types before use #93558

Merged
merged 6 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -5233,6 +5233,13 @@ buffer_add_value_full (Buffer *buf, MonoType *t, void *addr, MonoDomain *domain,
nfields = 0;
iter = NULL;
while ((f = mono_class_get_fields_internal (klass, &iter))) {
if (G_UNLIKELY (!f->type)) {
ERROR_DECL(error);
mono_field_resolve_type (f, error);
mono_error_cleanup (error);
if (!f->type)
continue;
}
if (f->type->attrs & FIELD_ATTRIBUTE_STATIC)
continue;
if (mono_field_is_deleted (f))
Expand All @@ -5250,6 +5257,13 @@ buffer_add_value_full (Buffer *buf, MonoType *t, void *addr, MonoDomain *domain,

iter = NULL;
while ((f = mono_class_get_fields_internal (klass, &iter))) {
if (G_UNLIKELY (!f->type)) {
ERROR_DECL(error);
mono_field_resolve_type (f, error);
mono_error_cleanup (error);
if (!f->type)
continue;
}
if (f->type->attrs & FIELD_ATTRIBUTE_STATIC)
continue;
if (mono_field_is_deleted (f))
Expand Down Expand Up @@ -5351,6 +5365,13 @@ decode_vtype (MonoType *t, MonoDomain *domain, gpointer void_addr, gpointer void

nfields = decode_int (buf, &buf, limit);
while ((f = mono_class_get_fields_internal (klass, &iter))) {
if (G_UNLIKELY (!f->type)) {
ERROR_DECL(error);
mono_field_resolve_type (f, error);
mono_error_cleanup (error);
if (!f->type)
continue;
}
if (f->type->attrs & FIELD_ATTRIBUTE_STATIC)
continue;
if (mono_field_is_deleted (f))
Expand Down Expand Up @@ -5459,6 +5480,13 @@ decode_vtype_compute_size (MonoType *t, MonoDomain *domain, gpointer void_buf, g

nfields = decode_int (buf, &buf, limit);
while ((f = mono_class_get_fields_internal (klass, &iter))) {
if (G_UNLIKELY (!f->type)) {
ERROR_DECL(error);
mono_field_resolve_type (f, error);
mono_error_cleanup (error);
if (!f->type)
continue;
}
if (f->type->attrs & FIELD_ATTRIBUTE_STATIC)
continue;
if (mono_field_is_deleted (f))
Expand Down Expand Up @@ -8476,6 +8504,13 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
buffer_add_int (buf, nfields);

while ((f = mono_class_get_fields_internal (klass, &iter))) {
if (G_UNLIKELY (!f->type)) {
ERROR_DECL(field_error);
mono_field_resolve_type (f, field_error);
mono_error_cleanup (field_error);
if (!f->type)
continue;
}
buffer_add_fieldid (buf, domain, f);
buffer_add_string (buf, f->name);
buffer_add_typeid (buf, domain, mono_class_from_mono_type_internal (f->type));
Expand Down Expand Up @@ -8856,6 +8891,13 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
int nfields = 0;
gpointer iter = NULL;
while ((f = mono_class_get_fields_internal (klass, &iter))) {
if (G_UNLIKELY (!f->type)) {
ERROR_DECL(field_error);
mono_field_resolve_type (f, field_error);
mono_error_cleanup (field_error);
if (!f->type)
continue;
}
if (f->type->attrs & FIELD_ATTRIBUTE_STATIC)
continue;
if (mono_field_is_deleted (f))
Expand All @@ -8866,6 +8908,13 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint

iter = NULL;
while ((f = mono_class_get_fields_internal (klass, &iter))) {
if (G_UNLIKELY (!f->type)) {
ERROR_DECL(field_error);
mono_field_resolve_type (f, field_error);
mono_error_cleanup (field_error);
if (!f->type)
continue;
}
if (f->type->attrs & FIELD_ATTRIBUTE_STATIC)
continue;
if (mono_field_is_deleted (f))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,8 @@ await SendCommandAndCheck (JObject.FromObject(new { }), "Debugger.resume", scrip
await CheckProps (c, new {
Field1 = TNumber(123),
Field2 = TString("spqr"),
}, "c", num_fields: 2);
Field3 = TString(null),
}, "c", num_fields: 3);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public C()
}
public double Field1;
public string Field2;
public string Field3;
lambdageek marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
Loading