Recent

Author Topic: Suggested gdb version for Lazarus 2.0.6 Linux (Arch - Manjaro)?  (Read 2014 times)

Hoch

  • New Member
  • *
  • Posts: 35
Suggested gdb version for Lazarus 2.0.6 Linux (Arch - Manjaro)?
« on: December 19, 2019, 07:20:51 pm »
Hi,

I'm a Lazarus (windows) user since 2010.

I'm trying to migrate to Lazarus 2.0.6 for Linux (Manjaro LXQt).

Alongside Lazarus I installed gdb v8.3.1. This is the version offered by the app installer (pacman).

When I try to debug, gdb hangs. I'm unable to stop the execution and I have to restart the debugger.

I have tried all sort of parameters for the project.

I suspect that the problem could be an incompatible gdb version?...

Is this version of gdb compatible with Lazarus 2.0.6? If not, what is the recommended stable version of gdb for Lazarus 2.0.6 in Arch Linux?

Thank you in advance!  :)


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9908
  • Debugger - SynEdit - and more
    • wiki
Re: Suggested gdb version for Lazarus 2.0.6 Linux (Arch - Manjaro)?
« Reply #1 on: December 19, 2019, 07:26:53 pm »
I tested gdb 8.3 on Win and it works, but gives a warning on startup. gdb 8.3 prints a new message about the "dwarf cache", the IDE does not know it, therefore the IDE gives a warning.

Anyway, the best way to find out what the problem is, is to produce a log:
https://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session

Also, you may want to play with the project options -> debugging -> debug info type: set it to "dwarf 2 with sets".
Depending on platform the "default" debug info, may be stabs or dwarf. (both should work, but dwarf is usually safer)

Hoch

  • New Member
  • *
  • Posts: 35
Re: Suggested gdb version for Lazarus 2.0.6 Linux (Arch - Manjaro)?
« Reply #2 on: December 20, 2019, 01:21:16 pm »
Hi @Martin_fr,

Thank you for your fast answer.

I append the general debugger preferences (in spanish). As you suggested, the debugger info in the project options is set to "dwarf 2 with sets". This is the only parameter I changed for the default project options.

The code is a minimal program, this one:

program Project1;
var
  foo: integer;
begin
  foo := 2;
end.


I have a break point in the first (and only) line.

I executed Lazarus from the terminal with these parameters:

lazarus --debug-log=/home/jochi/gdb.log --debug-enable=DBG_CMD_ECHO,DBG_STATE,DBG_DATA_MONITORS,DBGMI_QUEUE_DEBUG,DBGMI_TYPE_INFO,DBG_ERRORS

I only executed the program once. The break point is not reached (highlighted) and I can't stop the execution.

After a few seconds I get a debugger error, this one (Translate from spanish):

The GDB command:
"-break-insert -f foo"
did not return any results.
The GDB process has stopped working.


I press the stop button and I quit Lazarus.

I append the debug log. I have no clue of what I have to look for...

Thank you in advance! :)
« Last Edit: December 20, 2019, 01:23:02 pm by Hoch »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9908
  • Debugger - SynEdit - and more
    • wiki
Re: Suggested gdb version for Lazarus 2.0.6 Linux (Arch - Manjaro)?
« Reply #3 on: December 20, 2019, 01:44:12 pm »
ok, I had a look. This is a new problem. It appears your gdb crashes (you could check, at the time of that message, a "ps ax" should no longer show the gdb process).

I can see which command (as in "command send from the IDE to gdb") caused the crash.
The problem is that it is impossible to tell, if (and which) other commands would crash this gdb.

You can set the IDE to skip this one particular command.
Tools > Options
then Debugger > General
On that page is a property grid, and in it is an entry "DisableForcedBreakpoint". Set this to True.

Given the above problem, you may also have to play with "InternalStartBreak". Values to test are gdbsMain, gdbsEntry or gdbsMainAddr.


And maybe "disableLoadSymbolsForLibraries" => True  (that is ok, as long as you do not write your own libraries)

----
In the Project Options > Debugging
please also check (if yours are not English, look for the param at the end, e.g. "-Xs"
"Use external debug symbol file (-Xg)" => False/Off
"Strip symbols from executable (-Xs)" => False/Off

And in Project Options > "Compilation and Linking"
"Link Smart (-XX)"  => False/Off

See here https://wiki.lazarus.freepascal.org/Debugger_Setup#Project_Options
(the picture is from an older Lazarus)

--------
If none of this helps, you will need a different gdb.
The IDE should work with any gdb since gdb 7.0 (sometimes even older ones).

However your gdb crashes, that is probably not so much a problem with that version (unless gdb 8.3.1 indeed has a regression), that may be a problem with the build (i.e., the libraries it was linked against, the compiler version used to build it, no idea)

--------
An alternative might be to install (menu packages > install packages) the package "LazDebuggerFp", which is part of the Lazarus installer (so no download needed).
You can then go to Tools > Options, and
- choose "fp debug (internal dwarf debugger)"
- the path to gdb, can be left empty

This is a new debugger, that does not need gdb. The version in 2.0.6 is still very basic, and has several glitches. But for basic breakpoint, stepping and watches it might just work for you.


« Last Edit: December 20, 2019, 01:59:05 pm by Martin_fr »

Hoch

  • New Member
  • *
  • Posts: 35
Re: Suggested gdb version for Lazarus 2.0.6 Linux (Arch - Manjaro)?
« Reply #4 on: December 22, 2019, 06:54:46 pm »
Hi @Martin_fr,

Thanks again for the quick and detailed answer.

DisableForcedBreakpoint set to true, did the trick!

Dbg and Lazarus on Manjaro, fly, in a humble celeron Laptop! Very impressive indeed.

I could not try the fp debugger. It seems that it depends on LLDB.

And when I try to install LLDB it forces the uninstall of Gdb.

Is there any advantage of LLDB over Gdb, in Linux?

Thanks again.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9908
  • Debugger - SynEdit - and more
    • wiki
Re: Suggested gdb version for Lazarus 2.0.6 Linux (Arch - Manjaro)?
« Reply #5 on: December 22, 2019, 08:07:31 pm »
There is no point in using LLDB. Except on Apple Mac.
As far as I tested, lldb is not stable on most none Apple platforms, so using it is a step back.

LLDB was added, because Apple stopped shipping GDB. And build your own is rather a complex undertaking on Mac.


I could not try the fp debugger. It seems that it depends on LLDB.
I believe you got the wrong package.

There is LazDebuggerFpLldb which needs LLDB. (And so does LazDebuggerLldb (without the "FP"))

There also is LazDebuggerFp (no lldb in the name).
It is not in the list by default, it needs to be installed via Packages > Install Packages.
If it does not show in the "install packages" list (it should be there), you may have to open the package via the package menu. The package is in components/lazdebuggers/

However if your GDB runs now, you can stay with this.
When Lazarus 2.2 comes out, the FpDebug package will have lots of bugs fixed (currently in svn trunk). Then it will be each users choice (at least on Win/Linux) if they use gdb, or fpdebug.

https://wiki.lazarus.freepascal.org/Debugger_Status#Available_Debuggers



 

TinyPortal © 2005-2018