Debugging a Wizard or Component Package

Debugging a Wizard or Component can be frustrating at the least. Luckily it is possible to debug a Wizard package almost like a normal application. It is done by running Delphi as the application being debugged through the Delphi debugger... was that clear <G>?

How you ask? It is actually quite slick:

  • Open Delphi and then open the Package containing the Wizard or Component code.

  • Compile the package with the following options, the main points being turning off Optimization, turning on all debugging options and setting the linker to include Remote Symbols

Debug Options

Debug Options

  • Now open the Run > Parameters dialog and in the Host Application insert the full path to the Delphi executable.

Debug Options

  •   Now set some break points in the package code and hit Run. A second instance of Delphi will open but usually not after a few exception messages. I usually turn off break on exceptions in the Tools > Debugger Options dialog.

Debug Options

  • Debug as usual. The only catch is you can't step into the VCL source code but I have never found that to be a problem as it is usually a dumb mistake made by me that is the problem.

  • For components I set a break on the constructor of the component then in the second instance of Delphi drop one of the components on the form. The first instance of Delphi will break and you can single step through the constructor. Similar carefully placed breakpoints in the component code will quickly allow you to find your error.

  • For Wizards the usually problem area is the Execute method so a break point here work great. Set a breakpoint then run the Wizard from the Repository or Menu Item and debug away.

 


mustangpeak.net

  Last Modified on: