* * *

Author Topic: Debugger Mac OS 10.12.5 Lazarus 1.6.4 rexported FPC 3.0.2 i386-darwin-carbon  (Read 1560 times)

GillesH

  • New member
  • *
  • Posts: 41
Hello,

I usually use Qt and LLDB. Xcode 8.3.3 is installed.
This morning I installed Lazarus to test unidac with Mac OS 10.12.5. I use it with Delphi.

Install of Lazarus : i386-darwin is already very unhappy. But I knew it.
But use gdb with Lazarus will quickly confuse you and rapidly send you crazy. :o I did not even imagine that.
So I'm looking for a step-by-step method to be able to debug from Lazarus with my configuration.
I built gdb-7.12.1 from its sources and signed it correctly, that is to say in the usual manner under 10.12.
The result with Lazarus :
Quote
La commande GDB :
"-exec-run"
a renvoyé l'erreur :
",msg="Unable to find Mach task port for process-id 699: (os/kern) failure (0x5).\n (please check gdb is codesigned - see 
It's.... impressive ! So a little bit out of a time loss for a normally so simple thing, I wonder if anyone has a reliable method, not for 10.8, 10.9... but 10.12.5, the current version of Mac OS X. Thank you in advance. Cordially. Gilles

« Last Edit: June 16, 2017, 04:07:02 pm by GillesH »

Phil

  • Hero Member
  • *****
  • Posts: 2261
I usually use Qt and LLDB. Xcode 8.3.3 is installed.
This morning I installed Lazarus to test unidac with Mac OS 10.12.5. I use it with Delphi.

I would recommend that you create a temporary Xcode project for the Lazarus project and debug in Xcode with lldb. Here's how:

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

GillesH

  • New member
  • *
  • Posts: 41
Thank you for this answer.

No,... This is not what I'm looking for. Does your answer mean that we can not integrate a debugger in Lazarus mac ?

Regards.
« Last Edit: June 16, 2017, 04:07:54 pm by GillesH »

GillesH

  • New member
  • *
  • Posts: 41
Hello,

Continuation and provisional end...

Sources : ftp://sourceware.org/pub/gdb/releases/
Tested :
gdb-7.12.1 without and with patch
ftp://sourceware.org/pub/gdb/releases/gdb-7.12.1.tar.gz
>> failed even with the patch https://mega.nz/#!VkBWVJ7J!LzA51cXfWPK_o7TrNz6jU5jMaNGGmkgH-tj5kj-DIpI

gdb-8.0
ftp://sourceware.org/pub/gdb/releases/gdb-8.0.tar.gz
>> Ok for the first tests

My approach :
1. In command lines :
Code: Pascal  [Select]
  1. cd downloads/gdb-8.0
  2. ./configure
  3. make
  4. make install (by default in /usr/local/bin, /usr/local/lib, etc)

2. Create a gdb-cert :
  • Keychain Access->Certificate Assistant->Create a Certificate...
  • [Name = gdb-cert - Identity Type = Self Signed Root - Certificate Type = Code Signing... Click, click... (default values) - Done
Do not forget to double click on your new gb-cert certificate : Turn down the "Trust" disclosure triangle and change :
  • When using this certificate: Always Trust it.
3. In command lines :
Code: Pascal  [Select]
  1. sudo killall taskgated
  2. sudo codesign -fs gdb-cert /usr/local/bin/gdb

4. In Lazarus->Tools->Options->Debugger :
  • GNU debugger (gdb) : usr/local/bin/gdb
  • Debugger_StartUp_Option :“set startup-with-shell off” (with ")

Close Lazarus and reboot.

Regards. Gilles

GillesH

  • New member
  • *
  • Posts: 41
Hello,
It is true that I carried out many operations before they succeeded. I propose to check some settings ...
  • Lazarus :
  • /usr/local/bin/gdb : executable permission
    Quote
    unMac:~ untel$ ls -l /usr/local/bin/gdb
    -r-xr-xr-x  1 untel  admin  8407456 18 jui 14:10 /usr/local/bin/gdb
    unMac:~ untel$ /quote]

Regards. Gilles
« Last Edit: June 19, 2017, 10:06:05 am by GillesH »

carl_caulkett

  • Full Member
  • ***
  • Posts: 241
Hello,
It is true that I carried out many operations before they succeeded. I propose to check some settings ...
  • Lazarus :
  • /usr/local/bin/gdb : executable permission

    Quote
    unMac:~ untel$ ls -l /usr/local/bin/gdb
    -r-xr-xr-x  1 untel  admin  8407456 18 jui 14:10 /usr/local/bin/gdb
    unMac:~ untel$ /quote]

Regards. Gilles
0
My system:

macOS 10.12.5
Lazarus 1.6.4
FPC 3.0.2
gdb --version
    GNU gdb (GDB) 8.0
ls -l /usr/local/bin/gdb
    -rwxr-xr-x  1 root  admin  8333564 18 Jun 16:44 /usr/local/bin/gdb
csrutil status
    System Integrity Protection status: disabled.


It's very much like your system, Gilles. Yet there must be some subtle difference. I wonder what it can be!

Cheers,
Carl
macOS 10.12.6
Lazarus 1.8.0 RC4
FPC 3.0.2

carl_caulkett

  • Full Member
  • ***
  • Posts: 241
I usually use Qt and LLDB. Xcode 8.3.3 is installed.
This morning I installed Lazarus to test unidac with Mac OS 10.12.5. I use it with Delphi.

I would recommend that you create a temporary Xcode project for the Lazarus project and debug in Xcode with lldb. Here's how:

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

I can confirm that this suggestion of Phil's works pretty well, although there seem to be difficulties in accessing the contents of UnicodeStrings - AnsiStrings are ok.
macOS 10.12.6
Lazarus 1.8.0 RC4
FPC 3.0.2

GillesH

  • New member
  • *
  • Posts: 41
Hello,
The XCode method works well. But how can we integrate it more satisfactorily in Lazarus ?I do not see myself using this method every time I change my code when I encounter a serious problem.

Not definitely either there is a way to debug quickly and easily my programs compiled with Lazarus as with Qt, or I have to find something other than Lazarus.

Carl : We will not let go gdb any more so that I have to be able to replicate the method  ;D
/usr/local/bin/gdb size
  • Yours... 8 333 564
  • Mine...  8 407 456
Conclusion: these are not the same. I rebuild it to check that I was not mistaken in the references I gave.
Time to do the job and I come back. Gilles.
« Last Edit: June 20, 2017, 12:12:23 pm by GillesH »

GillesH

  • New member
  • *
  • Posts: 41
Hello,

I took the time to completely uninstall gdb and Qt.
I run Lazarus and debug a project : Error ",msg...". OK. :D

I unarchived the archive gdb-8.0.tar.gz in ~/downloads/gdb-8.0
Code: Pascal  [Select]
  1. cd ~/downloads/gdb-8.0
In sudo mode :
Code: Pascal  [Select]
  1. ./configure
  2. make
  3. make install

I keep my certificate "gdb-cert" which does not present anything particular.
In sudo mode :
Code: Pascal  [Select]
  1. killall taskgated
  2. codesign -fs gdb-cert /usr/local/bin/gdb

Reboot.

I run Lazarus. Result : It seems to work fine*

I will try again on another Mac later. Regards. Gilles

---
* I expect to use it more fully to be more affirmative.  :D
PS : System Integrity Protection status: disabled.

« Last Edit: June 20, 2017, 08:02:58 pm by GillesH »

carl_caulkett

  • Full Member
  • ***
  • Posts: 241
Hello, I downloaded the GDB that you are hosting and did...
Code: Pascal  [Select]
  1. sudo ./configure
  2. sudo make
  3. sudo make install
  4.  

I am still getting the same size for gdb, namely...
Code: Pascal  [Select]
  1. s -l /usr/local/bin/gdb
  2. -rwxr-xr-x  1 root  admin  8333564 20 Jun 20:28 /usr/local/bin/gdb
  3.  ~ 
  4.  

This would suggest that the make and make install processes are different on our machines.

In any case, I think the problem in my case has more to do with the way Lazarus is configured to use GDB. Here is a screenshot of the Debugger options on my machine.

When I try to run an application I get an error message which mentions the Debugger_Startup_Options "set startup-with-shell off"
parameter. Am I doing something wrong here?


macOS 10.12.6
Lazarus 1.8.0 RC4
FPC 3.0.2

GillesH

  • New member
  • *
  • Posts: 41
Hello Carl,

in Lazarus, this is my current debugger's configuration.

I suppose your xcode command line tools is installed.

Regards. Gilles
« Last Edit: June 21, 2017, 12:12:14 pm by GillesH »

carl_caulkett

  • Full Member
  • ***
  • Posts: 241
Hello Gilles. I'm afraid it's still not working for me, but thanks very much for the trouble you've taken so far to help.

Could I ask one more favour? Could you post screenshots of your Project Options/Compiler Options, in particular, the "Compilation and Linking" page and the "Debugging" page? Mine are shown below:

 
macOS 10.12.6
Lazarus 1.8.0 RC4
FPC 3.0.2

GillesH

  • New member
  • *
  • Posts: 41
No problem.

But I'm going to start to worry if the installation is not reproducible.
I have 2 other mac mini but they are reserved for development Qt ... and if I start to tinker them, I will draw the wrath of my small team. (I do not know if this is said in English but it is the literal translation of well-french expressions)

Here are my 2 screenshots : 1 and 2

Perhaps : sourceware.org/gdb/wiki/BuildingOnDarwin
« Last Edit: June 21, 2017, 12:49:10 pm by GillesH »

carl_caulkett

  • Full Member
  • ***
  • Posts: 241
My versions from gcc and make are as follows:

Code: Pascal  [Select]
  1.  ~  gcc --version
  2. Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
  3. Apple LLVM version 8.1.0 (clang-802.0.42)
  4. Target: x86_64-apple-darwin16.6.0
  5. Thread model: posix
  6. InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  7.  ~  make --version
  8. GNU Make 3.81
  9. Copyright (C) 2006  Free Software Foundation, Inc.
  10. This is free software; see the source for copying conditions.
  11. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
  12. PARTICULAR PURPOSE.
  13.  
  14. This program built for i386-apple-darwin11.3.0
  15.  ~ 

What are yours? Since we built gdb from the same download, the difference must be in the build process, I would have thought.

Cheers,
Carl
macOS 10.12.6
Lazarus 1.8.0 RC4
FPC 3.0.2

GillesH

  • New member
  • *
  • Posts: 41
Hello Carl,

gcc --version
Quote
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Have a nice day!
Regards. Gilles
make --versionGNU Make 3.81
Quote
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus