Friday, June 26, 2009

Mini-Dumps (r46/r47)

PeerBlock can now generate mini-dumps!

This means that when the program crashes, it should automagically create a peerblock.dmp file containing the state of the program as it was when the exception was hit. Hopefully this should help me get enough information that I'll be able to quickly track down crash-causing bugs such as the occasional crashes during list-updating, or while exiting the program.

From r46 on in, if you experience such a crash with PeerBlock, please make sure to send me peerblock.log as well as peerblock.dmp (if it exists).

Technical Details

I'm making use of the SetUnhandledExceptionFilter() routine, as documented in the CodeProject article Post-Mortem Debugging Your Application with Minidumps and Visual Studio .NET. Note that in order to get it to build under Win32, the "TopLevelFilter()" routine (PeerblockExceptionFilter(), for our project) needs to be declared as returning a LONG WINAPI, not just a LONG as per the article.

Currently I'm simply setting this exception-filter up during program start, and it's simply writing-out to a peerblock.dmp file in whatever directory PeerBlock is running from. Future work in this area should include writing this out to a PeerBlock App-Data directory, saving some number of dumps instead of overwriting them each time, including support for large dump-files (i.e., including heap), and ensuring that we can get a mini-dump even if we're internally catching the exception (e.g., by adding a "take dump" button to the message-box that appears, or at least by explicitly calling our PeerblockExceptionFilter() routine).

No comments:

Post a Comment