mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
support RUBY_ON_BUG envval on assert failure.
Check RUBY_ON_BUG env val also on rb_assert_failure().
This commit is contained in:
parent
ce072fe568
commit
33d866558b
2 changed files with 12 additions and 11 deletions
11
error.c
11
error.c
|
@ -580,17 +580,6 @@ bug_report_begin_valist(FILE *out, const char *fmt, va_list args)
|
||||||
snprintf(buf, sizeof(buf), "\n%s\n\n", ruby_description);
|
snprintf(buf, sizeof(buf), "\n%s\n\n", ruby_description);
|
||||||
fputs(buf, out);
|
fputs(buf, out);
|
||||||
preface_dump(out);
|
preface_dump(out);
|
||||||
|
|
||||||
#if RUBY_DEVEL
|
|
||||||
const char *cmd = getenv("RUBY_ON_BUG");
|
|
||||||
if (cmd) {
|
|
||||||
snprintf(buf, sizeof(buf), "%s %"PRI_PIDT_PREFIX"d", cmd, getpid());
|
|
||||||
int r = system(buf);
|
|
||||||
if (r == -1) {
|
|
||||||
snprintf(buf, sizeof(buf), "Launching RUBY_ON_BUG command failed.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define bug_report_begin(out, fmt) do { \
|
#define bug_report_begin(out, fmt) do { \
|
||||||
|
|
12
vm_dump.c
12
vm_dump.c
|
@ -925,6 +925,18 @@ rb_dump_machine_register(const ucontext_t *ctx)
|
||||||
void
|
void
|
||||||
rb_vm_bugreport(const void *ctx)
|
rb_vm_bugreport(const void *ctx)
|
||||||
{
|
{
|
||||||
|
#if RUBY_DEVEL
|
||||||
|
const char *cmd = getenv("RUBY_ON_BUG");
|
||||||
|
if (cmd) {
|
||||||
|
char buf[0x100];
|
||||||
|
snprintf(buf, sizeof(buf), "%s %"PRI_PIDT_PREFIX"d", cmd, getpid());
|
||||||
|
int r = system(buf);
|
||||||
|
if (r == -1) {
|
||||||
|
snprintf(buf, sizeof(buf), "Launching RUBY_ON_BUG command failed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
# define PROC_MAPS_NAME "/proc/self/maps"
|
# define PROC_MAPS_NAME "/proc/self/maps"
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue