diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-01-06 15:06:03 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-01-06 15:06:03 +0900 |
commit | 33d866558b4792d877e7735d2239b1337d334c6c (patch) | |
tree | 23f71c59b5b93824f8a75e94826ec0dbe9b1798b | |
parent | ce072fe5689184cba5e4a86968367c525cb22a72 (diff) |
support RUBY_ON_BUG envval on assert failure.
Check RUBY_ON_BUG env val also on rb_assert_failure().
-rw-r--r-- | error.c | 11 | ||||
-rw-r--r-- | vm_dump.c | 12 |
2 files changed, 12 insertions, 11 deletions
@@ -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); fputs(buf, 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 { \ @@ -925,6 +925,18 @@ rb_dump_machine_register(const ucontext_t *ctx) void 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__ # define PROC_MAPS_NAME "/proc/self/maps" #endif |