summaryrefslogtreecommitdiff
path: root/vm_dump.c
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2021-04-29 13:15:19 +0200
committerBenoit Daloze <eregontp@gmail.com>2021-05-04 14:56:55 +0200
commit9e2483ee0b2cee0f8f8cc0b0fdfbe8abef462c00 (patch)
treec1d55b238051a404d043964a58f73cca4786f57e /vm_dump.c
parent8b32de2ec9b72d4c9ede19b70ec9497718fb25a6 (diff)
vm_dump.c: rename HAVE_BACKTRACE to USE_BACKTRACE
* HAVE_ macros should only be defined or undefined, not used for their value. * See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4428
Diffstat (limited to 'vm_dump.c')
-rw-r--r--vm_dump.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/vm_dump.c b/vm_dump.c
index 109757a14e..26a2bf3ba4 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -470,6 +470,7 @@ rb_vmdebug_thread_dump_state(VALUE self)
#endif
#if defined(HAVE_BACKTRACE)
+# define USE_BACKTRACE 1
# ifdef HAVE_LIBUNWIND
# undef backtrace
# define backtrace unw_backtrace
@@ -572,14 +573,14 @@ darwin_sigtramp:
return n;
}
# elif defined(BROKEN_BACKTRACE)
-# undef HAVE_BACKTRACE
-# define HAVE_BACKTRACE 0
+# undef USE_BACKTRACE
+# define USE_BACKTRACE 0
# endif
#else
-# define HAVE_BACKTRACE 0
+# define USE_BACKTRACE 0
#endif
-#if HAVE_BACKTRACE
+#if USE_BACKTRACE
# include <execinfo.h>
#elif defined(_WIN32)
# include <imagehlp.h>
@@ -752,7 +753,7 @@ dump_thread(void *arg)
void
rb_print_backtrace(void)
{
-#if HAVE_BACKTRACE
+#if USE_BACKTRACE
#define MAX_NATIVE_TRACE 1024
static void *trace[MAX_NATIVE_TRACE];
int n = (int)backtrace(trace, MAX_NATIVE_TRACE);
@@ -1034,14 +1035,14 @@ rb_vm_bugreport(const void *ctx)
rb_dump_machine_register(ctx);
-#if HAVE_BACKTRACE || defined(_WIN32)
+#if USE_BACKTRACE || defined(_WIN32)
fprintf(stderr, "-- C level backtrace information "
"-------------------------------------------\n");
rb_print_backtrace();
fprintf(stderr, "\n");
-#endif /* HAVE_BACKTRACE */
+#endif /* USE_BACKTRACE */
if (other_runtime_info || vm) {
fprintf(stderr, "-- Other runtime information "