Stéphane
Stéphane

Reputation: 20350

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 'sexy' thing to do?

Upvotes: 2

Views: 226

Answers (1)

Jonathan
Jonathan

Reputation: 13624

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.

Upvotes: 1

Related Questions