Project

General

Profile

Feature #17752 » ruby-USE_BACKTRACE.patch

Define `USE_BACKTRACE` instead of abusing `HAVE_BACKTRACE` - xtkoba (Tee KOBAYASHI), 03/27/2021 12:20 PM

View differences:

vm_dump.c
#endif
#if defined(HAVE_BACKTRACE)
# define USE_BACKTRACE 1
# ifdef HAVE_LIBUNWIND
# undef backtrace
# define backtrace unw_backtrace
......
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>
......
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);
......
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 "
(1-1/5)