summaryrefslogtreecommitdiff
path: root/vm_dump.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-11 17:13:18 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-11 17:13:18 +0000
commita6455f2994994a44212eeb3693940065c5acbe7f (patch)
tree89119e96fff87cc24eb9cccff7ac99ab57d4e6d7 /vm_dump.c
parentb5e9c6cb903aa550713f5f5764964560f98e180f (diff)
Experimentally recommit of r38041: specify smaller max length
* vm_dump.c (rb_vm_bugreport): get rid of calling methods in sigsegv handler. based on a patch by charliesome (Charlie Somerville) [ruby-core:49573] [Bug #7402] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_dump.c')
-rw-r--r--vm_dump.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/vm_dump.c b/vm_dump.c
index 1c1a36e..55290e4 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -675,14 +675,26 @@ rb_vm_bugreport(void)
if (vm) {
int i;
VALUE name;
+ long len;
+ const int max_name_length = 128;
+# define LIMITED_NAME_LENGTH(s) \
+ (((len = RSTRING_LEN(s)) > max_name_length) ? max_name_length : (int)len)
name = vm->progname;
- fprintf(stderr, "* Loaded script: %s\n", StringValueCStr(name));
+ fprintf(stderr, "* Loaded script: %s\n",
+ RSTRING_PTR(name));
fprintf(stderr, "\n");
fprintf(stderr, "* Loaded features:\n\n");
for (i=0; i<RARRAY_LEN(vm->loaded_features); i++) {
name = RARRAY_PTR(vm->loaded_features)[i];
- fprintf(stderr, " %4d %s\n", i, StringValueCStr(name));
+ if (RB_TYPE_P(name, T_STRING)) {
+ fprintf(stderr, " %4d %.*s\n", i,
+ LIMITED_NAME_LENGTH(name), RSTRING_PTR(name));
+ }
+ else {
+ fprintf(stderr, " %4d #<%s:%p>\n", i,
+ rb_class2name(CLASS_OF(name)), (void *)name);
+ }
}
fprintf(stderr, "\n");
}