Debugging a plug-in is a little different than most applications because it involves 2 interactive processes; DigiView and the plug-in itself. You can not just set breakpoints and then 'run' the plug-in. You have to wait until DigiView starts the plug-in as a separate process. Once the plug-in is running, you can attach a debugger to it and set breakpoints. However, at this point, the entire plug-in runs to completion before you can attach the debugger. You usually want to set breakpoints before the plug-in runs but you can't attach the debugger until after it runs.
Another complication is the fact DigiView guards communications with the plug-in with a 2 seconds timeout. If the plug-in stops accepting or returning data for more than 2 seconds, DigiView unloads the plug-in and disables any signals using it. Of course, every time your plug-in hits a breakpoint or you pause too long on a single-step, it will timeout.
DigiView includes a feature to help with both of these problems.
DigiView includes an option setting to assist plug-in debugging. Setting 'Config->Environment->Debug Plug-ins' causes DigiView to modify its behavior as follows:
Pauses after loading a plug-in
A dialog is presented immediately after loading a plug-in and starting to communicate with it. At this point, the OnLoad routine is the only user code in the plug-in that has executed. This pause gives you a chance to attach a debugger and to set breakpoints in your plug-in code before any other code is executed. Once you select 'OK', the plug-in is interrogated, configured and called to parse the existing capture data.
Traps plug-in communication timeouts
All interaction with a plug-in is guarded with a 2 second watchdog timeout. Normally, if the plug-in does not respond to a command or absorb enough data to allow new commands in that amount of time, an error is generated. the plug-in is unloaded, and any signals using the plug-in are disabled. When debugging support is enabled, a timeout dialog is presented rather than unloading the plug-in.
If you select 'Ignore', the timer is reset and the operation is retried. This allows you to set breakpoints and single-step your code without DigiView killing your process. It also means that once you select 'Ignore', DigiView will pick up where it left off rather than starting over. Selecting 'Abort' will unload the plug-in and disable associated signals.
The following sections describe how to set up for debugging and some work-flows to deal with these challenges.