diff options
author | David CARLIER <devnexen@gmail.com> | 2022-10-02 14:36:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-02 16:36:31 +0300 |
commit | ff808090535a665ce3e376b88ff7e07818a2916b (patch) | |
tree | 1aff0f048e7ea4462fd7c086faf516234b9e9a53 /src | |
parent | 3469c6509c4078f6b2738359ebaacf5df707a6a1 (diff) | |
download | redis-ff808090535a665ce3e376b88ff7e07818a2916b.tar.gz |
register debug support on illumos/solaris. (#11335)
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 3 | ||||
-rw-r--r-- | src/config.h | 2 | ||||
-rw-r--r-- | src/debug.c | 33 |
3 files changed, 37 insertions, 1 deletions
diff --git a/src/Makefile b/src/Makefile index 6a56c1dff..a966d001a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -139,6 +139,9 @@ ifeq ($(uname_S),SunOS) INSTALL=cp -pf FINAL_CFLAGS+= -D__EXTENSIONS__ -D_XPG6 FINAL_LIBS+= -ldl -lnsl -lsocket -lresolv -lpthread -lrt + ifeq ($(USE_BACKTRACE),yes) + FINAL_CFLAGS+= -DUSE_BACKTRACE + endif else ifeq ($(uname_S),Darwin) # Darwin diff --git a/src/config.h b/src/config.h index dafbf15a9..708925979 100644 --- a/src/config.h +++ b/src/config.h @@ -72,7 +72,7 @@ /* Test for backtrace() */ #if defined(__APPLE__) || (defined(__linux__) && defined(__GLIBC__)) || \ - defined(__FreeBSD__) || ((defined(__OpenBSD__) || defined(__NetBSD__)) && defined(USE_BACKTRACE))\ + defined(__FreeBSD__) || ((defined(__OpenBSD__) || defined(__NetBSD__) || defined(__sun)) && defined(USE_BACKTRACE))\ || defined(__DragonFly__) || (defined(__UCLIBC__) && defined(__UCLIBC_HAS_BACKTRACE__)) #define HAVE_BACKTRACE 1 #endif diff --git a/src/debug.c b/src/debug.c index b15ac8780..9b31a3377 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1205,6 +1205,8 @@ static void* getAndSetMcontextEip(ucontext_t *uc, void *eip) { #endif #elif defined(__DragonFly__) GET_SET_RETURN(uc->uc_mcontext.mc_rip, eip); +#elif defined(__sun) && defined(__x86_64__) + GET_SET_RETURN(uc->uc_mcontext.gregs[REG_RIP], eip); #else NOT_SUPPORTED(); #endif @@ -1658,6 +1660,37 @@ void logRegisters(ucontext_t *uc) { (unsigned long) uc->uc_mcontext.mc_cs ); logStackContent((void**)uc->uc_mcontext.mc_rsp); +#elif defined(__sun) + #if defined(__x86_64__) + serverLog(LL_WARNING, + "\n" + "RAX:%016lx RBX:%016lx\nRCX:%016lx RDX:%016lx\n" + "RDI:%016lx RSI:%016lx\nRBP:%016lx RSP:%016lx\n" + "R8 :%016lx R9 :%016lx\nR10:%016lx R11:%016lx\n" + "R12:%016lx R13:%016lx\nR14:%016lx R15:%016lx\n" + "RIP:%016lx EFL:%016lx\nCSGSFS:%016lx", + (unsigned long) uc->uc_mcontext.gregs[REG_RAX], + (unsigned long) uc->uc_mcontext.gregs[REG_RBX], + (unsigned long) uc->uc_mcontext.gregs[REG_RCX], + (unsigned long) uc->uc_mcontext.gregs[REG_RDX], + (unsigned long) uc->uc_mcontext.gregs[REG_RDI], + (unsigned long) uc->uc_mcontext.gregs[REG_RSI], + (unsigned long) uc->uc_mcontext.gregs[REG_RBP], + (unsigned long) uc->uc_mcontext.gregs[REG_RSP], + (unsigned long) uc->uc_mcontext.gregs[REG_R8], + (unsigned long) uc->uc_mcontext.gregs[REG_R9], + (unsigned long) uc->uc_mcontext.gregs[REG_R10], + (unsigned long) uc->uc_mcontext.gregs[REG_R11], + (unsigned long) uc->uc_mcontext.gregs[REG_R12], + (unsigned long) uc->uc_mcontext.gregs[REG_R13], + (unsigned long) uc->uc_mcontext.gregs[REG_R14], + (unsigned long) uc->uc_mcontext.gregs[REG_R15], + (unsigned long) uc->uc_mcontext.gregs[REG_RIP], + (unsigned long) uc->uc_mcontext.gregs[REG_RFL], + (unsigned long) uc->uc_mcontext.gregs[REG_CS] + ); + logStackContent((void**)uc->uc_mcontext.gregs[REG_RSP]); + #endif #else NOT_SUPPORTED(); #endif |