Skip to content

Commit

Permalink
[armv7l] Work around mcontext_t structure mismatch
Browse files Browse the repository at this point in the history
Jameson points out that ARM doesn't use the usual structure for these
registers, and so we have to manually typecast this structure.

X-ref: #47345 (comment)
  • Loading branch information
staticfloat committed Nov 16, 2023
1 parent 7f18f76 commit 20f5b71
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/stackwalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,14 @@ static void jl_rec_backtrace(jl_task_t *t) JL_NOTSAFEPOINT
memset(&c, 0, sizeof(c));
#if defined(_OS_LINUX_) && defined(__GLIBC__)
__jmp_buf *mctx = &t->ctx.ctx.uc_mcontext->__jmpbuf;
#if defined(_CPU_ARM_)
// The libunwind-arm.h header defines its own copy of `ucontext_t` instead
// of using the platform definition directly.
// https://github.com/libunwind/libunwind/blob/fbaa4d5b0c47a4129ff7e514bdecc284635b36e9/include/libunwind-arm.h#L258-L266
mcontext_t *mc = (mcontext_t *)&c;
#else
mcontext_t *mc = &c.uc_mcontext;
#endif
#if defined(_CPU_X86_)
// https://github.com/bminor/glibc/blame/master/sysdeps/i386/__longjmp.S
// https://github.com/bminor/glibc/blame/master/sysdeps/i386/jmpbuf-offsets.h
Expand Down

0 comments on commit 20f5b71

Please sign in to comment.