Search code examples
cexc-bad-accesscoroutinelldbarm64

EXC_BAD_ACCESS (code=259) when I develop my coroutine on arm64


guys. I am debugging my project with lldb. And I get an error as follows.

Process 83444 stopped
* thread #2, stop reason = EXC_BAD_ACCESS (code=259, address=0x10080c8e8)
    frame #0: 0x00000001001d69e4 libctask.dylib`ct_main(arg=0x0000000100808800) at ctask.c:12 [opt]
   9
   10   static int
   11   ct_main(void *arg)
-> 12   {
   13       coroutine *ct = arg;

I find a lot of answers about EXC_BAD_ACCESS, but the error codes are not 259.

Where can I find the docs about this error code?

Or is there are any descriptions about it?


Solution

  • XNU, osfmk/mach/arm/exception.h:

    #define EXC_ARM_DA_ALIGN        0x101   /* Alignment Fault */
    #define EXC_ARM_DA_DEBUG        0x102   /* Debug (watch/break) Fault */
    #define EXC_ARM_SP_ALIGN        0x103   /* SP Alignment Fault */
    #define EXC_ARM_SWP             0x104   /* SWP instruction */
    #define EXC_ARM_PAC_FAIL        0x105   /* PAC authentication failure */
    

    Your stack pointer is not aligned to 0x10 bytes.