The magic incantation
LD_PRELOAD=/lib/libSegFault.so someapp
runs someapp with libSegFault.so providing backtrace information on a
In a similar vein, the glibc exception handler writes a stack dump to /dev/console on heap corruption errors.
If you are running your executable in a non tty (i.e. a systemd process or other detached process), the crash output goes to /dev/null, which is not so useful.
There is an undocumented feature to redirect the output to /dev/stderr. Set the following environment variable:
export LIBC_FATAL_STDERR_=1
This can be used in conjunction with libSegFault.so for maximal forensics.
It is also worth mentioning that this might give you two stack traces if you also enable backtraces for SIGABRT, as the glibc first does a stack trace, then signals SIGABRT ... and then libSegFault gives a second stack trace.