PDA

View Full Version : redirecting ASSERTs



drhex
24th July 2009, 21:20
I have setup my application so that if there is an uncaught exception or a segfault, it will call a special function that will save the data the user was working on and startup gdb to produce a stacktrace. This works fine, but sometimes the program dies because of an ASSERT (within the Qt library, I have none in my own code).

Is there a way to have assert cause a segfault or call one of my functions so the program can save user data and print a stacktrace before it dies?

caduel
24th July 2009, 21:41
install an event handler for SIGABRT

wysota
24th July 2009, 22:59
Q_ASSERT only works in debug mode so when you deploy the application to your users, Q_ASSERT will never cause an abort.