Output parent object info when marking T_NONE

This commit is contained in:
Peter Zhu 2025-09-02 13:37:53 +02:00
parent 8c73da9e66
commit 636da19e2b
2 changed files with 10 additions and 2 deletions

View File

@ -4395,7 +4395,15 @@ gc_mark_check_t_none(rb_objspace_t *objspace, VALUE obj)
char obj_info_buf[256];
rb_raw_obj_info(obj_info_buf, 256, obj);
rb_bug("try to mark T_NONE object (obj: %s)", obj_info_buf);
char parent_obj_info_buf[256];
if (objspace->rgengc.parent_object == Qfalse) {
strcpy(parent_obj_info_buf, "(none)");
}
else {
rb_raw_obj_info(parent_obj_info_buf, 256, objspace->rgengc.parent_object);
}
rb_bug("try to mark T_NONE object (obj: %s, parent: %s)", obj_info_buf, parent_obj_info_buf);
}
}

View File

@ -58,7 +58,7 @@ RUBY_SYMBOL_EXPORT_BEGIN
// files in Ruby.
size_t rb_size_mul_or_raise(size_t x, size_t y, VALUE exc);
void rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data);
void rb_obj_info_dump(VALUE obj);
const char *rb_raw_obj_info(char *const buff, const size_t buff_size, VALUE obj);
const char *rb_obj_info(VALUE obj);
size_t rb_obj_memsize_of(VALUE obj);
bool ruby_free_at_exit_p(void);