From 8d1689508d8b9b45decd4dd0507d46ba12dfce2e Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 24 Dec 2008 13:39:16 +0000 Subject: [PATCH] * error.c, vm_dump.c: change message by rb_bug(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ error.c | 7 +++++++ vm_dump.c | 26 ++++++++++++++++++++------ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 141eaee793..4269f71def 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Dec 24 22:36:06 2008 Koichi Sasada + + * error.c, vm_dump.c: change message by rb_bug(). + Wed Dec 24 21:57:39 2008 Koichi Sasada * compile.c (iseq_peephole_optimize): fix typo. diff --git a/error.c b/error.c index b6ab8c4959..df4b0cc671 100644 --- a/error.c +++ b/error.c @@ -207,10 +207,17 @@ report_bug(const char *file, int line, const char *fmt, va_list args) if (fwrite(buf, 1, len, out) == len || fwrite(buf, 1, len, (out = stdout)) == len) { + fputs("[BUG] ", out); vfprintf(out, fmt, args); fprintf(out, "\n%s\n\n", ruby_description); + rb_vm_bugreport(); + + fprintf(out, + "[NOTE]\n" + "You may encounter a bug of Ruby interpreter. Bug reports are welcome.\n" + "For details: http://www.ruby-lang.org/bugreport.html\n\n"); } } diff --git a/vm_dump.c b/vm_dump.c index d922b5beab..2098f129dd 100644 --- a/vm_dump.c +++ b/vm_dump.c @@ -580,9 +580,16 @@ rb_vm_bugreport(void) SDR(); bt = rb_make_backtrace(); - if (TYPE(bt) == T_ARRAY) - for (i = 0; i < RARRAY_LEN(bt); i++) { - dp(RARRAY_PTR(bt)[i]); + + if (bt) { + fprintf(stderr, "-- Ruby level backtrace information" + "-----------------------------------------\n"); + + for (i = 0; i < RARRAY_LEN(bt); i++) { + VALUE str = RARRAY_PTR(bt)[i]; + fprintf(stderr, "%s\n", RSTRING_PTR(str)); + } + fprintf(stderr, "\n"); } } @@ -592,13 +599,20 @@ rb_vm_bugreport(void) { static void *trace[MAX_NATIVE_TRACE]; int n = backtrace(trace, MAX_NATIVE_TRACE); + char **syms = backtrace_symbols(trace, n); int i; - fprintf(stderr, "-- backtrace of native function call (Use addr2line) --\n"); + fprintf(stderr, "-- C level backtrace information " + "-------------------------------------------\n"); for (i=0; i