summaryrefslogtreecommitdiff
path: root/vm_dump.c
diff options
context:
space:
mode:
authorJean byroot Boussier <[email protected]>2022-04-20 04:52:47 +0200
committer<[email protected]>2022-04-20 11:52:47 +0900
commitfa2df520bcaaf3957db0489f1237311f091ac08d ()
treec028502b375615c4103d2f93a790ca63277d6cee /vm_dump.c
parentd9482913a97ffc7a850bbd3ea7f22d3cb7808070 (diff)
Enable C backtraces on Apple silicon (#5770)
Co-authored-by: Jean Boussier <[email protected]>
Notes: Merged-By: nurse <[email protected]>
-rw-r--r--vm_dump.c5
1 files changed, 4 insertions, 1 deletions
@@ -474,7 +474,7 @@ rb_vmdebug_thread_dump_state(VALUE self)
# ifdef HAVE_LIBUNWIND
# undef backtrace
# define backtrace unw_backtrace
-# elif defined(__APPLE__) && defined(__x86_64__) && defined(HAVE_LIBUNWIND_H)
# define UNW_LOCAL_ONLY
# include <libunwind.h>
# include <sys/mman.h>
@@ -503,6 +503,7 @@ backtrace(void **trace, int size)
darwin_sigtramp:
/* darwin's bundled libunwind doesn't support signal trampoline */
{
ucontext_t *uctx;
char vec[1];
int r;
@@ -563,6 +564,8 @@ darwin_sigtramp:
trace[n++] = (void *)ip;
ip = *(unw_word_t*)uctx->uc_mcontext->MCTX_SS_REG(rsp);
}
trace[n++] = (void *)ip;
unw_set_reg(&cursor, UNW_REG_IP, ip);
}