aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--vm_dump.c13
2 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e4f5deb3c..89dcedefd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/vm_dump.c b/vm_dump.c
index da2e6a951d..a0d8bcb4d1 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -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);