Forum > Debugger
Moving away from GDB
MarkMLl:
For the last 15 years or so, I have habitually compiled both FPC and Lazarus from source on various platforms rather than using prebuilt packages.
On Debian Linux "Bookworm" x86_64, Lazarus 2.2.4 is clearly struggling with GDB: the debugger regularly crashes particularly if hovering over any variable other than a simple scalar.
With reference to https://wiki.freepascal.org/Debugger_Setup#Setting_up_the_debugger_backend_for_the_IDE , Tools -> Options -> Debugger Backend only shows "GNU Debugger (gdb)" in the drop-down at the top of the window. I can see that the "LazDebuggerFP 1.0" package is installed.
What do I do to enable the new-style debugger?
MarkMLl
p.s. I would far prefer, this time round, to not be told that I'm the one at fault for running an experimental OS or that a mere user should not be attempting to build the IDE from source.
Martin_fr:
GDB works best with "DWARF 2 with sets" ... but even then. DWARF 3 is a gdb killer. (And that includes mixed compiles, e.g. fpc/rtl has dwarf 3 and your project has dwarf 2.
As for setting up:
https://wiki.lazarus.freepascal.org/Debugger_Setup
A new install should already have FpDebug in the list. If you upgrade to 3.0 then you should be asked at startup.
Also running
lazarus --setup
brings up the start dialog, that has options to change the settings.
Otherwise:
- Button "Add"
- Select "FpDebug" as type
- press ok
---
You can also set a debugger per project in the project options....
MarkMLl:
Thanks Martin, I'll give that some thought. However initially:
--- Quote from: Martin_fr on August 31, 2023, 11:00:50 am ---GDB works best with "DWARF 2 with sets" ... but even then. DWARF 3 is a gdb killer. (And that includes mixed compiles, e.g. fpc/rtl has dwarf 3 and your project has dwarf 2.
--- End quote ---
The IDE appears to be using automatic selection of debug type, which I suspect is inherited from when the configuration file was first set up (which is quite possibly several versions ago). FPC (i.e. RTL etc.) was compiled with -O- -gl -Xs- -vt The file command confirms that binaries are unstripped, but doesn't say much else.
Since this could possibly help others, how can I inspect a binary and determine what DWARF variant is in use?
Project options only give GDB as an option. I've not explored your other suggestions yet since I think it's important to first determine DWARF properties.
MarkMLl
Martin_fr:
"automatic" is decided by FPC. Afaik it's preset for each target. (so it does not depend what was used to build the compiler/rtl).
Afaik, on all major platforms it is some version of DWARF (i.e. stabs, is no longer used on major platforms).
objdump should probably give you insight (I would have to check what the quickest way is). "objdump --dwarf=info" => very very long output. Mixed within a header for each unit, that should have a version.
But to know if you use DWARF 3 or higher: Are your local vars shown all uppercase?
"All upper" = DWARF 2
"mixed case" = DWARF 3 or higher.
So of course you can still have some units that and other units this... But then you need to run the long objdump.
fpc also introduced
-godwarfcpp
https://www.freepascal.org/docs-html/user/userap1.html
But I have not tested it much.
rvk:
--- Quote from: MarkMLl on August 31, 2023, 12:07:37 pm ---Since this could possibly help others, how can I inspect a binary and determine what DWARF variant is in use?
--- End quote ---
Would this work?
readelf --debug-dump=info binary_name | head | grep -A 2 'Compilation Unit @'
And this for all included units?
readelf --debug-dump=info mytest | grep -A 2 'Compilation Unit @'
Navigation
[0] Message Index
[#] Next page