Delphi: why breakpoints from time to time are not usable (green highlighted line on IDE)?

Debug info isn’t present in the file.

Make sure that you’re using the Debug configuration. (Project Manager tree, expand Build Configurations, make sure Debug is bold. If it’s not, right click Debug and choose Activate from the context menu.) Make sure you then do a Build of your project, not just a Compile.

If that still doesn’t work, go to Project->Options from the IDE’s main menu, click on Compiling under Delphi Compiler, and check the Debugging section on the right half of the window. Make sure that Debug Information and Local Symbols are both checked. If you’re trying to trace into the VCL’s own source, also check Use debug .dcus (you’ll want to turn this off and do a full build of your project as soon as you’re done, as it gets annoying when you’re debugging normally). Again, you’ll want to build and not compile.

If all of the above fails, another possibility is that the code unit you have open in the Code Editor isn’t the same one being seen by the compiler. Make sure you don’t have multiple copies of the file on your computer in a location that the compiler might find first. If you’re not sure, delete the .dcu files with that unit name and then do a build of your project, and see if the newly created .dcu is in the location you’d expect.

Leave a Comment