[Lazarus] GDB is not good, any tricks to improve it?

Martin Frb lazarus at mfriebe.de
Thu May 26 18:37:28 CEST 2016

On 26/05/2016 06:31, Dennis wrote:
> I am using Lazarus 1.7 (2016-04-20) with FPC 3.1.1
> Great Work guys!
> However, the gdb that comes with it is not as good.  I know debugger 
> is hard to write so I am not blaming it.
> I just hope someone can share some tips or settings tricks that I can, 
> perhaps, make it work better?
> e.g. it is very slow and its speed is not stable.
> Sometimes, it is extremely slow or even stall the execution of the 
> main program.  But when I delete all breakpoints and restart it and 
> add back the breakpoints, it runs faster.

OS, bitness?

For windows we have alternative gdb versions on our Source forge site. 
They might improve stability.

try dwarf (ensure you also do that for all packages).
My tests (on windows) show that gdb 7.11 has massive issues with stabs.

Also on windows, 7.7 was the most stable. All above becomes less stable. 
More crashes
7.7 has one bug mixing records and classes.... there is a list of some 
gdb issuse on http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips

Speed (for watch evaluation): Use fpdebug (install the package). But it 
is still early beta, maybe alpha. And it does not work with generics.

I run AVG and have no issues. I did exclude gdb and my lazarus project 

As for what watches can be evaluated.... That problem is much deeper 
than gdb.

correct scoping. (unit order for globals, if several used units have a 
global var of the same name).
dwarf (2 and 3, not sure about newer) do not support that. so fpc doesnt 
even include the info in the exe.

same dwarf (2 and 3, not sure about newer) do not support that.

function calls. that is gdb. so fpdebug could learn that. but it still 
would not know what function a property maps to.

properties/functions that return string or dyn-array(managed type) or 
take them as argument.
dwarf (2 and 3, not sure about newer) do not support that. There is on 
spec how to get/discard the managed type, so leak and crashes would happen.

All in all, even with a debugger written for pascal, there would be many 
issues left.
Newer dwarf might have solved some, or fpc could add custom tags only 
for the "custom fpc debugger"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160526/a67471c6/attachment-0003.html>

More information about the Lazarus mailing list