OpenInsight 9.2.1 saw the introduction of a Debugger Intercept facility and this can be used to create a Debugger Dump file.
The debugger_dump procedure is designed to be executed from within a “debugger intercept” procedure which is triggered when the engine hits a debug condition. The intercept can be setup by simply openning the Database Manager and chosing the Environment Settings option from the ‘Database’ menu. On that screen the Intercept radio button can be selected (as shown in the graphiv opposite).
The debugger intercept procedure by default is called “Debugger_Replacement” and an example version is supplied with OpenInsight and you can change this to your own procedure if you wish by updating field 54 of your application’s environment record (see the ENVIRON_CONSTANTS insert) or use the dialog above.
Once in the intercept routine you can look at the contents of any variable in the broken program with the debugger_Fetch() function. An example of how this works can be found the the debugger_dump() procedure, also supplied with OpenInsight. This simply attempts to write out the local and global variables to a text file.
One thing to remember about working in the debugger intercept routine is that the engine is already in an error state – your code should do the minimum possible to handle the error and then return – doing lots of screen updating, displaying messages and stuff probably isn’t a good idea. When we use this we normally write the errors out to a log or send an email and then return.
Thanks to Carl Pates (Sprezzatura) for this article.