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

前端 未结 20 1181
甜味超标
甜味超标 2020-11-29 08:25

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

相关标签:
20条回答
  • 2020-11-29 08:29

    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

    0 讨论(0)
  • 2020-11-29 08:33

    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.

    0 讨论(0)
  • 2020-11-29 08:35

    Here's one more reason to misaligned code vs breakpoint markers (blue/red "pill" in the gutter).

    The editor recognices three different line endings,

    • CRLF (Carriage Return - Line Feed pair)
    • CR only
    • LF only

    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.

    0 讨论(0)
  • 2020-11-29 08:35

    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 .)

    0 讨论(0)
  • 2020-11-29 08:37

    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.

    0 讨论(0)
  • 2020-11-29 08:41

    It is a bug, restarting Delphi will fix your problem.

    0 讨论(0)
提交回复
热议问题