I'm writing error handling code for a server on FreeBSD. For extremely serious errors I want to avoid data corruption by immediately terminating. That's easy, exit(3)
. Before I exit, I output my relevant variables that led me there. However, ideally, this termination would be accompanied by a .core
so that I could fully investigate what got me to this catastrophic (and likely hard to reproduce) state.
How can I force this to happen?