Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
70296dde
Commit
70296dde
authored
Apr 19, 2015
by
Fabio Bas
Browse files
Simple stack trace for singla handler (unix only)
parent
5f13f89d
Changes
1
Hide whitespace changes
Inline
Side-by-side
servatrice/src/main.cpp
View file @
70296dde
...
@@ -33,8 +33,12 @@
...
@@ -33,8 +33,12 @@
#include
<google/protobuf/stubs/common.h>
#include
<google/protobuf/stubs/common.h>
#ifdef Q_OS_UNIX
#ifdef Q_OS_UNIX
#include
<signal.h>
#include
<signal.h>
#include
<execinfo.h>
#include
<unistd.h>
#endif
#endif
#define SIGSEGV_TRACE_LINES 40
RNG_Abstract
*
rng
;
RNG_Abstract
*
rng
;
ServerLogger
*
logger
;
ServerLogger
*
logger
;
QThread
*
loggerThread
;
QThread
*
loggerThread
;
...
@@ -129,6 +133,16 @@ void myMessageOutput2(QtMsgType /*type*/, const QMessageLogContext &, const QStr
...
@@ -129,6 +133,16 @@ void myMessageOutput2(QtMsgType /*type*/, const QMessageLogContext &, const QStr
#ifdef Q_OS_UNIX
#ifdef Q_OS_UNIX
void
sigSegvHandler
(
int
sig
)
void
sigSegvHandler
(
int
sig
)
{
{
void
*
array
[
SIGSEGV_TRACE_LINES
];
size_t
size
;
// get void*'s for all entries on the stack
size
=
backtrace
(
array
,
SIGSEGV_TRACE_LINES
);
// print out all the frames to stderr
fprintf
(
stderr
,
"Error: signal %d:
\n
"
,
sig
);
backtrace_symbols_fd
(
array
,
size
,
STDERR_FILENO
);
if
(
sig
==
SIGSEGV
)
if
(
sig
==
SIGSEGV
)
logger
->
logMessage
(
"CRASH: SIGSEGV"
);
logger
->
logMessage
(
"CRASH: SIGSEGV"
);
else
if
(
sig
==
SIGABRT
)
else
if
(
sig
==
SIGABRT
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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