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.
I found a better way.
From the Project Manager tree, right click on the project and choose "Clean" from the popupmenu.
The breakpoints reappear magically and it is a very fast method.
I suspect this happens when you have done a release build, with debug disabled. Then you switch back to debug configuration and do a compile rather than a build. The files where you can't set breakpoints correspond to those with DCUs produced by a compile with debug disabled.
Simply doing a build to re-generate all DCU files will make your breakpoints work again.