views:

98

answers:

1

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?

+2  A: 

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.

Marco van de Voort
In Delphi you can change extension of dcu's in \lib\debug to bac for example.
Torbins
@Torbins - why didn't I ever think of that?
Gerry
@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
In Delphi you can load symbols selectively: http://blogs.embarcadero.com/chrishesik/2009/09/22/34916
ldsandon
Interesting, but that seems to be on a per module basis only, and I only have just the .exe
Marco van de Voort