Generic advice: capture core dump
Ideally, when/if my Qt app crashes, I'd like to be able to "eject" a core-dump that will allow me to take that dump (e.g. user e-mails support), put it on a machine with the source code and do some 'forensics' on what occurred at the time of the crash. Sort of like Visual studio and its dmp files.
Any ideas/pointers on how I do this on a C++ Qt app that'll be targeting Win32, OSX and Ubuntu?
thins is more platform and compiler dependent that Qt dependent. Getting the call stack on windows can (afaik) be done with win32 API calls for MSDEV builds. how to do it with mingw? I don't know. and it will be different for other platforms and tool chains.
I think you coudld have a look at breakpad:"https://code.google.com/p/google-breakpad/".
From what I know, it's cross-platform, allows easy reporting and does part of the tricky work for you (like reading map file and crash report to give you an human readable format).
I planned to use it personnally with Qt but it was thrown out of my roadmap, so can't give actual feedback
Take a look at Dr Konqi that ships with KDE.
ulimit -c unlimited (to allow writing core files)
ulimit -a (to check status of previous, -c, operation)
gdb <corefilename> (+ man gdb, to explore the resulting data)
C idea: (Ubuntu & OSX approved)
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/backtrace.3.html (code snippet for printing the call stack... provided it's not been smashed... yet XD)
The only way to be portable amongst Mac / linux / windows is to rely on 3rd party : otherwise, you'll end up writting #ifdef code everywhere (and breakpad is definitely a good idea)