Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
3745c5dc
Commit
3745c5dc
authored
Jul 04, 2016
by
oranagra
Committed by
antirez
Sep 09, 2016
Browse files
crash log - add hex dump of function code
parent
c1cc07b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/debug.c
View file @
3745c5dc
...
@@ -39,6 +39,9 @@
...
@@ -39,6 +39,9 @@
#include <ucontext.h>
#include <ucontext.h>
#include <fcntl.h>
#include <fcntl.h>
#include "bio.h"
#include "bio.h"
#include <unistd.h>
#define _GNU_SOURCE
#include <dlfcn.h>
#endif
/* HAVE_BACKTRACE */
#endif
/* HAVE_BACKTRACE */
#ifdef __CYGWIN__
#ifdef __CYGWIN__
...
@@ -671,6 +674,8 @@ static void *getMcontextEip(ucontext_t *uc) {
...
@@ -671,6 +674,8 @@ static void *getMcontextEip(ucontext_t *uc) {
return
(
void
*
)
uc
->
uc_mcontext
.
gregs
[
16
];
/* Linux 64 */
return
(
void
*
)
uc
->
uc_mcontext
.
gregs
[
16
];
/* Linux 64 */
#elif defined(__ia64__)
/* Linux IA64 */
#elif defined(__ia64__)
/* Linux IA64 */
return
(
void
*
)
uc
->
uc_mcontext
.
sc_ip
;
return
(
void
*
)
uc
->
uc_mcontext
.
sc_ip
;
#elif defined(__arm__)
/* Linux ARM */
return
(
void
*
)
uc
->
uc_mcontext
.
arm_pc
;
#endif
#endif
#else
#else
return
NULL
;
return
NULL
;
...
@@ -1038,6 +1043,23 @@ void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
...
@@ -1038,6 +1043,23 @@ void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
/* free(messages); Don't call free() with possibly corrupted memory. */
/* free(messages); Don't call free() with possibly corrupted memory. */
if
(
server
.
daemonize
&&
server
.
supervised
==
0
)
unlink
(
server
.
pidfile
);
if
(
server
.
daemonize
&&
server
.
supervised
==
0
)
unlink
(
server
.
pidfile
);
if
(
eip
!=
NULL
)
{
Dl_info
info
;
if
(
dladdr
(
eip
,
&
info
)
!=
0
)
{
serverLog
(
LL_WARNING
,
"symbol: %s (base %p), in module: %s (base: %p)"
,
info
.
dli_sname
,
info
.
dli_saddr
,
info
.
dli_fname
,
info
.
dli_fbase
);
size_t
len
=
(
long
)
eip
-
(
long
)
info
.
dli_saddr
;
long
sz
=
sysconf
(
_SC_PAGESIZE
);
if
(
len
<
1
<<
13
)
{
/* we don't have functions over 8k (verified) */
long
end
=
((
long
)
eip
+
sz
)
&
~
(
sz
-
1
);
/* round up to page boundary */
len
=
end
-
(
long
)
info
.
dli_saddr
;
serverLogHexDump
(
LL_WARNING
,
"dump of function"
,
info
.
dli_saddr
,
len
);
}
}
}
/* Make sure we exit with the right signal at the end. So for instance
/* Make sure we exit with the right signal at the end. So for instance
* the core will be dumped if enabled. */
* the core will be dumped if enabled. */
sigemptyset
(
&
act
.
sa_mask
);
sigemptyset
(
&
act
.
sa_mask
);
...
...
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