Mega Code Archive

 
Categories / Delphi / VCL
 

How to Debug Delphi VCL Source Code

Title: How to Debug Delphi VCL Source Code No matter how careful you are when writing code, your programs are likely to contain errors, or bugs, that prevent them from running the way you intended. Debugging is the process of locating and fixing errors in your programs. One way to locating errors while designing your code is to use the integrated debuger. If you set a breakpoint on a line in your source code, the line that contains the breakpoint appears in the Code editor highlighted. A location in your program's source code where you want the execution to stop is called a breakpoint. Debugging FORMS.PAS, SYSUTILS.PAS or SYSTEM.PAS What if you need to "dive" into the source code Delphi controls are made of? What if you need to step through the CreateParams method of the TCustomForm class? Luckily, the Delphi IDE allows you to set the breakpoint in the VCL source code units. Here's how enable debugging VCL and RTL source code: Select "Project - Options" from the main IDE menu Select "Compiler" section on the "Project Options for [ProjectName].exe" Locate the "Debugging" group box, Make sure the "USE DEBUG DCUs" check box is checked! Set the breakpoint somewhere in the TCustomForm's CreateParams method, for example. Start the application ... Note: if you have a Delphi version that comes with the source code (YES! some Delphi versions include the full VCL / RTL source code), you can easily browse through it! Here's How to Browse Delphi's VCL Source Code.