diff options
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 4 | ||||
-rw-r--r-- | vm_dump.c | 17 |
2 files changed, 11 insertions, 10 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 9e8978fd05..12879c3b8b 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -513,7 +513,9 @@ class TestRubyOptions < Test::Unit::TestCase status = assert_in_out_err(['-e', 'class Bogus; def to_str; exit true; end; end', '-e', '$".unshift Bogus.new', '-e', 'Process.kill :SEGV, $$'], - "", //, /#<Bogus:/) + "", //, /#<Bogus:/, + nil, + opts) assert_not_predicate(status, :success?, "segv but success #{bug7402}") end @@ -675,22 +675,21 @@ rb_vm_bugreport(void) if (vm) { int i; VALUE name; + long len; + const int max_name_length = 1024; +# define LIMITED_NAME_LENGTH(s) \ + (((len = RSTRING_LEN(s)) > max_name_length) ? max_name_length : (int)len) name = vm->progname; - if (RB_TYPE_P(name, T_STRING)) { - fprintf(stderr, "* Loaded script: %s\n", RSTRING_PTR(name)); - } - else { - fprintf(stderr, "* Loaded script: #<%s:%p>\n", - rb_class2name(CLASS_OF(name)), (void *)name); - } + fprintf(stderr, "* Loaded script: %.*s\n", + LIMITED_NAME_LENGTH(name), 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]; if (RB_TYPE_P(name, T_STRING)) { - fprintf(stderr, " %4d %s\n", i, - RSTRING_PTR(name)); + fprintf(stderr, " %4d %.*s\n", i, + LIMITED_NAME_LENGTH(name), RSTRING_PTR(name)); } else { fprintf(stderr, " %4d #<%s:%p>\n", i, |