<$BlogRSDUrl$>

Friday, November 19, 2004

Debugging Delphi 8, VS.NET style 

While I prefer most aspects of the Delphi 8 and C#Builder IDEs over VS.NET 2003, there is one area I prefer in VS.NET. When it comes to debugging I feel that VS.NET has the edge here, especially if you need to inspect the value of a variable which is an array, or contains other classes (either as a collection, array, or exposed instance). VS.NET allows you to drill down a treeview of the variable contents, which makes it a cinch to inspect the value of any property of even the most complex class instance. I do have a QualityCentral request to have similar variable inspection support implemented in Delphi, but this hasn't been done yet.

However all is not lost, thanks to the debugging support shipped with the .NET Framework SDK. In the SDK install directory (which on my PC is C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\) there is a GUIDebug subdirectory which contains a program called DebugCLR.exe. This allows you to debug any .NET binary, and provides the ability to inspect variables in the same manner as VS.NET. It's even smart enough to allow you to set breakpoints in your Delphi source and step through just as you would in the Delphi IDE. You will have to associate the source code files one by one, and get used to the different keyboard mapping though.

You can even configure the Delphi 8 tools menu to call this, to simplify using it in those times where you need something a little more powerful than Delphi's variable inspection support. To do that follow these steps in the Delphi 8 IDE:-

- Tools|Configure|Tools.
- Click the 'Add...' button.
- Set the 'Title' edit to 'Microsoft CLR Debugger
- Set the 'Program' edit to point to the DebugCLR.exe
- Set the 'Parameters' edit to '$EXENAME'
- Click the 'OK' button to add the debugger to the Tools menu
- Click the 'Close' button to close the Tools Options dialog

There is one caveat here. It seems that DebugCLR won't allow you to debug the exe until you explicitly tell it you want to debug it. To do this, follow these steps :-

- Debug|Program to Debug...
- Click the 'OK' button.

Comments:
Delphi 2005 does improve debugger support somewhat.

http://blogs.borland.com/chrishesik/archive/2004/12/02/2020.aspx

-Brion
 
Post a Comment

This page is powered by Blogger. Isn't yours?