1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
ko1 2008-12-24 13:39:16 +00:00
parent 155149109a
commit 8d1689508d
3 changed files with 31 additions and 6 deletions

View file

@ -1,3 +1,7 @@
Wed Dec 24 22:36:06 2008 Koichi Sasada <ko1@atdot.net>
* error.c, vm_dump.c: change message by rb_bug().
Wed Dec 24 21:57:39 2008 Koichi Sasada <ko1@atdot.net>
* compile.c (iseq_peephole_optimize): fix typo.

View file

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

View file

@ -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<n; i++) {
fprintf(stderr, "%p\n", trace[i]);
char *info = syms ? syms[i] : "";
fprintf(stderr, "%p %s\n", trace[i], info);
}
fprintf(stderr, "\n");
if (syms) {
free(syms);
}
fprintf(stderr, "-------------------------------------------------------\n");
}
#endif
}