ruby-changes:71779
From: Jean <ko1@a...>
Date: Wed, 20 Apr 2022 11:53:03 +0900 (JST)
Subject: [ruby-changes:71779] fa2df520bc (master): Enable C backtraces on Apple silicon (#5770)
https://git.ruby-lang.org/ruby.git/commit/?id=fa2df520bc From fa2df520bcaaf3957db0489f1237311f091ac08d Mon Sep 17 00:00:00 2001 From: Jean byroot Boussier <jean.boussier+github@s...> Date: Wed, 20 Apr 2022 04:52:47 +0200 Subject: Enable C backtraces on Apple silicon (#5770) Co-authored-by: Jean Boussier <jean.boussier@g...> --- vm_dump.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vm_dump.c b/vm_dump.c index 271879ce18..e4410e3e7c 100644 --- a/vm_dump.c +++ b/vm_dump.c @@ -474,7 +474,7 @@ rb_vmdebug_thread_dump_state(VALUE self) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L474 # ifdef HAVE_LIBUNWIND # undef backtrace # define backtrace unw_backtrace -# elif defined(__APPLE__) && defined(__x86_64__) && defined(HAVE_LIBUNWIND_H) +# elif defined(__APPLE__) && defined(HAVE_LIBUNWIND_H) # define UNW_LOCAL_ONLY # include <libunwind.h> # include <sys/mman.h> @@ -503,6 +503,7 @@ backtrace(void **trace, int size) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L503 darwin_sigtramp: /* darwin's bundled libunwind doesn't support signal trampoline */ { +#if defined(__x86_64__) ucontext_t *uctx; char vec[1]; int r; @@ -563,6 +564,8 @@ darwin_sigtramp: https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L564 trace[n++] = (void *)ip; ip = *(unw_word_t*)uctx->uc_mcontext->MCTX_SS_REG(rsp); } +#endif + trace[n++] = (void *)ip; unw_set_reg(&cursor, UNW_REG_IP, ip); } -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/