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

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

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

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


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Graeme Geldenhuys-3
On 2016-05-26 06:31, 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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Tony Whyman
In reply to this post by Dennis
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

On 26/05/16 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.

I am hoping people can share this kind of tips.

Anyone?

Dennis



--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Graeme Geldenhuys-3
On 2016-05-26 09:40, 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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Graeme Geldenhuys-3
On 2016-05-26 10:05, 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

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Sven Barth
In reply to this post by Tony Whyman

Am 26.05.2016 10:41 schrieb "Tony Whyman" <[hidden email]>:
> 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


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Tony Whyman
In reply to this post by Graeme Geldenhuys-3
Neither do I. Just making the point in case that was where the problem lay.

On 26/05/16 10:05, Graeme Geldenhuys wrote:
> 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.


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

leledumbo
Administrator
In reply to this post by Graeme Geldenhuys-3
> 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 :)
Reply | Threaded
Open this post in threaded view
|

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

Graeme Geldenhuys-3
On 2016-05-26 16:17, leledumbo wrote:
> or higher title

Luckily I fall under that title. ;-)

Regards,
  Graeme


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Martin Frb
In reply to this post by Dennis
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.

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"




--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus