I'd like to debug Lazarus library code. In Delphi IDE I would simply check the Project Options -> Compiler -> Use Debug DCUs option on. Is there something similar in Lazarus?
1 Answers
Yes and no. It roughly works the same as in Delphi, you need two sets of the compiled units. (.o/.ppu), and some way to switch.
But because FPC/Lazarus are open source, only one set (the one without) is distributed. But you can craft the other byrecompile FPC and Lazarus with -gl. For tips on recompiling FPC/Lazarus see http://www.stack.nl/~marcov/buildfaq.pdf
(it is even possible to do combinations. I debug many of my applications with everything debug except systems and sysutils, so that I don't trace into each and every string and exception helper, a major annoyance on Delphi)
Currently the releases afaik don't distribute the duplicate sets, but this is more a release engineering problem. (specially since by using strip, the non-debug set can be probably crafted from the debug set)
BTW, it might be worth the trouble to ask on the Lazarus maillist if such way exists. Even if the release doesn't set it up, there might still be a possibility that the functionality exists.

- 25,628
- 5
- 56
- 89
-
3In Delphi you can change extension of dcu's in \lib\debug to bac for example. – Torbins Jun 20 '10 at 11:19
-
@Torbins - why didn't I ever think of that? – Gerry Coll Jun 20 '10 at 11:29
-
@Torbins: I know that is possible, but I rather not mess with the default libs. I still have to research if there is not a way to create more than two sets of DCUs. – Marco van de Voort Jun 20 '10 at 14:42
-
In Delphi you can load symbols selectively: http://blogs.embarcadero.com/chrishesik/2009/09/22/34916 – Jun 20 '10 at 16:34
-
1Interesting, but that seems to be on a per module basis only, and I only have just the .exe – Marco van de Voort Jun 20 '10 at 17:16
-
Archived copy of selective symbols loading is here - https://web.archive.org/web/20090924034157/http://blogs.embarcadero.com/chrishesik/2009/09/22/34916 – Serhii Kheilyk Sep 30 '20 at 14:02