Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
c3edaa79
Unverified
Commit
c3edaa79
authored
Sep 23, 2020
by
David CARLIER
Committed by
GitHub
Sep 23, 2020
Browse files
Further NetBSD update and build fixes. (#7831)
mainly backtrace and register dump support.
parent
63cd4d4e
Changes
3
Show whitespace changes
Inline
Side-by-side
src/Makefile
View file @
c3edaa79
...
...
@@ -131,12 +131,21 @@ ifeq ($(uname_S),OpenBSD)
endif
else
ifeq
($(uname_S),NetBSD)
# NetBSD
FINAL_LIBS
+=
-lpthread
ifeq
($(USE_BACKTRACE),yes)
FINAL_CFLAGS
+=
-DUSE_BACKTRACE
-I
/usr/pkg/include
FINAL_LDFLAGS
+=
-L
/usr/pkg/lib
FINAL_LIBS
+=
-lexecinfo
endif
else
ifeq
($(uname_S),FreeBSD)
# FreeBSD
FINAL_LIBS
+=
-lpthread
-lexecinfo
else
ifeq
($(uname_S),DragonFly)
#
FreeBSD
#
DragonFly
FINAL_LIBS
+=
-lpthread
-lexecinfo
else
ifeq
($(uname_S),OpenBSD)
...
...
@@ -158,6 +167,7 @@ endif
endif
endif
endif
endif
# Include paths to dependencies
FINAL_CFLAGS
+=
-I
../deps/hiredis
-I
../deps/linenoise
-I
../deps/lua/src
-I
../deps/hdr_histogram
...
...
src/config.h
View file @
c3edaa79
...
...
@@ -64,7 +64,7 @@
/* Test for backtrace() */
#if defined(__APPLE__) || (defined(__linux__) && defined(__GLIBC__)) || \
defined(__FreeBSD__) || (defined(__OpenBSD__) && defined(USE_BACKTRACE))\
defined(__FreeBSD__) ||
(
(defined(__OpenBSD__)
|| defined(__NetBSD__))
&& defined(USE_BACKTRACE))\
|| defined(__DragonFly__)
#define HAVE_BACKTRACE 1
#endif
...
...
@@ -236,7 +236,7 @@ void setproctitle(const char *fmt, ...);
#define redis_set_thread_title(name) pthread_set_name_np(pthread_self(), name)
#elif defined __NetBSD__
#include <pthread.h>
#define redis_set_thread_title(name) pthread_setname_np(pthread_self(),
name, NULL
)
#define redis_set_thread_title(name) pthread_setname_np(pthread_self(),
"%s", name
)
#else
#if (defined __APPLE__ && defined(MAC_OS_X_VERSION_10_7))
int
pthread_setname_np
(
const
char
*
name
);
...
...
src/debug.c
View file @
c3edaa79
...
...
@@ -984,6 +984,12 @@ static void *getMcontextEip(ucontext_t *uc) {
#elif defined(__x86_64__)
return
(
void
*
)
uc
->
sc_rip
;
#endif
#elif defined(__NetBSD__)
#if defined(__i386__)
return
(
void
*
)
uc
->
uc_mcontext
.
__gregs
[
_REG_EIP
];
#elif defined(__x86_64__)
return
(
void
*
)
uc
->
uc_mcontext
.
__gregs
[
_REG_RIP
];
#endif
#elif defined(__DragonFly__)
return
(
void
*
)
uc
->
uc_mcontext
.
mc_rip
;
#else
...
...
@@ -1342,6 +1348,59 @@ void logRegisters(ucontext_t *uc) {
);
logStackContent
((
void
**
)
uc
->
sc_esp
);
#endif
#elif defined(__NetBSD__)
#if defined(__x86_64__)
serverLog
(
LL_WARNING
,
"
\n
"
"RAX:%016lx RBX:%016lx
\n
RCX:%016lx RDX:%016lx
\n
"
"RDI:%016lx RSI:%016lx
\n
RBP:%016lx RSP:%016lx
\n
"
"R8 :%016lx R9 :%016lx
\n
R10:%016lx R11:%016lx
\n
"
"R12:%016lx R13:%016lx
\n
R14:%016lx R15:%016lx
\n
"
"RIP:%016lx EFL:%016lx
\n
CSGSFS:%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_RFLAGS
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_CS
]
);
logStackContent
((
void
**
)
uc
->
uc_mcontext
.
__gregs
[
_REG_RSP
]);
#elif defined(__i386__)
serverLog
(
LL_WARNING
,
"
\n
"
"EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx
\n
"
"EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx
\n
"
"SS :%08lx EFL:%08lx EIP:%08lx CS:%08lx
\n
"
"DS :%08lx ES :%08lx FS :%08lx GS:%08lx"
,
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_EAX
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_EBX
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_EDX
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_EDI
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_ESI
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_EBP
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_ESP
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_SS
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_EFLAGS
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_EIP
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_CS
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_ES
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_FS
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_GS
]
);
#endif
#elif defined(__DragonFly__)
serverLog
(
LL_WARNING
,
"
\n
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment