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>
This commit is contained in:
parent
8b32de2ec9
commit
9e2483ee0b
Notes:
git
2021-05-04 21:57:22 +09:00
15
vm_dump.c
15
vm_dump.c
@ -470,6 +470,7 @@ rb_vmdebug_thread_dump_state(VALUE self)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_BACKTRACE)
|
#if defined(HAVE_BACKTRACE)
|
||||||
|
# define USE_BACKTRACE 1
|
||||||
# ifdef HAVE_LIBUNWIND
|
# ifdef HAVE_LIBUNWIND
|
||||||
# undef backtrace
|
# undef backtrace
|
||||||
# define backtrace unw_backtrace
|
# define backtrace unw_backtrace
|
||||||
@ -572,14 +573,14 @@ darwin_sigtramp:
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
# elif defined(BROKEN_BACKTRACE)
|
# elif defined(BROKEN_BACKTRACE)
|
||||||
# undef HAVE_BACKTRACE
|
# undef USE_BACKTRACE
|
||||||
# define HAVE_BACKTRACE 0
|
# define USE_BACKTRACE 0
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define HAVE_BACKTRACE 0
|
# define USE_BACKTRACE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_BACKTRACE
|
#if USE_BACKTRACE
|
||||||
# include <execinfo.h>
|
# include <execinfo.h>
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
# include <imagehlp.h>
|
# include <imagehlp.h>
|
||||||
@ -752,7 +753,7 @@ dump_thread(void *arg)
|
|||||||
void
|
void
|
||||||
rb_print_backtrace(void)
|
rb_print_backtrace(void)
|
||||||
{
|
{
|
||||||
#if HAVE_BACKTRACE
|
#if USE_BACKTRACE
|
||||||
#define MAX_NATIVE_TRACE 1024
|
#define MAX_NATIVE_TRACE 1024
|
||||||
static void *trace[MAX_NATIVE_TRACE];
|
static void *trace[MAX_NATIVE_TRACE];
|
||||||
int n = (int)backtrace(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);
|
rb_dump_machine_register(ctx);
|
||||||
|
|
||||||
#if HAVE_BACKTRACE || defined(_WIN32)
|
#if USE_BACKTRACE || defined(_WIN32)
|
||||||
fprintf(stderr, "-- C level backtrace information "
|
fprintf(stderr, "-- C level backtrace information "
|
||||||
"-------------------------------------------\n");
|
"-------------------------------------------\n");
|
||||||
rb_print_backtrace();
|
rb_print_backtrace();
|
||||||
|
|
||||||
|
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
#endif /* HAVE_BACKTRACE */
|
#endif /* USE_BACKTRACE */
|
||||||
|
|
||||||
if (other_runtime_info || vm) {
|
if (other_runtime_info || vm) {
|
||||||
fprintf(stderr, "-- Other runtime information "
|
fprintf(stderr, "-- Other runtime information "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user