Linux C and C++: what else should I be logging when handling signals like SIGSEGV?
Working on some linux (Ubuntu) systems, running some in-house C and C++ apps (gcc).
There is a long list of signals which are handled, such as SIGSEGV
and SIGINT
. On signal, the callstack is obtained using backtrace(3)
and backgrace_symbols(3)
. For C++ the function names are even demangled with abi::__cxa_demangle()
.
My question is: when these signals come up, what other C/C++ API is there which would give us more useful information to log for debugging after-the-fact? Or is the backtrace the only 's开发者_JS百科exy' thing to do?
You may want to enable core dumps... ulimit -c unlimited
or similar. Then you can load the core file into GDB and see what happened to the program.
精彩评论