mirror of https://mirror.osredm.com/root/redis.git
register debug support on illumos/solaris. (#11335)
This commit is contained in:
parent
3469c6509c
commit
ff80809053
|
@ -139,6 +139,9 @@ ifeq ($(uname_S),SunOS)
|
||||||
INSTALL=cp -pf
|
INSTALL=cp -pf
|
||||||
FINAL_CFLAGS+= -D__EXTENSIONS__ -D_XPG6
|
FINAL_CFLAGS+= -D__EXTENSIONS__ -D_XPG6
|
||||||
FINAL_LIBS+= -ldl -lnsl -lsocket -lresolv -lpthread -lrt
|
FINAL_LIBS+= -ldl -lnsl -lsocket -lresolv -lpthread -lrt
|
||||||
|
ifeq ($(USE_BACKTRACE),yes)
|
||||||
|
FINAL_CFLAGS+= -DUSE_BACKTRACE
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
ifeq ($(uname_S),Darwin)
|
ifeq ($(uname_S),Darwin)
|
||||||
# Darwin
|
# Darwin
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
|
|
||||||
/* Test for backtrace() */
|
/* Test for backtrace() */
|
||||||
#if defined(__APPLE__) || (defined(__linux__) && defined(__GLIBC__)) || \
|
#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__))
|
|| defined(__DragonFly__) || (defined(__UCLIBC__) && defined(__UCLIBC_HAS_BACKTRACE__))
|
||||||
#define HAVE_BACKTRACE 1
|
#define HAVE_BACKTRACE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
33
src/debug.c
33
src/debug.c
|
@ -1205,6 +1205,8 @@ static void* getAndSetMcontextEip(ucontext_t *uc, void *eip) {
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__DragonFly__)
|
#elif defined(__DragonFly__)
|
||||||
GET_SET_RETURN(uc->uc_mcontext.mc_rip, eip);
|
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
|
#else
|
||||||
NOT_SUPPORTED();
|
NOT_SUPPORTED();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1658,6 +1660,37 @@ void logRegisters(ucontext_t *uc) {
|
||||||
(unsigned long) uc->uc_mcontext.mc_cs
|
(unsigned long) uc->uc_mcontext.mc_cs
|
||||||
);
|
);
|
||||||
logStackContent((void**)uc->uc_mcontext.mc_rsp);
|
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
|
#else
|
||||||
NOT_SUPPORTED();
|
NOT_SUPPORTED();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue