2

Since yesterday, all blue dots (compiled lines) in my source code are shifted with one line up. So, the first dot starts at 'var' instead of 'begin' and the last dot is one line before the last 'end' of a function.

I deleted all files (starting with DCUs) except DPR, PAS, DFM and DPRJ and recompiled. But the dots are still shifted. How can I fix this? It makes the step=by-step debugging almost impossible.

Shannon Matthews
  • 9,649
  • 7
  • 44
  • 75
Gabriel
  • 20,797
  • 27
  • 159
  • 293
  • 1
    Clearing DCUs and forcing a full build is the usual way to fix this. Is it possible that your editor is looking at a different version of the source code file in a different file location from the version used in the project. – David Heffernan Jul 07 '11 at 11:41
  • David is on to something! You can easily test this by entering some uncompilable gibberish somewhere within the file, and see if the compiler's complaining. If it's not, you're looking at one file and it is compiling an other. – Cosmin Prund Jul 07 '11 at 11:44
  • I just deleted the DCU in every single library I have and rebuild everything from zero. The dots are still shifted. This is indeed strange! – Gabriel Jul 07 '11 at 11:54
  • @Cosmin - I followed your advice and put random text right on the line where is the first dot (the line contained only the 'var' word) and the compiler immediately complained. There is another way to see the full path of the file that I am currently editing? – Gabriel Jul 07 '11 at 11:56
  • Is that unit part of a package? Are you using runtime packages? Did you do a search-for-files to look for all YourUnit.DCU files? – Cosmin Prund Jul 07 '11 at 11:56
  • @cosmin - yes. it is part of a package (that I just cleaned and rebuild - just to be sure). I will do a search now. – Gabriel Jul 07 '11 at 11:59
  • Just great. I deleted the DCU associated (this time, not all DCUs in the folder but only that specific DCU) with that file and the whole 'history' folder and recompiled. Now the dots are shifted with two lines (up) !!!!!!!!!!!!!!!!!!! – Gabriel Jul 07 '11 at 12:02
  • It could be that the file is corrupted so that you don't have proper line end combination (#13#10) on one line. Is the "one line up error" throughout the file or does it start somewhere in the middle of the unit? – ain Jul 07 '11 at 12:02
  • Try debugging without packages, to make sure you're using a "fresh" copy of the unit. Once debugging is done, recompile the package. And do a search & delete for the BPL and DCP's of the package as well, to make sure you're linking an up-to-date copy. – Cosmin Prund Jul 07 '11 at 12:04
  • @ain - YES! It is starting at a certain point in my file. All blue dots are ok ABOVE that certain spot! Looks like a half-enter problem! I will hex edit the file. – Gabriel Jul 07 '11 at 12:09

3 Answers3

7

It could be that the file is corrupted so that you don't have proper line end combination (#13#10) on one line. Is the "one line up error" throughout the file or does it start somewhere in the middle of the unit?

Beginning with Delphi 2007 (maybe already Delphi 2005) you can check the line ends in your code by enableing checkbox Show line breaks in Tools - Options - Editor options - Source options. The line breaks look like this:

enter image description here

As you can see, a CR on its own is not considered a line break and messes up the synchronization of the executable line dots

Tom Brunberg
  • 20,312
  • 8
  • 37
  • 54
ain
  • 22,394
  • 3
  • 54
  • 74
0

Try closing Delphi then deleting all *.identcache files.

I have a batch file at the root of my Delphi projects directory that recursively deletes all identcache files.

Shannon Matthews
  • 9,649
  • 7
  • 44
  • 75
  • I don't think they are related to the problem. "Temporary Cache File created by refactoring engine to improve performance. " http://delphi.wikia.com/wiki/Delphi_File_Extensions – Gabriel Mar 24 '17 at 10:24
  • @Turbine Sorry, I have no idea how this affects Delphi's debugger, only that it does. While using Delphi Berlin for the last couple weeks, the debugger will occasionally go out of sync with the project. The program ignores all breakpoints and the blue dots are not in the correct place. Deleting the identcache files has fixed the problem each time. – Shannon Matthews Mar 25 '17 at 20:41
  • @Turbine This is an old question, but a recent question http://stackoverflow.com/questions/42991392/delphi-my-debugger-seems-to-be-out-of-sync-with-the-source-code?noredirect=1&lq=1 was closed as a duplicate to this one. – Shannon Matthews Mar 25 '17 at 20:45
0

Try This:

  1. Open the unit in an editor with capabilities to change codification, like Notepad++.

  2. Code/save the file as ANSI.

  3. Open or recharge the file in the Delphi IDE.

The dots must be in the right place.

  • 1
    This answer is incorrect. It has nothing to do with collation. The problem has to do with improper line endings (a CR alone instead of a CRLF combination). That information is provided in the previous answers, all of which were written nearly 4 years ago. (The Delphi IDE has supported non-ANSI content since long before the XE version, BTW.) – Ken White Feb 07 '20 at 13:18