Recent

Author Topic: Debbuging in macOS Sierra -using lldb  (Read 10267 times)

dracon

  • New Member
  • *
  • Posts: 18
Debbuging in macOS Sierra -using lldb
« on: May 27, 2017, 09:52:43 am »
Hello to all.

I have downloaded Lazarus 1.8RC1. It works normally with HiDPI macbook. Never the less I have got a problem with the debugging operation. At this point I must say that I use lldb instead of gdb since the latter has problems in the latest macos.

Whenever I try to run a program I get the message:

Code: Pascal  [Select][+][-]
  1. Initialization output:
  2. error: file specified in --source(-s) does not exist: 'ilent'
  3.  

and when I press OK, I get the following message:

Code: Pascal  [Select][+][-]
  1. Debugger error
  2.  
  3. Ooops, the debugger entered the error state
  4. Save your work now !
  5.  
  6. Hit Stop, and send a command to GDB
  7.  
  8. The GDB process is no longer running.
  9.  

 
Any ideas?

Thanks in advance.

mischi

  • Full Member
  • ***
  • Posts: 170
Re: Debbuging in macOS Sierra -using lldb
« Reply #1 on: May 27, 2017, 01:06:29 pm »
Which versions of macOS and Xcode?

dracon

  • New Member
  • *
  • Posts: 18
Re: Debbuging in macOS Sierra -using lldb
« Reply #2 on: May 27, 2017, 01:29:35 pm »
macos Sierra: 10.12.5
Xcode: 8.3.2

mischi

  • Full Member
  • ***
  • Posts: 170
Re: Debbuging in macOS Sierra -using lldb
« Reply #3 on: May 27, 2017, 07:17:03 pm »
Same as here. Apple moved from GDB to lldb, which is not supported by lazarus. In the past, one could install GDB (home, fink, macports, ...), but the latest update to 10.12 has increased some security measures and gdb cannot be used any longer. I tried all kinds of hints, but none worked. I could only start lldb in the command line and debug from there. Very clumsy.

dracon

  • New Member
  • *
  • Posts: 18
Re: Debbuging in macOS Sierra -using lldb
« Reply #4 on: May 27, 2017, 07:58:05 pm »
I thought that I could use lldb as a standalone debugger. Anyway...

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Debbuging in macOS Sierra -using lldb
« Reply #5 on: May 28, 2017, 02:10:13 am »
I thought that I could use lldb as a standalone debugger. Anyway...

Note that you CAN debug a Lazarus project in Xcode. You just have to create a dummy Xcode project for your Lazarus project source files.

See the attached screenshot. A breakpoint was set in Xcode in line 29 and when I clicked the button, execution hit the breakpoint and Xcode started debugging. Note how the call sequence to that point is displayed at the left side of the window. And the debug area shows messages at the bottom.

Creating an Xcode project for your Lazarus app also fixes deficiencies and clumsy workarounds in the generic (for Mac) Lazarus IDE, such as easier editing of Info.plist, automatic codesigning, setting entitlements...

I looked at developing a little add-in tool for Lazarus that would create an Xcode project automatically, but I don't think there are enough Laz users on Mac to warrant the investment of time.


mischi

  • Full Member
  • ***
  • Posts: 170
Re: Debbuging in macOS Sierra -using lldb
« Reply #6 on: May 28, 2017, 12:50:03 pm »
Hi Phil.

Do you have time for a step by step description for this in the lazarus wiki? I think that this would really helpful, if not for many, at least for me 😉

Or can you give me a bit of guidance through this? I did not find it obvious, which selections to do in Xcode to achieve this.

MiSchi.

nsl

  • New Member
  • *
  • Posts: 16
Re: Debbuging in macOS Sierra -using lldb
« Reply #7 on: May 28, 2017, 02:06:11 pm »



 
Quote
Hi Phil.

Do you have time for a step by step description for this in the lazarus wiki? I think that this would really helpful, if not for many, at least for me 😉

Or can you give me a bit of guidance through this? I did not find it obvious, which selections to do in Xcode to achieve this.

MiSchi.

+1 froπm me

Sourceforge says 700+ downloads/week for MacOS version of Lazarus.
Probably doing the same as me - debug on Windows then cross fingers for Mac

Thanks
Nigel
Lazarus 2.1 on Windows 10 / macOS Mojave

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Debbuging in macOS Sierra -using lldb
« Reply #8 on: May 28, 2017, 04:58:36 pm »
Hi Phil.

Do you have time for a step by step description for this in the lazarus wiki? I think that this would really helpful, if not for many, at least for me 😉

Or can you give me a bit of guidance through this? I did not find it obvious, which selections to do in Xcode to achieve this.

MiSchi.

I would be interested, too.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

lelebass

  • New Member
  • *
  • Posts: 41
Re: Debbuging in macOS Sierra -using lldb
« Reply #9 on: May 28, 2017, 10:12:55 pm »
Hi Phil.

Do you have time for a step by step description for this in the lazarus wiki? I think that this would really helpful, if not for many, at least for me 😉

Or can you give me a bit of guidance through this? I did not find it obvious, which selections to do in Xcode to achieve this.

MiSchi.

+1

Daniele

mischi

  • Full Member
  • ***
  • Posts: 170
Re: Debbuging in macOS Sierra -using lldb
« Reply #10 on: May 29, 2017, 05:42:31 pm »
Dear Phil.

I tried to set up Xcode, but failed. Can you help me on these questions?

1) What kind of target do i have to select for the dummy project?
macOS → Cocoa Application, or Command Line Tool or Cross-platform → Empty or External Build System

2) Which files do i have to add to the project? I assume the application bundle and the source code files.

3) What else is needed to enable debugging?

MiSchi

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Debbuging in macOS Sierra -using lldb
« Reply #11 on: May 29, 2017, 08:16:25 pm »
I tried to set up Xcode, but failed.

My thought was to add this as a template to ProjectXC:

https://macpgmr.github.io/ObjP/ProjectXC.html

Then you just run a simple console app to create the Xcode project, open the new project in Xcode and starting debugging. It won't make any changes to your Lazarus project unless you edit the Info.plist or Pascal source files in Xcode.

Note that while this will help remedy some of the deficiencies of Lazarus, it won't help any with LCL. You'll still be stuck in the LCL box on Mac.

Let me see if I can find some time to look at this idea again.


VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Debbuging in macOS Sierra -using lldb
« Reply #12 on: May 31, 2017, 03:19:21 pm »
I am also interested in the options for debugging in Sierra. I have not yet upgraded, but it seems inevitable. I code and debug on Mac and then build Windows and Linux versions with more limited testing. I appreciate any guidance you may be able to offer Phil.

Cheers,
VTwin
« Last Edit: May 31, 2017, 03:21:34 pm by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Debbuging in macOS Sierra -using lldb
« Reply #13 on: June 01, 2017, 12:51:10 am »
I am also interested in the options for debugging in Sierra.

I added support to ProjectXC for creating an Xcode project for a Lazarus project:

https://macpgmr.github.io/ObjP/ProjectXC.html

I don't actually use Lazarus much, so I don't have a selection of projects to test this on. Let me hear if this works for you (or doesn't work). I would guess there will be types of projects or Lazarus features that have unexpected things about them that will need a bit more study.

If you have a problem, create a new small Lazarus project that illustrates it and post it here so others can test it with ProjectXC.



MISV

  • Hero Member
  • *****
  • Posts: 772
Re: Debbuging in macOS Sierra -using lldb
« Reply #14 on: July 04, 2017, 08:14:49 pm »
Hi Phil,

Does this work for debugging bug Lazarus 1.6.4 / LCL-carbon projects as well?

I am currently experiencing a very wack problem with Lazarus / GDB-debugger calling Mac API functions in Sierra 1.6.4 (debugging works otherwise, but blows up when calling any OSX API function) :

https://forum.lazarus.freepascal.org/index.php/topic,37429.html


 

TinyPortal © 2005-2018