Recent

Author Topic: Feedback about GDB on Windows  (Read 1123 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5699
    • wiki
Feedback about GDB on Windows
« on: October 13, 2019, 05:59:44 pm »
To all who
- use Lazarus on Windows (any version of Lazarus 2.0 or 2.1)
- use or have tried GDB 8.2 (for 64bit users also GDB 7.7 or 8.1) from
https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2032%20bits/Alternative%20GDB/
https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Alternative%20GDB/

This question is aimed at "Dwarf 2 with sets" setting.

Dwarf 3 experiences can be reported, but are expected to be worse. (There are plenty of types/structures that GDB (in any version) can not display when using dwarf 3)

32bit users, please ensure you switch to Dwarf.
Testing with Stabs (fpc -g or -gs  / the default for 32 bit) is pointless.


What is your experience with GDB 8.2 (7.7/8.1)?
Compared to the default GDB (32bit: 7.7.1 / 64bit: 7.3.50)
Any improvements you noticed?
Any degradations you noticed?

- Your Lazarus and FPC version/revision.
- Your OS (with version and 32 or 64 bit)
- Your IDE is 32 or 64 bit
- Your FPC is 32 or 64 bit
- Your target app is 32 or 64 bit (and indicate if it was cross compiled, by an FPC with different bitness)

Thank you
« Last Edit: October 13, 2019, 06:03:41 pm by Martin_fr »

nanobit

  • New Member
  • *
  • Posts: 43
Re: Feedback about GDB on Windows
« Reply #1 on: October 14, 2019, 12:28:38 am »
Laz win32: my baseline mostly is fpc3.2, dwarf3 and gdb8.2 (with fpdebug).
Stability and speed are good.
Stepping with gdb8.2 is definitely faster than gdb7.7.1.

I go back to gdb7.7.1 only in special case:
if source code has interface variables, which is known:
https://bugs.freepascal.org/view.php?id=35129

About dwarf2 vs. dwarf3:
Regardless of gdb version, dwarf2 is needed sometimes for watching
( oldstyle object), but I'm not aware of unreported dwarf3 issues.

And dwarf2 is needed for regular Laz2.0.4, because it has not the
fix for dwarf3 issue 0035405 ( here I found another (unreported) effect:
The exception classname can be faulty. If the exception is registered
in the ignorelist, it won't be found there, thus not ignored.)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5699
    • wiki
Re: Feedback about GDB on Windows
« Reply #2 on: October 15, 2019, 01:46:14 am »
but I'm not aware of unreported dwarf3 issues.
Just added some: https://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Bugs_in_GDB (last 3 in the list)

---- EDIT:
Regardless of gdb version, dwarf2 is needed sometimes for watching
( oldstyle object), but I'm not aware of unreported dwarf3 issues.
That is fixed in fpc trunk: https://bugs.freepascal.org/view.php?id=36017
« Last Edit: October 15, 2019, 05:41:22 pm by Martin_fr »

BrunoK

  • Full Member
  • ***
  • Posts: 190
  • Retired programmer
Re: Feedback about GDB on Windows
« Reply #3 on: October 15, 2019, 02:47:39 pm »
Find that lazarus (+/-) trunk, FPC 3.0.4 (the mac one with some downport from trunk) and GDB 8.2 do work really well. Haven't found any particular problems.

Default debugging optimization/compilation settings I use for lazarus / FPC :
-O1 -OoREGVAR -gw2 -godwarfsets -gl


Lazarus trunk r. 62137/27.10.2019 (+/- patches regarding TScrollBar, IntitalSetupDialog, Options.Environment options, SearchResults).  Lazarus 3.0.6 raw from svn.
FPC 3.0.4 32 bits. (+heaptrc with leaked ClassName+Revisited TList) , Windows 10 Pro x64 (v. 1903 / 18362.418)

BrunoK

  • Full Member
  • ***
  • Posts: 190
  • Retired programmer
Re: Feedback about GDB on Windows
« Reply #4 on: October 15, 2019, 02:49:58 pm »
Meant mostly 32 bit w10 programs, and occasionally also 64 bit W10.
Lazarus trunk r. 62137/27.10.2019 (+/- patches regarding TScrollBar, IntitalSetupDialog, Options.Environment options, SearchResults).  Lazarus 3.0.6 raw from svn.
FPC 3.0.4 32 bits. (+heaptrc with leaked ClassName+Revisited TList) , Windows 10 Pro x64 (v. 1903 / 18362.418)

Akira1364

  • Hero Member
  • *****
  • Posts: 539
Re: Feedback about GDB on Windows
« Reply #5 on: October 15, 2019, 04:32:06 pm »
I've found the overall debugging experience has definitely been steadily improving on Windows over the past little while. I'm using native-64-bit trunk FPC / Lazarus on 64-bit Windows 10, with the GDB from here:

https://nuwen.net/mingw.html

And it works nearly flawlessly in "FPDebug enhanced" mode, with both Dwarf 2 and Dwarf 3.

Really my only "complaint" at this point is that the visual aspect of debugging in the IDE itself could probably be better... for example, the use of a grid control for displaying variables is perhaps not the best approach, because it means that stuff like arrays get crammed onto one line and become somewhat difficult to read.
« Last Edit: October 15, 2019, 04:42:55 pm by Akira1364 »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5699
    • wiki
Re: Feedback about GDB on Windows
« Reply #6 on: October 15, 2019, 05:14:05 pm »
Find that lazarus (+/-) trunk, FPC 3.0.4 (the mac one with some downport from trunk) and GDB 8.2 do work really well. Haven't found any particular problems.
While off topic, if you are an Mac, you might want to compare your experience to using LLDB (important the one WITH fpdebug)
https://forum.lazarus.freepascal.org/index.php/topic,42869.0.html

Quote
Default debugging optimization/compilation settings I use for lazarus / FPC :
-O1 -OoREGVAR -gw2 -godwarfsets -gl

While those settings are fine, they can have side effects.

OoREGVAR:
Fpc does not write debug info for values held in registers (it will instead claim the value in the mem location that is reserved but potentially not updated).
Therefore local vars may sometimes show outdated values.

O1:
A similar effect, but only in very rare occasions can be caused by -O1 (instead of -O- ). Though I have not seen it happen in a long time.