diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | vm_dump.c | 13 |
2 files changed, 15 insertions, 3 deletions
@@ -1,4 +1,7 @@ -Sat Feb 28 15:42:27 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> +Sat Feb 28 15:44:20 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * vm_dump.c (rb_vm_bugreport): get rid of making new strings + inside signal context. * variable.c (rb_tmp_class_path): defer making temporary class path string. @@ -1000,12 +1000,21 @@ rb_vm_bugreport(const void *ctx) else if (RB_TYPE_P(name, T_CLASS) || RB_TYPE_P(name, T_MODULE)) { const char *const type = RB_TYPE_P(name, T_CLASS) ? "class" : "module"; - name = rb_class_name(name); + name = rb_search_class_path(rb_class_real(name)); + if (!RB_TYPE_P(name, T_STRING)) { + fprintf(stderr, " %4d %s:<unnamed>\n", i, type); + continue; + } fprintf(stderr, " %4d %s:%.*s\n", i, type, LIMITED_NAME_LENGTH(name), RSTRING_PTR(name)); } else { - VALUE klass = rb_class_name(CLASS_OF(name)); + VALUE klass = rb_search_class_path(rb_obj_class(name)); + if (!RB_TYPE_P(klass, T_STRING)) { + fprintf(stderr, " %4d #<%p:%p>\n", i, + (void *)CLASS_OF(name), (void *)name); + continue; + } fprintf(stderr, " %4d #<%.*s:%p>\n", i, LIMITED_NAME_LENGTH(klass), RSTRING_PTR(klass), (void *)name); |