Created
May 10, 2021 17:28
-
-
Save plainprogrammer/5d064c4703e99fedc084a0a8c95aef5b to your computer and use it in GitHub Desktop.
Patch Redis 3.2 code to compile cleanly for Apple M1 Macs (ARM)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/debug.c b/src/debug.c | |
index 1ecb251bd..d4d2f0508 100644 | |
--- a/src/debug.c | |
+++ b/src/debug.c | |
@@ -662,8 +662,10 @@ static void *getMcontextEip(ucontext_t *uc) { | |
/* OSX >= 10.6 */ | |
#if defined(_STRUCT_X86_THREAD_STATE64) && !defined(__i386__) | |
return (void*) uc->uc_mcontext->__ss.__rip; | |
- #else | |
+ #elif defined(__i386__) | |
return (void*) uc->uc_mcontext->__ss.__eip; | |
+ #else | |
+ return NULL; | |
#endif | |
#elif defined(__linux__) | |
/* Linux */ | |
@@ -731,7 +733,7 @@ void logRegisters(ucontext_t *uc) { | |
(unsigned long) uc->uc_mcontext->__ss.__gs | |
); | |
logStackContent((void**)uc->uc_mcontext->__ss.__rsp); | |
- #else | |
+ #elif defined(__i386__) | |
/* OSX x86 */ | |
serverLog(LL_WARNING, | |
"\n" | |
@@ -757,6 +759,9 @@ void logRegisters(ucontext_t *uc) { | |
(unsigned long) uc->uc_mcontext->__ss.__gs | |
); | |
logStackContent((void**)uc->uc_mcontext->__ss.__esp); | |
+ #else | |
+ serverLog(LL_WARNING, | |
+ " Dumping of registers not supported for this OS/arch"); | |
#endif | |
/* Linux */ | |
#elif defined(__linux__) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment