Recent

Author Topic: LLDB debugger (with fpdebug) (Beta) Debugger Problems  (Read 851 times)

Jon Trepte

  • New Member
  • *
  • Posts: 14
LLDB debugger (with fpdebug) (Beta) Debugger Problems
« on: November 18, 2022, 06:14:07 am »
Using Lazarus 2.2.4 on Ventura 13.0.1 with Xcode 14.1 I find when I run a program I get the debugger error shown in the screenshot. The second attachment shows the settings.
If I 'run without debugging ' the program runs normally.
New to Lazarus but have been using Delphi for decades. Strangely the same system on another Mac runs perfectly. Any Ideas?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8926
  • Debugger - SynEdit - and more
    • wiki
Re: LLDB debugger (with fpdebug) (Beta) Debugger Problems
« Reply #1 on: November 18, 2022, 02:36:26 pm »
Can you please
- start the IDE
- open your project
- open from the menu: View > Ide Internals > Debug output
- And then Run/F9 in the debugger

After that copy the content of the "debug output" window, and post it here.



I assume you have used the official installers, and therefore have FPC 3.2.2 ?

Also please check in your "Project options"
- Optimization should be off or -O1
- "type of debug info" should be "dwarf 2 (-gw)" or "dwarf 2 with sets". => That is, it should not be dwarf-3

Dwarf 3 may actually work too, but for testing lets go with the above.


Jon Trepte

  • New Member
  • *
  • Posts: 14
Re: LLDB debugger (with fpdebug) (Beta) Debugger Problems
« Reply #2 on: November 19, 2022, 07:14:39 am »
Many thanks Martin. Attached is the log. All settings are as you stated with no breakpoints set. Program is a very simple form with 1 button and a OnClick handler that changes the Caption.
Jon

Jon Trepte

  • New Member
  • *
  • Posts: 14
Re: LLDB debugger (with fpdebug) (Beta) Debugger Problems
« Reply #3 on: November 19, 2022, 08:23:02 am »
Hi Martin,
 I'm wondering that it might have something to do with the mac and how it's configured. It is a MacBook Pro 15 Mid 2015 running Ventura with is not technically supported. I used OpenCore to install the OS. Could there be a problem with the graphics system? The log show that the failure occurred after the process was launched.

Process 56795 launched: '/Users/alisontrepte/Documents/project1.app/Contents/MacOS/project1' (x86_64)\

warning: (x86_64) /System/Library/Extensions/AppleIntelHD5000GraphicsMTLDriver.bundle/Contents/MacOS/AppleIntelHD5000GraphicsMTLDriver load command 2 LC_SEGMENT_64 has a fileoff (0x30870000) that extends beyond the end of the file (0x14ee70), ignoring this section\

So maybe there is nothing wrong with Lazarus after all.

Let me know your thoughts and if you agree.
Many thanks for pointing me in the right direction.
Jon

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8926
  • Debugger - SynEdit - and more
    • wiki
Re: LLDB debugger (with fpdebug) (Beta) Debugger Problems
« Reply #4 on: November 19, 2022, 02:05:01 pm »
It does look like that file has bad debug info. Or maybe the debug info that is found/installed belongs to a different version of that file. In any case this will stop lldb from loading debug info, and stop it from working.

I found
https://opensource.apple.com/source/lldb/lldb-310.2.36/www/symbolication.html

If you open the file
  components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas
around line 685, you should find the "target create" command.

Code: Pascal  [Select][+][-]
  1.   inherited Create('target create '+AFile);

You can try to add the --no-dependents  like this (keep the space before the closing quote)
Code: Pascal  [Select][+][-]
  1.   inherited Create('target create --no-dependents  '+AFile);

You then need to rebuild the IDE (menu Tools > Build Lazarus ...)

Let me know if that helps.

Jon Trepte

  • New Member
  • *
  • Posts: 14
Re: LLDB debugger (with fpdebug) (Beta) Debugger Problems
« Reply #5 on: November 20, 2022, 04:44:55 am »
Hi Martin
Unfortunately that did not solve the problem.
Here is part of the Debug output
>> target create --no-dependents /Users/alisontrepte/Documents/project1.app
(lldb) target create --no-dependents /Users/alisontrepte/Documents/project1.app
You can see the modification was completed but I still get the error message.
Not sure what to do next but I can run without the debugger so all is not lost.
Many thanks
Jon

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8926
  • Debugger - SynEdit - and more
    • wiki
Re: LLDB debugger (with fpdebug) (Beta) Debugger Problems
« Reply #6 on: November 20, 2022, 01:14:10 pm »
If the error is still in the same file, maybe you can "strip" it.

I have no idea if that is possible on Mac for a (system?) library.
I don't know if the "strip" utility will do that (strip, at least on other systems, can be used to remove debug info from executables).
Then again, you need that library to function, so touching it may be dangerous, unless you are sure you only touch debug info (which may or may not be stored separately).

I don't usually work on Mac myself. So I don't have specifics....

my_only_lonely

  • Newbie
  • Posts: 1
Re: LLDB debugger (with fpdebug) (Beta) Debugger Problems
« Reply #7 on: May 25, 2023, 05:31:07 pm »
Hi Martin,
 I'm wondering that it might have something to do with the mac and how it's configured. It is a MacBook Pro 15 Mid 2015 running Ventura with is not technically supported. I used OpenCore to install the OS. Could there be a problem with the graphics system? The log show that the failure occurred after the process was launched.

Process 56795 launched: '/Users/alisontrepte/Documents/project1.app/Contents/MacOS/project1' (x86_64)\

warning: (x86_64) /System/Library/Extensions/AppleIntelHD5000GraphicsMTLDriver.bundle/Contents/MacOS/AppleIntelHD5000GraphicsMTLDriver load command 2 LC_SEGMENT_64 has a fileoff (0x30870000) that extends beyond the end of the file (0x14ee70), ignoring this section\

So maybe there is nothing wrong with Lazarus after all.

Let me know your thoughts and if you agree.
Many thanks for pointing me in the right direction.
Jon

It is related to the OLCP. https://github.com/dortania/OpenCore-Legacy-Patcher/discussions/1046
If you want to debug on that system with OLCP, you can try gdb. It is fully functional. https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/macos-install-gdb-in-2023-for-use-with-lazarus-pascal/

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8926
  • Debugger - SynEdit - and more
    • wiki
Re: LLDB debugger (with fpdebug) (Beta) Debugger Problems
« Reply #8 on: May 25, 2023, 06:02:32 pm »
It is related to the OLCP. https://github.com/dortania/OpenCore-Legacy-Patcher/discussions/1046
If you want to debug on that system with OLCP, you can try gdb. It is fully functional. https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/macos-install-gdb-in-2023-for-use-with-lazarus-pascal/

If you have a working gdb (probably you need to code sign it / unless you get the apple gdb from very old apple tools) then Lazarus should support it.

In Lazarus "Preferences" (Options), the page "Debugger" > "Debugger Backend" there is  (or you can create with the "add" button) a "GNU Debugger (gdb)". Which you can then setup with the path to your gdb.

If you have that working gdb, then depending on what causes the problem, you can even try and install the package "LazDebuggerFpGdbmi" => this is a mix of gdb and FpDebug. If FpDebug itself is not affected by the issue, then that may be a good option. It may give better results for some "watches" (values of variables in you app)

 

TinyPortal © 2005-2018