Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-05

GDB is not good, any tricks to improve it?

10 messages · 6 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dennis

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.

I am hoping people can share this kind of tips.

Anyone?

Dennis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160526/4ba862a3/attachment.html>

Reply by email

Graeme Geldenhuys
to Dennis
Dennis wrote
However, the gdb that comes with it is not as good.

That?s the understatement of the year. Yes GDB might be great for its primary language it was designed for C and C++, but it sure sucks for Object Pascal. So much so that I?m seriously considering moving all my work to another language where debugging is magnitudes better than what we experience now.

I also welcome anybody to try and contribute to the multiple efforts of implementing a native Object Pascal debugger.

fpDebug:
My own fork of Duby.
https://github.com/graemeg/fpdebug

Duby:
https://sourceforge.net/projects/duby/

fpDebug - same name, but totally different code
Located in the ?debugger? directory of Lazarus.
http://lazarus-dev.blogspot.co.uk/2014/05/de-bug-wars-new-hope.html

In the mean time, here is a collection of tips of GDB usage with Lazarus. http://wiki.freepascal.org/GDB_Debugger_Tips

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Tony Whyman
to Dennis: I am using Lazarus 1.7 (2016-04-20) with FPC 3.1.1 Great Work guys! However, the gdb that…

Are you using Windows or Linux (or OSX)?

In my experience, GDB runs better under Linux than Windows. Under Windows anti-virus software will often get in the way as well as it being generally slower.

I take Graeme's point about GDN not being that great for Pascal, but it does work most of the time and adding a few well placed "writeln" statements often makes up for any deficiencies (again much easier under Linux due to the difficulty of getting a working console under Windows). At least with Pascal you don't seem to get the regular C++ GDB problem of "variable optimised out" just when need to get its value.

Tony Whyman

Dennis wrote 27 lines
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. I am hoping people can share this kind of tips. Anyone? Dennis -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

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

Reply by email

Graeme Geldenhuys
to Tony Whyman
Tony Whyman wrote
Are you using Windows or Linux (or OSX)?

or FreeBSD or Solaris or AIX or RaspberryPi or GameBoy or OS/2 or DOS or Android or WinCE or Arm Embedded or Haiku or ReactOS or .... ;-)

Windows anti-virus software will often get in the way as well as it being generally slower.

Why are you running anti-virus software on a development machine in the first place? That?s been a known fact in all companies I?ve worked for - don?t do it. Thinking about it, I haven?t run any anti-virus software for over 10 years.

I take Graeme's point about GDB not being that great for Pascal, but it does work most of the time and adding a few well placed "writeln"

And that shows exactly the sad state that we as Free Pascal developers live in. We have to resort to writeln() statements, temporary debug variables and use 3rd party logging software. And we have done it for so long, we believe that to be the norm!! Hell, even Haiku, which is a small niche OS has a fantastic debugger that puts anything GDB+Pascal to shame. Use YouTube and search for some debugging tutorials using QtCreator, Intellij IDEA or Eclipse. Hell, even Delphi can be added to that list. They all show how debuggers could and should work. None of the show using writeln() statements.

Make no mistake, it?s not Lazarus or MSEide that is to blame. They both try and use GDB (with tons of work-arounds and hacks) to get something usable. Bottom line is, Pascal is a distant thought in the minds of GDB developers - that is not likely to change any time soon.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys
Graeme Geldenhuys wrote
Use YouTube and search for some debugging tutorials using QtCreator, Intellij IDEA or Eclipse. Hell, even Delphi can be added to that list. They all show how debuggers could and should work. None of the show using writeln() statements.

Even closer to home, have you ever seen how great Firefox and Chrome's debugging abilities are? They have all the usual thing you would expect like breakpoins, stepping code, inspecting variables plus tons more advanced features like slowing down animations and testing timing values etc. In my previous job I worked with many fantastic web developers. They showed me web debugging features that made my jaw drop.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Sven Barth
to Tony Whyman: Are you using Windows or Linux (or OSX)? In my experience, GDB runs better under Linux…
"Tony Whyman" wrote
I take Graeme's point about GDN not being that great for Pascal, but it

does work most of the time and adding a few well placed "writeln" statements often makes up for any deficiencies (again much easier under Linux due to the difficulty of getting a working console under Windows). At least with Pascal you don't seem to get the regular C++ GDB problem of "variable optimised out" just when need to get its value.

Huh? Debugging with a console on Windows is less of a headache than on Unix systems. On Windows one just needs to make sure that the apptype is console and Windows will provide the console for your application to mess around in (even for GUI applications). On Linux we now have the Terminal Output window, but that only works if you don't want anything fancy (think the textmode IDE) otherwise you need to resort to a start application, on older Mac OS X systems even the terminal output window isn't available...

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160526/22d0c800/attachment.html>

Reply by email

leledumbo
to Graeme Geldenhuys: or FreeBSD or Solaris or AIX or RaspberryPi or GameBoy or OS/2 or DOS or Android or WinCE…
Why are you running anti-virus software on a development machine in the first place? That?s been a known fact in all companies I?ve worked for - don?t do it. Thinking about it, I haven?t run any anti-virus software for over 10 years.

If you have a paranoid managers, you can't do anything about it, unless you're on the same or higher title :)

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-GDB-is-not-good-any-tricks-to-improve-it-tp4048659p4048669.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

Martin Frb
to Dennis: I am using Lazarus 1.7 (2016-04-20) with FPC 3.1.1 Great Work guys! However, the gdb that…
Dennis wrote 13 lines
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.

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

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

properties
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.freepascal.org/pipermail/lazarus/attachments/20160526/a67471c6/attachment.html>

Reply by email