0

I'd like to collect just the stacktrace for crashes which would normally result in very large coredumps. It seems like one option is to attach to the process when it's in a crashed but not yet cleaned up state. I tried gstack which uses gdb but gdb didn't like the fact that the process had already crashed.

Does anyone know if libunwind could do this?

This question seemed relevant:

How to get a "backtrace" (like gdb) using only ptrace (linux, x86/x86_64)

and contained a reference to this example:

http://git.savannah.gnu.org/cgit/libunwind.git/plain/tests/test-ptrace.c?h=v1.0-stable

Thanks a bunch!

Community
  • 1
  • 1
matthewatabet
  • 1,463
  • 11
  • 26
  • On a project where I work `pstack` (on Linux it is `gstack`) is run from a signal handler like a SIGSEGV handler. That is in the signal handler first `fork()` is done, then `execl()` and then `wait()`. All these function are async signal safe. Stacktraces are collected and saved without any problems. –  Nov 22 '14 at 18:45
  • On Linux check out the "coredump filter" instead. This is how ABRT works. FWIW gdb doesn't care about the state of your process. If you couldn't get a stack trace, then most likely the stack was trashed. – Tom Tromey Nov 22 '14 at 21:13

0 Answers0