Skip to content

Commit 229784d

Browse files
committed
[Bug #21150] macOS: unwinding coroutine workaround is only for arm64
1 parent 085cc6e commit 229784d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

vm_dump.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,15 @@ rb_vmdebug_thread_dump_state(FILE *errout, VALUE self)
511511
# include <sys/mman.h>
512512
# undef backtrace
513513

514+
# if defined(__arm64__)
514515
static bool
515516
is_coroutine_start(unw_word_t ip)
516517
{
517518
struct coroutine_context;
518519
extern void ruby_coroutine_start(struct coroutine_context *, struct coroutine_context *);
519520
return ((void *)(ip) == (void *)ruby_coroutine_start);
520521
}
522+
# endif
521523

522524
int
523525
backtrace(void **trace, int size)
@@ -614,7 +616,7 @@ backtrace(void **trace, int size)
614616
}
615617
return n;
616618

617-
# else /* defined(__arm64__) */
619+
# elif defined(__arm64__)
618620
/* Since Darwin arm64's _sigtramp is implemented as normal function,
619621
* unwind can unwind frames without special code.
620622
* https://github.com/apple/darwin-libplatform/blob/215b09856ab5765b7462a91be7076183076600df/src/setjmp/generic/sigtramp.c
@@ -631,6 +633,8 @@ backtrace(void **trace, int size)
631633
if (is_coroutine_start(ip)) break;
632634
}
633635
return n;
636+
# else
637+
# error unsupported architecture
634638
# endif
635639
}
636640
# elif defined(BROKEN_BACKTRACE)

0 commit comments

Comments
 (0)