vm_dump.c: no new strings in signal context

* vm_dump.c (rb_vm_bugreport): get rid of making new strings
  inside signal context.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-02-28 06:44:22 +00:00
Родитель badb4de72a
Коммит dbffdff1e7
2 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -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);