summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2023-08-09 18:25:34 +0900
committerNobuyoshi Nakada <[email protected]>2023-09-25 22:57:28 +0900
commit70e8a08295114fa3cb112ddb42844889f7f98eb1 ()
tree9528a9003ccaebf48858d74fbb0160068c8ca3eb
parent696f08238bc25a27e4b96c355c26bc0d27738548 (diff)
Add `--bugreport-path` option
It has precedence over the environment variable `RUBY_BUGREPORT_PATH`.
-rw-r--r--error.c11
-rw-r--r--internal/cmdlineopt.h2
-rw-r--r--man/ruby.17
-rw-r--r--ruby.c15
4 files changed, 26 insertions, 9 deletions
@@ -839,13 +839,17 @@ open_report_path(const char *template, char *buf, size_t size, rb_pid_t *pid)
return NULL;
}
/* SIGSEGV handler might have a very small stack. Thus we need to use it carefully. */
#define REPORT_BUG_BUFSIZ 256
static FILE *
bug_report_file(const char *file, int line, rb_pid_t *pid)
{
char buf[REPORT_BUG_BUFSIZ];
- FILE *out = open_report_path(getenv("RUBY_BUGREPORT_PATH"), buf, sizeof(buf), pid);
int len = err_position_0(buf, sizeof(buf), file, line);
if (out) {
@@ -998,8 +1002,10 @@ bug_report_end(FILE *out, rb_pid_t pid)
} while (0) \
void
-ruby_test_bug_report(const char *template)
{
rb_pid_t pid = -1;
char buf[REPORT_BUG_BUFSIZ];
FILE *out = open_report_path(template, buf, sizeof(buf), &pid);
@@ -1008,6 +1014,7 @@ ruby_test_bug_report(const char *template)
fprintf(out, "ruby_test_bug_report: %s", ctime(&t));
finish_report(out, pid);
}
}
NORETURN(static void die(void));
@@ -28,6 +28,8 @@ typedef struct ruby_cmdline_options {
struct rb_rjit_options rjit;
#endif
signed int sflag: 2;
unsigned int xflag: 1;
unsigned int warning: 1;
@@ -25,6 +25,7 @@
.Op Fl - Ns Bro Cm enable Ns | Ns Cm disable Brc Ns - Ns Ar FEATURE
.Op Fl -dump Ns = Ns Ar target
.Op Fl -verbose
.Op Fl -
.Op Ar program_file
.Op Ar argument ...
@@ -469,6 +470,12 @@ variable to true.
If this switch is given, and no script arguments (script file or
.Fl e
options) are present, Ruby quits immediately.
.El
.Pp
.Sh ENVIRONMENT
@@ -337,6 +337,7 @@ usage(const char *name, int help, int highlight, int columns)
M("--backtrace-limit=num", "", "limit the maximum length of backtrace"),
M("--verbose", "", "turn on verbose mode and disable script from stdin"),
M("--version", "", "print the version number, then exit"),
M("-y", ", --yydebug", "print log of parser. Backward compatibility is not guaranteed"),
M("--help", "", "show this message, -h for short message"),
};
@@ -1352,8 +1353,6 @@ proc_encoding_option(ruby_cmdline_options_t *opt, const char *s, const char *opt
UNREACHABLE;
}
-static const char *test_bug_report_template;
-
static long
proc_long_options(ruby_cmdline_options_t *opt, const char *s, long argc, char **argv, int envopt)
{
@@ -1464,8 +1463,10 @@ proc_long_options(ruby_cmdline_options_t *opt, const char *s, long argc, char **
opt->backtrace_length_limit = n;
}
}
- else if (is_option_with_arg("test-bugreport", true, false)) {
- test_bug_report_template = s;
}
else {
rb_raise(rb_eRuntimeError,
@@ -2916,9 +2917,9 @@ ruby_process_options(int argc, char **argv)
iseq = process_options(argc, argv, cmdline_options_init(&opt));
- if (test_bug_report_template) {
- void ruby_test_bug_report(const char *template);
- ruby_test_bug_report(test_bug_report_template);
}
return (void*)(struct RData*)iseq;
}