Delphi Programming

  1. Home
  2. Computing & Technology
  3. Delphi Programming

How to Debug Delphi VCL Source Code (Set a Breakpoint in the VCL)

Set a Breakpoint in the VCL Source Code

By Zarko Gajic, About.com

Debug Delphi VCL Source Code

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:

  1. Select "Project - Options" from the main IDE menu
  2. Select "Compiler" section on the "Project Options for [ProjectName].exe"
  3. Locate the "Debugging" group box,
  4. Make sure the "USE DEBUG DCUs" check box is checked!
  5. Set the breakpoint somewhere in the TCustomForm's CreateParams method, for example.
  6. 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.

Delphi tips navigator:
» Disable Automatic Hint Feature for the TTreeView
« Parsing Command Line Parameters with Delphi

More Delphi Programming Quick Tips
Zarko Gajic
Guide since 1998

Zarko Gajic
Delphi Programming Guide

Explore Delphi Programming

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Delphi Programming

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. Delphi 2007 Tips
  7. How to Debug Delphi VCL Source Code

©2009 About.com, a part of The New York Times Company.

All rights reserved.