Discussion:
[Lazarus] New debugger for Mac based on lldb (Call for testers)
Martin Frb via Lazarus
2018-10-14 19:09:14 UTC
Permalink
With the Lazarus Release Candidate 1 for 2.0 a new debugger for Mac
users has been shipped.
It is based on LLDB, which is provided by apple and is ready to use. So
there should no longer be a need to build and codesign gdb.

As the LLDB integration is all new, it needs a lot of testing. So this
is a ...

      call to all Mac users:
      Please test the new LLDB based Lazarus debugger.

To test the new debugger, please download the Lazarus 2.0RC1.

- Open the IDE and install the package "LazDebuggerFpLLdb".
  It should be in the list of available packages, but if not it is in
components/lazdebuggers/lazdebuggerfplldb
  Make sure to use the one with "Fp" in the name. (There also is
LazDebuggerLLdb, but it is not as good.)
  Restart the IDE.

- Go to Tools > Options > Debugger
  In the "debugger type" dropdown, you should find and select "LLDB
debugger (with fpdebug)"
  The edit below this (where you normally have the path to gdb), should
be changed to the path of lldb.
  (lldb comes with the tools from apple; and as such it is already
codesigned by apple).


To report any problems:
Start Lazarus from a shell with the following command line (replace
pathes according to your installation):

You may need to use startlazarus, or specify the re-build lazarus which
may be in your home folder / pcp.

/path/to/lazarus/lazarus.app/Contents/MacOS/lazarus
--debug-log=/path/to/yourfiles/laz.log
--debug-enable=DBG_CMD_ECHO,DBG_STATE,DBG_DATA_MONITORS,DBGMI_QUEUE_DEBUG,FPDBG_DWARF_ERRORS,FPDBG_DWARF_WARNINGS,FPDBG_DWARF_VERBOSE_LOAD,FPDBG_DWARF_DATA_WARNINGS,DBG_VERBOSE,DBG_WARNINGS,DBG_STATE,DBG_EVENTS,DBG_THREAD_AND_FRAME

Attach the log file after reproducing the error.

--
C Western via Lazarus
2018-10-16 21:23:33 UTC
Permalink
Post by Martin Frb via Lazarus
- Go to Tools > Options > Debugger
  In the "debugger type" dropdown, you should find and select "LLDB
debugger (with fpdebug)"
  The edit below this (where you normally have the path to gdb),
should be changed to the path of lldb.
  (lldb comes with the tools from apple; and as such it is already
codesigned by apple).
Did you mean the option "(with fpdebug)"? Trying with this option
lazarus throws an exception trying to open a .o file that exists - I
can't immediately see why it is throwing the exception. It doesn't seem
to reach the stage of starting the program. If I try it without, the
debugger seems to be working OK, at least at first glance.

Colin

--
Martin Frb via Lazarus
2018-10-16 21:39:31 UTC
Permalink
Post by C Western via Lazarus
Post by Martin Frb via Lazarus
- Go to Tools > Options > Debugger
  In the "debugger type" dropdown, you should find and select "LLDB
debugger (with fpdebug)"
  The edit below this (where you normally have the path to gdb),
should be changed to the path of lldb.
  (lldb comes with the tools from apple; and as such it is already
codesigned by apple).
Did you mean the option "(with fpdebug)"? Trying with this option
lazarus throws an exception trying to open a .o file that exists - I
can't immediately see why it is throwing the exception. It doesn't
seem to reach the stage of starting the program. If I try it without,
the debugger seems to be working OK, at least at first glance.
Depending on which of the LazDebugger...LLDB package(s) you installed,
you should have one or two entries:
  "LLDB Debugger (Alpha)"
  "LLDB Debugger (with fpdebug) (Alpha)"

The 2nd one should be the better one.
The first (without fpdebug), will accept/display watches in C style
only, and has had way less testing.

If you get an error, please provide the stacktrace (if you have),
together with console output, and logfile.

Please also test with and without "external debug info".
When using (or having used) external dbg info, ensure that the folder
with the debug info is not left behind/outdated (IIRC a folder with psym
in the name)

I tested this on a Mac, that I had on loan. Currently I do not have a
Mac for testing.

---
What you mean by "without, the debugger"
Without any debugger, or with the lldb without fpdebug?

--
C Western via Lazarus
2018-10-17 07:40:09 UTC
Permalink
Post by Martin Frb via Lazarus
Post by C Western via Lazarus
Post by Martin Frb via Lazarus
- Go to Tools > Options > Debugger
  In the "debugger type" dropdown, you should find and select "LLDB
debugger (with fpdebug)"
  The edit below this (where you normally have the path to gdb),
should be changed to the path of lldb.
  (lldb comes with the tools from apple; and as such it is already
codesigned by apple).
Did you mean the option "(with fpdebug)"? Trying with this option
lazarus throws an exception trying to open a .o file that exists - I
can't immediately see why it is throwing the exception. It doesn't
seem to reach the stage of starting the program. If I try it without,
the debugger seems to be working OK, at least at first glance.
Depending on which of the LazDebugger...LLDB package(s) you installed,
  "LLDB Debugger (Alpha)"
  "LLDB Debugger (with fpdebug) (Alpha)"
The 2nd one should be the better one.
The first (without fpdebug), will accept/display watches in C style
only, and has had way less testing.
If you get an error, please provide the stacktrace (if you have),
together with console output, and logfile.
Please also test with and without "external debug info".
When using (or having used) external dbg info, ensure that the folder
with the debug info is not left behind/outdated (IIRC a folder with
psym in the name)
I tested this on a Mac, that I had on loan. Currently I do not have a
Mac for testing.
---
What you mean by "without, the debugger"
Without any debugger, or with the lldb without fpdebug?
Using "LLDB Debugger (Alpha)" seems to give me working debugging.

This was with current trunk fpc and lazarus.

This was not with "external debug info". I will post some output when I
have a chance.

Colin

--
C Western via Lazarus
2018-10-17 21:04:52 UTC
Permalink
I have identified the issue. It seems that fpdebug opens all the object
files associated with the project, and keeps them open. For the project
I was working on this results in 700 or so open files in lazarus, and it
seems the default system limit is 256. Awkwardly it is not clear how to
change this; putting (say) "ulimit -n 6000" in .profile changes it in
the terminal window, and the debugger then runs OK if lazarus is started
from the terminal window, but if startlazarus is used the limit for
lazarus stays at 256.

Colin

--

Loading...