2010-02-26

Mathematica Debugger Traps

When I first started using WorkBench 2.0 and Mathematica 7.0.1 I found the operation of the debugger flaky.  However I have identified a number of issues have helped me.

1 My problem was due to using a global connection in the module:

conn=OpenSQLConnection[…

This then prevents the debugger working.  I have now reworked my code so that I don’t use this type of connection. 

I have tested whether it is expensive to open a SQL connection on every call or if you do it just once for a group of calls.  Doing 10 simple queries took 1.7 seconds if the connection was opend and closed every time and ca 1 second if it was only opened once.  So for the generation of reports I am going to avoid the considerable work involved in doing two headers and wait until I can generate them automatically.

2 Timing.  You have to wait until the Workbench has finished loading.  This takes a number of seconds and you can easily start executing code in the opened notebook first.  If you do that the bottom right of the workbench screen will look like this:

workbenchScreenShot

The input number will be 2 rather 7 or 8 which is normal if the debugger is going to work.

3 I tried SVN addin to the workbench and that was a bad idea.  I had to uninstall and reinstall workbench to get back a working version.  I saw a post where Wolfram are working on the SVN version so I hope that comes through.

4 In the debug screen I make sure I delete other debug activities before starting a new debugging session.

5 Be good about default directories.  I tried a different directory for the module and the debugger wouldn’t breakpoint at it.  Moving it to the normal directory worked fine.

No comments: