I want to create a core dump whenever my process crashes. Currently I am following this approach:
Updated
Actually I think I should say about one possible difference between debug and release versions that I didn't mention in my message. Release versions might be built with the NDEBUG define in order to get rid of all assert()
in the program. Debug versions on the contrary should be built without defining NDEBUG as assert()
helps in finding bugs.
However if you don't use assert()
there will be no difference.
A user can set ulimit -c unlimited in his or her profile.
Backtrace of an program compiled with some optimization often doesn't give a line number which is useful.
You can build a version with debugging information and put in your archive. Then strip it and deliver the stripped binaries to your customers. If a customer gives you a core file then just use the version with debugging information and the core file from the customer.
How to create a core dump in the "release" build of a program?
It's not your responsibility, it's responsibility of the OS.