From time to time I lose breakpoint functionality in Delphi.
I thought this to be a Delphi 2009 issue but now I have also it in Delphi XE.
In Delphi 2009 by
Another reason for not working breakpoint could be (often tested with delphi5):
Too many procedures in a unit.
The solution is to move procedures to another unit
If the project group uses packages (BPLs) ensure that none of them have any compiler warnings regarding implicitly imported units. If these exist you will only be able to step through the code via the CPU debug window.
Here's one more reason to misaligned code vs breakpoint markers (blue/red "pill" in the gutter).
The editor recognices three different line endings,
Of these, CRLF
is the default in the editor.
The compiler however, doesn't seem to consider CR only
as a line ending, only CRLF
and LF only
. Thus if your source file happens to have one or more CR only
, the "blue pills" will be offset from the source.
You might have got source files with CR only
EOL (end of line) character from e.g. the internet. I recall MAC OS used CR only
as EOL.
To verify the EOL's in your file, you can turn on the displaying of EOL's in the editor
( Tools - Options - Editor options - Source options - Show line breaks)
.
The symbols look weird (see images below), but are just C on top of L for CRLF, C on top of R for CR and L on top of F for LF.
The following images show the normal EOL's (CRLF
) and the EOLS's after I forced CR only
for one line and LF only
for another line in a hex editor. As said above, it is the CR only
that offsets the break point markers from the source code.
Normal CRLF
EOL's:
One line with CR only
and one with LF only
:
Fix
To reset all EOL's to CRLF
, untick Preserve line ends
in Editor Options
( Tools - Options - Editor options)
,
make a trivial change, so that the file is marked as modified, close the file, save changes to XYZ.pas? YES, and reopen.
Now all line endings are CRLF. Rebuilt the project and all the breakpoint balls will be in the correct locations.
In my case, I was setting breakpoints in a unit that whilst open in the IDE was not part of the currently active project. Such breakpoints also show as green. IOW I was not on the right page at all.
(I discovered this after trying all of the above .)
I had the same problem with XE4. This is why I found this article a couple of hours ago. None of the above solutions worked for me. The correct solution for me - up to now - was to add "remote debug symbols" option. Strange because I don't use remote debugging. Anyway it looks OK now.
It is a bug, restarting Delphi will fix your problem.