Debugger Mac OS 10.12.5 Lazarus 1.6.4 rexported FPC 3.0.2 i386-darwin- carbon lazarus / 12-Debugger ---------------------------------------------------------------------- GillesH · 2017-06-16 13:38 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. 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 : QuoteLa 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 Excuse my practice of English, this language for which I have no friendship and which makes me well besides.https://forum.lazarus.freepascal.org/index.php?topic=34165.30 : Well let's see ... and if I put my mac down directly? ---------------------------------------------------------------------- Phil · 2017-06-16 13:52 Quote from: GillesH on June 16, 2017, 03:38:55 pmI 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 · 2017-06-16 14:02 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. ---------------------------------------------------------------------- GillesH · 2017-06-18 13:33 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][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i cd downloads/gdb-8.0./configuremakemake 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) - DoneDo 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][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i sudo killall taskgatedsudo codesign -fs gdb-cert /usr/local/bin/gdb 4. In Lazarus->Tools->Options->Debugger : GNU debugger (gdb) : usr/local/bin/gdbDebugger_StartUp_Option :“set startup-with-shell off” (with ") Close Lazarus and reboot. Regards. Gilles ---------------------------------------------------------------------- GillesH · 2017-06-19 07:28 Hello, It is true that I carried out many operations before they succeeded. I propose to check some settings ... Lazarus : VersionDebugger/usr/local/bin/gdb : executable permission QuoteunMac:~ 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 ---------------------------------------------------------------------- carl_caulkett · 2017-06-19 11:00 Quote from: GillesH on June 19, 2017, 09:28:53 amHello, It is true that I carried out many operations before they succeeded. I propose to check some settings ... Lazarus : VersionDebugger/usr/local/bin/gdb : executable permission QuoteunMac:~ 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 ---------------------------------------------------------------------- carl_caulkett · 2017-06-19 11:03 Quote from: Phil on June 16, 2017, 03:52:00 pmQuote from: GillesH on June 16, 2017, 03:38:55 pmI 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. ---------------------------------------------------------------------- GillesH · 2017-06-20 10:09 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  /usr/local/bin/gdb size Yours... 8 333 564Mine...  8 407 456Conclusion: 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. ---------------------------------------------------------------------- GillesH · 2017-06-20 17:52 Hello, I took the time to completely uninstall gdb and Qt. I run Lazarus and debug a project : Error ",msg...". OK. I unarchived the archive gdb-8.0.tar.gz in ~/downloads/gdb-8.0 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i cd ~/downloads/gdb-8.0In sudo mode : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ./configuremakemake install I keep my certificate "gdb-cert" which does not present anything particular. In sudo mode : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i killall taskgatedcodesign -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.  PS : System Integrity Protection status: disabled. ---------------------------------------------------------------------- carl_caulkett · 2017-06-20 20:53 Hello, I downloaded the GDB that you are hosting and did... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i sudo ./configuresudo makesudo make install  I am still getting the same size for gdb, namely... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i s -l /usr/local/bin/gdb-rwxr-xr-x  1 root  admin  8333564 20 Jun 20:28 /usr/local/bin/gdb ~   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? ---------------------------------------------------------------------- GillesH · 2017-06-21 10:06 Hello Carl, in Lazarus, this is my current debugger's configuration. I suppose your xcode command line tools is installed. Regards. Gilles ---------------------------------------------------------------------- carl_caulkett · 2017-06-21 10:18 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: ---------------------------------------------------------------------- GillesH · 2017-06-21 10:36 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 ---------------------------------------------------------------------- carl_caulkett · 2017-06-21 15:19 My versions from gcc and make are as follows: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  ~  gcc --versionConfigured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx- include-dir=/usr/include/c++/4.2.1Apple LLVM version 8.1.0 (clang-802.0.42)Target: x86_64-apple-darwin16.6.0Thread model: posixInstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchai ns/XcodeDefault.xctoolchain/usr/bin ~  make --versionGNU Make 3.81Copyright (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 APARTICULAR PURPOSE. This program built for i386-apple-darwin11.3.0 ~  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 ---------------------------------------------------------------------- GillesH · 2017-06-22 07:20 Hello Carl, gcc --version QuoteConfigured 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/Xc odeDefault.xctoolchain/usr/bin Have a nice day! Regards. Gilles make --versionGNU Make 3.81 QuoteCopyright (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 ---------------------------------------------------------------------- carl_caulkett · 2017-06-22 11:55 LOL. They are identical! In any case, I am getting used to using Xcode to debug. It helps that I can still make GUI changes in Lazarus and have them instantly updated in Xcode. Obviously, this represents a mystery to be solved but it's not massively urgent. I guess we'll just have to wait for Lazarus 2.0, in which all the debugging shortcomings will have been solved! Cheers, Carl ---------------------------------------------------------------------- Wil · 2017-07-28 11:36 Hello, OMG, I had to much trouble getting gdb to play nice. Always got the dreaded error that my gdb was not signed. This part of your message however was what made me realize the problem was elsewhere Quote from: GillesH on June 19, 2017, 09:28:53 amQuoteunMac:~ 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] I had installed the fsf-gdb version of the debugger via fink and it turned out it had set the ownership of the file to defaults not under my user account. Eg. Quote$ ls -al /sw/lib/fsf-gdb/fsf-gdb -rwxr-sr-x  1 root  procmod  8792912 Jul 28 13:15 /sw/lib/fsf-gdb/fsf- gdb Once I changed that via: Quote $ sudo chown myusername:admin /sw/lib/fsf-gdb/fsf-gdb The debugger credential request login came up and things started to work. Thank You so much for writing it out. Can't believe how long this took me to get right. -- Wil