summaryrefslogtreecommitdiff
path: root/vm_dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_dump.c')
-rw-r--r--vm_dump.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/vm_dump.c b/vm_dump.c
index 4bc41f2131..64a210543c 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -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