static void report_bug(const char *file, int line, const char *fmt, va_list args) { /* SIGSEGV handler might have a very small stack. Thus we need to use it carefully. */ char buf[256]; FILE *out = stderr; int len = err_position_0(buf, 256, file, line); if ((ssize_t)fwrite(buf, 1, len, out) == (ssize_t)len || (ssize_t)fwrite(buf, 1, len, (out = stdout)) == (ssize_t)len) { fputs("[BUG] ", out); vsnprintf(buf, 256, fmt, args); fputs(buf, out); snprintf(buf, 256, "\n%s\n\n", ruby_description); fputs(buf, out); rb_vm_bugreport(); /* call additional bug reporters */ { int i; for (i=0; i<bug_reporters_size; i++) { struct bug_reporters *reporter = &bug_reporters[i]; (*reporter->func)(out, reporter->data); } } fprintf(out, REPORTBUG_MSG); } }
static void compile_snprintf(char *buf, long len, const char *file, int line, const char *fmt, va_list args) { long n; n = err_position_0(buf, len, file, line); if (len > n) { vsnprintf((char*)buf+n, len-n, fmt, args); } }
static FILE * bug_report_file(const char *file, int line) { char buf[REPORT_BUG_BUFSIZ]; FILE *out = stderr; int len = err_position_0(buf, sizeof(buf), file, line); if ((ssize_t)fwrite(buf, 1, len, out) == (ssize_t)len || (ssize_t)fwrite(buf, 1, len, (out = stdout)) == (ssize_t)len) { return out; } return NULL; }
static void report_bug(const char *file, int line, const char *fmt, va_list args) { char buf[BUFSIZ]; FILE *out = stderr; int len = err_position_0(buf, BUFSIZ, file, line); 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(); } }
static void report_bug(const char *file, int line, const char *fmt, va_list args) { /* SIGSEGV handler might have a very small stack. Thus we need to use it carefully. */ char buf[256]; FILE *out = stderr; int len = err_position_0(buf, 256, file, line); if ((ssize_t)fwrite(buf, 1, len, out) == (ssize_t)len || (ssize_t)fwrite(buf, 1, len, (out = stdout)) == (ssize_t)len) { fputs("[BUG] ", out); vfprintf(out, fmt, args); fprintf(out, "\n%s\n\n", ruby_description); rb_vm_bugreport(); fprintf(out, REPORTBUG_MSG); } }
static void report_bug(const char *file, int line, const char *fmt, va_list args) { char buf[BUFSIZ]; FILE *out = stderr; int len = err_position_0(buf, BUFSIZ, file, line); 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"); } }
static int err_position(char *buf, long len) { return err_position_0(buf, len, rb_sourcefile(), rb_sourceline()); }