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
d76412d1
Commit
d76412d1
authored
Jun 07, 2009
by
antirez
Browse files
some minor changes to the backtrace code
parent
e65fdc78
Changes
2
Hide whitespace changes
Inline
Side-by-side
config.h
View file @
d76412d1
#ifndef __CONFIG_H
#ifndef __CONFIG_H
#define __CONFIG_H
#define __CONFIG_H
/* malloc_size() */
/*
test for
malloc_size() */
#ifdef __APPLE__
#ifdef __APPLE__
#include <malloc/malloc.h>
#include <malloc/malloc.h>
#define HAVE_MALLOC_SIZE
#define HAVE_MALLOC_SIZE
1
#define redis_malloc_size(p) malloc_size(p)
#define redis_malloc_size(p) malloc_size(p)
#endif
#endif
...
@@ -17,4 +17,9 @@
...
@@ -17,4 +17,9 @@
#define redis_stat stat
#define redis_stat stat
#endif
#endif
/* test for backtrace() */
#if defined(__APPLE__) || defined(__linux__)
#define HAVE_BACKTRACE 1
#endif
#endif
#endif
redis.c
View file @
d76412d1
...
@@ -330,7 +330,6 @@ static int setExpire(redisDb *db, robj *key, time_t when);
...
@@ -330,7 +330,6 @@ static int setExpire(redisDb *db, robj *key, time_t when);
static
void
updateSalvesWaitingBgsave
(
int
bgsaveerr
);
static
void
updateSalvesWaitingBgsave
(
int
bgsaveerr
);
static
void
freeMemoryIfNeeded
(
void
);
static
void
freeMemoryIfNeeded
(
void
);
static
int
processCommand
(
redisClient
*
c
);
static
int
processCommand
(
redisClient
*
c
);
static
void
segvHandler
(
int
sig
,
siginfo_t
*
info
,
void
*
secret
);
static
void
setupSigSegvAction
(
void
);
static
void
setupSigSegvAction
(
void
);
static
void
authCommand
(
redisClient
*
c
);
static
void
authCommand
(
redisClient
*
c
);
...
@@ -4108,7 +4107,7 @@ static void debugCommand(redisClient *c) {
...
@@ -4108,7 +4107,7 @@ static void debugCommand(redisClient *c) {
}
}
}
}
#if
def
ined(__APPLE__) || defined(__linux__)
#ifdef
HAVE_BACKTRACE
static
struct
redisFunctionSym
symsTable
[]
=
{
static
struct
redisFunctionSym
symsTable
[]
=
{
{
"freeStringObject"
,
(
unsigned
long
)
freeStringObject
},
{
"freeStringObject"
,
(
unsigned
long
)
freeStringObject
},
{
"freeListObject"
,
(
unsigned
long
)
freeListObject
},
{
"freeListObject"
,
(
unsigned
long
)
freeListObject
},
...
@@ -4192,7 +4191,6 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -4192,7 +4191,6 @@ static struct redisFunctionSym symsTable[] = {
{
"debugCommand"
,
(
unsigned
long
)
debugCommand
},
{
"debugCommand"
,
(
unsigned
long
)
debugCommand
},
{
"processCommand"
,
(
unsigned
long
)
processCommand
},
{
"processCommand"
,
(
unsigned
long
)
processCommand
},
{
"setupSigSegvAction"
,
(
unsigned
long
)
setupSigSegvAction
},
{
"setupSigSegvAction"
,
(
unsigned
long
)
setupSigSegvAction
},
{
"segvHandler"
,
(
unsigned
long
)
segvHandler
},
{
"readQueryFromClient"
,
(
unsigned
long
)
readQueryFromClient
},
{
"readQueryFromClient"
,
(
unsigned
long
)
readQueryFromClient
},
{
NULL
,
0
}
{
NULL
,
0
}
};
};
...
@@ -4274,7 +4272,7 @@ static void segvHandler(int sig, siginfo_t *info, void *secret) {
...
@@ -4274,7 +4272,7 @@ static void segvHandler(int sig, siginfo_t *info, void *secret) {
trace
[
1
]
=
getMcontextEip
(
uc
);
trace
[
1
]
=
getMcontextEip
(
uc
);
messages
=
backtrace_symbols
(
trace
,
trace_size
);
messages
=
backtrace_symbols
(
trace
,
trace_size
);
for
(
i
=
0
;
i
<
trace_size
;
++
i
)
{
for
(
i
=
1
;
i
<
trace_size
;
++
i
)
{
char
*
fn
=
findFuncName
(
trace
[
i
],
&
offset
),
*
p
;
char
*
fn
=
findFuncName
(
trace
[
i
],
&
offset
),
*
p
;
p
=
strchr
(
messages
[
i
],
'+'
);
p
=
strchr
(
messages
[
i
],
'+'
);
...
@@ -4289,7 +4287,6 @@ static void segvHandler(int sig, siginfo_t *info, void *secret) {
...
@@ -4289,7 +4287,6 @@ static void segvHandler(int sig, siginfo_t *info, void *secret) {
}
}
static
void
setupSigSegvAction
(
void
)
{
static
void
setupSigSegvAction
(
void
)
{
#if defined(__APPLE__) || defined(__linux__)
struct
sigaction
act
;
struct
sigaction
act
;
sigemptyset
(
&
act
.
sa_mask
);
sigemptyset
(
&
act
.
sa_mask
);
...
@@ -4299,12 +4296,12 @@ static void setupSigSegvAction(void) {
...
@@ -4299,12 +4296,12 @@ static void setupSigSegvAction(void) {
act
.
sa_sigaction
=
segvHandler
;
act
.
sa_sigaction
=
segvHandler
;
sigaction
(
SIGSEGV
,
&
act
,
NULL
);
sigaction
(
SIGSEGV
,
&
act
,
NULL
);
sigaction
(
SIGBUS
,
&
act
,
NULL
);
sigaction
(
SIGBUS
,
&
act
,
NULL
);
#else
return
;
return
;
#endif
}
}
#else
/* HAVE_BACKTRACE */
#endif
/* if __APPLE__ or __linux__ */
static
void
setupSigSegvAction
(
void
)
{
}
#endif
/* HAVE_BACKTRACE */
/* =================================== Main! ================================ */
/* =================================== Main! ================================ */
...
...
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