Index: lib/sanitizer_common/sanitizer_mac.cc =================================================================== --- lib/sanitizer_common/sanitizer_mac.cc +++ lib/sanitizer_common/sanitizer_mac.cc @@ -30,7 +30,12 @@ #include "sanitizer_platform_limits_posix.h" #include "sanitizer_procmaps.h" +#if !TARGET_OS_IPHONE #include // for _NSGetEnviron +#else +extern char **environ; +#endif + #include #include #include @@ -191,6 +196,7 @@ } const char *GetEnv(const char *name) { +#if !TARGET_OS_IPHONE char ***env_ptr = _NSGetEnviron(); if (!env_ptr) { Report("_NSGetEnviron() returned NULL. Please make sure __asan_init() is " @@ -198,6 +204,7 @@ CHECK(env_ptr); } char **environ = *env_ptr; +#endif CHECK(environ); uptr name_len = internal_strlen(name); while (*environ != 0) { @@ -358,15 +365,30 @@ void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) { ucontext_t *ucontext = (ucontext_t*)context; -# if SANITIZER_WORDSIZE == 64 +# if defined(__aarch64__) + *pc = ucontext->uc_mcontext->__ss.__pc; + // See . +# if defined(__IPHONE_8_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0 + *bp = ucontext->uc_mcontext->__ss.__fp; +# else + *bp = ucontext->uc_mcontext->__ss.__lr; +# endif + *sp = ucontext->uc_mcontext->__ss.__sp; +# elif defined(__x86_64__) *pc = ucontext->uc_mcontext->__ss.__rip; *bp = ucontext->uc_mcontext->__ss.__rbp; *sp = ucontext->uc_mcontext->__ss.__rsp; -# else +# elif defined(__arm__) + *pc = ucontext->uc_mcontext->__ss.__pc; + *bp = ucontext->uc_mcontext->__ss.__r[7]; + *sp = ucontext->uc_mcontext->__ss.__sp; +# elif defined(__i386__) *pc = ucontext->uc_mcontext->__ss.__eip; *bp = ucontext->uc_mcontext->__ss.__ebp; *sp = ucontext->uc_mcontext->__ss.__esp; -# endif // SANITIZER_WORDSIZE +# else +# error "Unknown architecture" +# endif } } // namespace __sanitizer