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
0e8d469f
Unverified
Commit
0e8d469f
authored
Aug 18, 2021
by
yoav-steinberg
Committed by
GitHub
Aug 18, 2021
Browse files
More generic crash report for unsupported archs (#9385)
Following compilation warnings on s390x.
parent
fe359cbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/debug.c
View file @
0e8d469f
...
@@ -1024,6 +1024,10 @@ void bugReportStart(void) {
...
@@ -1024,6 +1024,10 @@ void bugReportStart(void) {
#ifdef HAVE_BACKTRACE
#ifdef HAVE_BACKTRACE
static
void
*
getMcontextEip
(
ucontext_t
*
uc
)
{
static
void
*
getMcontextEip
(
ucontext_t
*
uc
)
{
#define NOT_SUPPORTED() do {\
UNUSED(uc);\
return NULL;\
} while(0)
#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6)
#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6)
/* OSX < 10.6 */
/* OSX < 10.6 */
#if defined(__x86_64__)
#if defined(__x86_64__)
...
@@ -1055,6 +1059,8 @@ static void *getMcontextEip(ucontext_t *uc) {
...
@@ -1055,6 +1059,8 @@ static void *getMcontextEip(ucontext_t *uc) {
return
(
void
*
)
uc
->
uc_mcontext
.
arm_pc
;
return
(
void
*
)
uc
->
uc_mcontext
.
arm_pc
;
#elif defined(__aarch64__)
/* Linux AArch64 */
#elif defined(__aarch64__)
/* Linux AArch64 */
return
(
void
*
)
uc
->
uc_mcontext
.
pc
;
return
(
void
*
)
uc
->
uc_mcontext
.
pc
;
#else
NOT_SUPPORTED
();
#endif
#endif
#elif defined(__FreeBSD__)
#elif defined(__FreeBSD__)
/* FreeBSD */
/* FreeBSD */
...
@@ -1062,6 +1068,8 @@ static void *getMcontextEip(ucontext_t *uc) {
...
@@ -1062,6 +1068,8 @@ static void *getMcontextEip(ucontext_t *uc) {
return
(
void
*
)
uc
->
uc_mcontext
.
mc_eip
;
return
(
void
*
)
uc
->
uc_mcontext
.
mc_eip
;
#elif defined(__x86_64__)
#elif defined(__x86_64__)
return
(
void
*
)
uc
->
uc_mcontext
.
mc_rip
;
return
(
void
*
)
uc
->
uc_mcontext
.
mc_rip
;
#else
NOT_SUPPORTED
();
#endif
#endif
#elif defined(__OpenBSD__)
#elif defined(__OpenBSD__)
/* OpenBSD */
/* OpenBSD */
...
@@ -1069,18 +1077,23 @@ static void *getMcontextEip(ucontext_t *uc) {
...
@@ -1069,18 +1077,23 @@ static void *getMcontextEip(ucontext_t *uc) {
return
(
void
*
)
uc
->
sc_eip
;
return
(
void
*
)
uc
->
sc_eip
;
#elif defined(__x86_64__)
#elif defined(__x86_64__)
return
(
void
*
)
uc
->
sc_rip
;
return
(
void
*
)
uc
->
sc_rip
;
#else
NOT_SUPPORTED
();
#endif
#endif
#elif defined(__NetBSD__)
#elif defined(__NetBSD__)
#if defined(__i386__)
#if defined(__i386__)
return
(
void
*
)
uc
->
uc_mcontext
.
__gregs
[
_REG_EIP
];
return
(
void
*
)
uc
->
uc_mcontext
.
__gregs
[
_REG_EIP
];
#elif defined(__x86_64__)
#elif defined(__x86_64__)
return
(
void
*
)
uc
->
uc_mcontext
.
__gregs
[
_REG_RIP
];
return
(
void
*
)
uc
->
uc_mcontext
.
__gregs
[
_REG_RIP
];
#else
NOT_SUPPORTED
();
#endif
#endif
#elif defined(__DragonFly__)
#elif defined(__DragonFly__)
return
(
void
*
)
uc
->
uc_mcontext
.
mc_rip
;
return
(
void
*
)
uc
->
uc_mcontext
.
mc_rip
;
#else
#else
return
NULL
;
NOT_SUPPORTED
()
;
#endif
#endif
#undef NOT_SUPPORTED
}
}
void
logStackContent
(
void
**
sp
)
{
void
logStackContent
(
void
**
sp
)
{
...
@@ -1099,6 +1112,11 @@ void logStackContent(void **sp) {
...
@@ -1099,6 +1112,11 @@ void logStackContent(void **sp) {
/* Log dump of processor registers */
/* Log dump of processor registers */
void
logRegisters
(
ucontext_t
*
uc
)
{
void
logRegisters
(
ucontext_t
*
uc
)
{
serverLog
(
LL_WARNING
|
LL_RAW
,
"
\n
------ REGISTERS ------
\n
"
);
serverLog
(
LL_WARNING
|
LL_RAW
,
"
\n
------ REGISTERS ------
\n
"
);
#define NOT_SUPPORTED() do {\
UNUSED(uc);\
serverLog(LL_WARNING,\
" Dumping of registers not supported for this OS/arch");\
} while(0)
/* OSX */
/* OSX */
#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_6)
#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_6)
...
@@ -1323,6 +1341,8 @@ void logRegisters(ucontext_t *uc) {
...
@@ -1323,6 +1341,8 @@ void logRegisters(ucontext_t *uc) {
(
unsigned
long
)
uc
->
uc_mcontext
.
fault_address
(
unsigned
long
)
uc
->
uc_mcontext
.
fault_address
);
);
logStackContent
((
void
**
)
uc
->
uc_mcontext
.
arm_sp
);
logStackContent
((
void
**
)
uc
->
uc_mcontext
.
arm_sp
);
#else
NOT_SUPPORTED
();
#endif
#endif
#elif defined(__FreeBSD__)
#elif defined(__FreeBSD__)
#if defined(__x86_64__)
#if defined(__x86_64__)
...
@@ -1378,6 +1398,8 @@ void logRegisters(ucontext_t *uc) {
...
@@ -1378,6 +1398,8 @@ void logRegisters(ucontext_t *uc) {
(
unsigned
long
)
uc
->
uc_mcontext
.
mc_gs
(
unsigned
long
)
uc
->
uc_mcontext
.
mc_gs
);
);
logStackContent
((
void
**
)
uc
->
uc_mcontext
.
mc_esp
);
logStackContent
((
void
**
)
uc
->
uc_mcontext
.
mc_esp
);
#else
NOT_SUPPORTED
();
#endif
#endif
#elif defined(__OpenBSD__)
#elif defined(__OpenBSD__)
#if defined(__x86_64__)
#if defined(__x86_64__)
...
@@ -1433,6 +1455,8 @@ void logRegisters(ucontext_t *uc) {
...
@@ -1433,6 +1455,8 @@ void logRegisters(ucontext_t *uc) {
(
unsigned
long
)
uc
->
sc_gs
(
unsigned
long
)
uc
->
sc_gs
);
);
logStackContent
((
void
**
)
uc
->
sc_esp
);
logStackContent
((
void
**
)
uc
->
sc_esp
);
#else
NOT_SUPPORTED
();
#endif
#endif
#elif defined(__NetBSD__)
#elif defined(__NetBSD__)
#if defined(__x86_64__)
#if defined(__x86_64__)
...
@@ -1486,6 +1510,8 @@ void logRegisters(ucontext_t *uc) {
...
@@ -1486,6 +1510,8 @@ void logRegisters(ucontext_t *uc) {
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_FS
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_FS
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_GS
]
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
_REG_GS
]
);
);
#else
NOT_SUPPORTED
();
#endif
#endif
#elif defined(__DragonFly__)
#elif defined(__DragonFly__)
serverLog
(
LL_WARNING
,
serverLog
(
LL_WARNING
,
...
@@ -1517,9 +1543,9 @@ void logRegisters(ucontext_t *uc) {
...
@@ -1517,9 +1543,9 @@ void logRegisters(ucontext_t *uc) {
);
);
logStackContent
((
void
**
)
uc
->
uc_mcontext
.
mc_rsp
);
logStackContent
((
void
**
)
uc
->
uc_mcontext
.
mc_rsp
);
#else
#else
serverLog
(
LL_WARNING
,
NOT_SUPPORTED
();
" Dumping of registers not supported for this OS/arch"
);
#endif
#endif
#undef NOT_SUPPORTED
}
}
#endif
/* HAVE_BACKTRACE */
#endif
/* HAVE_BACKTRACE */
...
...
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