diff --git a/config.h b/config.h index 79240b754..52f1afdb7 100644 --- a/config.h +++ b/config.h @@ -1,10 +1,10 @@ #ifndef __CONFIG_H #define __CONFIG_H -/* malloc_size() */ +/* test for malloc_size() */ #ifdef __APPLE__ #include -#define HAVE_MALLOC_SIZE +#define HAVE_MALLOC_SIZE 1 #define redis_malloc_size(p) malloc_size(p) #endif @@ -17,4 +17,9 @@ #define redis_stat stat #endif +/* test for backtrace() */ +#if defined(__APPLE__) || defined(__linux__) +#define HAVE_BACKTRACE 1 +#endif + #endif diff --git a/redis.c b/redis.c index 84e4be954..2caf06c34 100644 --- a/redis.c +++ b/redis.c @@ -330,7 +330,6 @@ static int setExpire(redisDb *db, robj *key, time_t when); static void updateSalvesWaitingBgsave(int bgsaveerr); static void freeMemoryIfNeeded(void); static int processCommand(redisClient *c); -static void segvHandler(int sig, siginfo_t *info, void *secret); static void setupSigSegvAction(void); static void authCommand(redisClient *c); @@ -4108,7 +4107,7 @@ static void debugCommand(redisClient *c) { } } -#if defined(__APPLE__) || defined(__linux__) +#ifdef HAVE_BACKTRACE static struct redisFunctionSym symsTable[] = { {"freeStringObject", (unsigned long)freeStringObject}, {"freeListObject", (unsigned long)freeListObject}, @@ -4192,7 +4191,6 @@ static struct redisFunctionSym symsTable[] = { {"debugCommand", (unsigned long)debugCommand}, {"processCommand", (unsigned long)processCommand}, {"setupSigSegvAction", (unsigned long)setupSigSegvAction}, -{"segvHandler", (unsigned long)segvHandler}, {"readQueryFromClient", (unsigned long)readQueryFromClient}, {NULL,0} }; @@ -4274,7 +4272,7 @@ static void segvHandler(int sig, siginfo_t *info, void *secret) { trace[1] = getMcontextEip(uc); messages = backtrace_symbols(trace, trace_size); - for (i=0; i