[前][次][番号順一覧][スレッド一覧]

ruby-changes:59629

From: Koichi <ko1@a...>
Date: Mon, 6 Jan 2020 15:07:36 +0900 (JST)
Subject: [ruby-changes:59629] 33d866558b (master): support RUBY_ON_BUG envval on assert failure.

https://git.ruby-lang.org/ruby.git/commit/?id=33d866558b

From 33d866558b4792d877e7735d2239b1337d334c6c Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Mon, 6 Jan 2020 15:06:03 +0900
Subject: support RUBY_ON_BUG envval on assert failure.

Check RUBY_ON_BUG env val also on rb_assert_failure().

diff --git a/error.c b/error.c
index fd6c8fe..1690658 100644
--- a/error.c
+++ b/error.c
@@ -580,17 +580,6 @@ bug_report_begin_valist(FILE *out, const char *fmt, va_list args) https://github.com/ruby/ruby/blob/trunk/error.c#L580
     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 { \
diff --git a/vm_dump.c b/vm_dump.c
index 4bc41f2..64a2105 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -925,6 +925,18 @@ rb_dump_machine_register(const ucontext_t *ctx) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L925
 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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]