2

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?

Stéphane
  • 19,459
  • 24
  • 95
  • 136
  • Are you sure that interactive debugging is not a better option? Or am I missing the point? – new123456 Oct 27 '10 at 11:57
  • These devices run at customer sites. Some of them are not directly available, but we can log as much as we want and have the log files sent back to us. – Stéphane Oct 27 '10 at 21:35

1 Answers1

1

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.

Jonathan
  • 13,354
  • 4
  • 36
  • 32
  • Thank you, yes, that is one of the things we currently do on some installations. – Stéphane Oct 27 '10 at 21:37
  • If you've got the core dump, and you've got some rich internal structures that are "always useful" to know about, a bit of work with GDB + Python can automate pulling those structures out and rendering them in a helpful way alongside the stack trace. After dumping core, run such an analysis script on the dump, then email or upload the results. Might save you the hassle of dealing with entire core files, very dependent on the application. – lyngvi Jun 12 '15 at 22:20