Getting help from the Doctor (Dr Watson that is!)

You cannot ship a device connected to the debugger so eventually you will have to cut the cord and run your device standalone. Windows mobile ships a pocket version of Dr Watson that can help evaluate application exceptions that occur while in this unconnected state. Dr Watson already deals with the heavy lifting of logging the exception and providing a debuggable kernel dump – all you need to do is to get these dump files into your release directory for debugging. The default values I like to change are:

 

HKEY_Local_Machine\System\ErrorReporting\DumpSettings\DumpDirectory = \<storage card name>\DumpFiles

HKEY_Local_Machine\System\ErrorReporting\UploadSettings\DontUpload = 1

 

Changing these settings will write .kdmp files to your storage card and Watson won’t attempt to upload the files to the Watson server. Additionally, the Watson UI will not be displayed – so don’t be surprised if you no longer see the dialog prompting you to report the errors found. By logging to an external storage card, you can simply remove the card after any Hopper run and view the exceptions that occurred on that device – you will need to look carefully since the DumpDirectory is hidden.

 

There are additional settings you can play with (like MaxDiskUsage and MaxLogFiles), but in general the Watson documentation is excellent (search for “Error Reporting”) and won’t need repeating here.

 

Once the kdmp file is in your release directory, it is possible to connect the debugger directly using the PMD (Post Mortem Debugger) available on JetStream for your Windows Mobile partners. The dump provides a snapshot view of the exception including the call stack, disassembly and the register values – basically enough information to solve most program exceptions that may occur on your device.