* * *

Author Topic: macOS Sierra - Debugging not working  (Read 38546 times)

esvignolo

  • Full Member
  • ***
  • Posts: 144
  • Using FPC in Windows, Linux, Macos
Re: macOS Sierra - Debugging not working
« Reply #30 on: November 01, 2016, 11:18:35 am »
Maybe is a good idea, make a app wich make translation from GDB to LLDB, the commands are similar, and if this app do the work, possible no changes need on lazarus. Only need to call to this app (like GDB) and this one call LLDB.

 

@mac01
Note : I have been able to migrate to Sierra (10.12) easily. In fact I have done nothing. Than the last update to 10.12.1  broke the stuff.

The GDB debugger is part of GNU. Xcode does not use GNU tools (gcc, gdb) anymore. Xcode uses LLVM. LLVM's debugger is LLDB.

No surprise that unsupported software might eventually stop working.

Some links of interest:

https://developer.apple.com/library/content/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html

http://lldb.llvm.org/

Even Eclipse is adding support for LLDB:

https://wiki.eclipse.org/CDT/User/FAQ#How_do_I_get_the_LLDB_debugger.3F

Phil

  • Hero Member
  • *****
  • Posts: 2749
Re: macOS Sierra - Debugging not working
« Reply #31 on: November 01, 2016, 03:16:59 pm »
I have another bug where my program simply ends without exeption. Even running via lldb let me only get a runtime error number and hex addresses. Typing "bt" does not work because the thread has already ended. How can I convert the addresses into source line numbers?

Did you try a thread backtrace?

Post a simple example that demonstrates the problem and maybe somebody can look at it.

Phil

  • Hero Member
  • *****
  • Posts: 2749
Re: macOS Sierra - Debugging not working
« Reply #32 on: November 01, 2016, 03:19:46 pm »
Maybe is a good idea, make a app wich make translation from GDB to LLDB, the commands are similar, and if this app do the work, possible no changes need on lazarus. Only need to call to this app (like GDB) and this one call LLDB.

I won't pretend to know anything about debugger integration. All I know about lldb is what I see on the lldb site, that it has both a C++ and Python interface:

http://lldb.llvm.org/



cpbns

  • New member
  • *
  • Posts: 5
Re: macOS Sierra - Debugging not working
« Reply #33 on: November 06, 2016, 09:33:26 pm »
i just found a possible solution to the problem in one blog: One guy developed a patch to gdb 7.12 concerning the task port mechanism.
See last entry of:
http://sourceware-org.1504.n7.nabble.com/gdb-on-macOS-10-12-quot-Sierra-quot-td415708.html#a415940
I myself can't develop this patch further, but it looks that the problem lays on gdb side.

Coldzer0

  • New member
  • *
  • Posts: 32
Re: macOS Sierra - Debugging not working
« Reply #34 on: November 11, 2016, 03:37:58 pm »
Here's the Patched Version
Compiled and tested >> Mac OS "Sierra 10.12.1 (16B2555)"

https://mega.nz/#!VkBWVJ7J!LzA51cXfWPK_o7TrNz6jU5jMaNGGmkgH-tj5kj-DIpI

i test it with Codetyphon and Lazarus works fine

please test and tell me if it work

to sign it
https://sourceware.org/gdb/wiki/BuildingOnDarwin

On 10.12 (Sierra) or later with SIP, you need to run this:

echo "set startup-with-shell off" >> ~/.gdbinit
« Last Edit: November 11, 2016, 04:06:22 pm by Coldzer0 »

cpbns

  • New member
  • *
  • Posts: 5
Re: macOS Sierra - Debugging not working
« Reply #35 on: November 11, 2016, 08:01:26 pm »
Fine Work. Thanks.
But, sorry, after new installation of gdb by home-brew (i guess its the same version of your link)
and new codesigning(and restart of the machine), verifying in gdb "startup-with-shell off" was correctly set by .gdbinit, next problem arose (OSX 10.12.1):
"During startup program terminated with signal ?, Unknown signal."
i tried different debugger option in Lazarus> no change.
Any idea?

cpbns

  • New member
  • *
  • Posts: 5
Re: macOS Sierra - Debugging not working
« Reply #36 on: November 11, 2016, 10:08:23 pm »
To add to my last reply.
After same tests i finally succeed by applying "csrutil enable --without debug" during startup the machine mit CMD+R !
Thats it. Lazarus and GDB work fine now!! :D
Thank you to all of you.

xaver13

  • Jr. Member
  • **
  • Posts: 85
Re: macOS Sierra - Debugging not working
« Reply #37 on: November 12, 2016, 01:03:45 pm »
hello, I downloaded gdb from link above here
then I ran

sudo cp /Users/jiricvrk/Downloads/gdb/gdb /usr/local/bin

Lazarus updates debug path automatically to  /usr/local/bin/gdb

and after cmd+r
csrutil enable --without debug  .. I am afraid, that nothing happened
Returned requesting unsupported configuration
I decided to try
csruti disable

But now I get:
 Python Exception No module named gdb: /usr/local/bin/gdb:warning
Could not load the Python gdb module from
/usr/local/Cellar/gdb/7.2_1/share/gdb/python
..
suggest passing --data-directory=/path/to/gdb/data-directory
…The GDB command:
"-exec-run"
returned the error:
",msg="Unable to find Mach task port for process-id 474: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))""


I used code sign, but get ..already signed...

Jiris-Mac:~ jiricvrk$ sudo codesign -s gdb-cert  /usr/local/bin/gdb
Password:
/usr/local/bin/gdb: is already signed
Jiris-Mac:~ jiricvrk$Jiris-Mac:~ jiricvrk$ sudo codesign -v   /usr/local/bin/gdb
NOTHING RETURNED

I tried
 /usr/local/bin/gdb --data-directory /usr/local/bin
without success. Any ideas, please?

--
Jiri Cvrk

cpbns

  • New member
  • *
  • Posts: 5
Re: macOS Sierra - Debugging not working
« Reply #38 on: November 12, 2016, 03:55:21 pm »
I don't know if i can help you. But because i ran into similar problems, let me describe my procedure, which in the end succeeded:
- I first downloaded too the gdb-exe, renamed the old gdb-exe and copied the new one into the gdb-directory. GdB-Start showed same error-message (SIG1139 ..). I gave codesign with the same certificate again. Restart gdb: Same error.
- Therefore i decided to delete the complete gdb-installation directory (also in trash!).
- delete the certificate in key manager
(csrutil status was :  all enabled!)
- gave: "homebrew install gdb" (Homebrew , a packetmanger for mac)
  the 7.12.1 gdb version was installed, and what i saw into the dir /usr/local/bin, formerly it was /local/bin
- creation of a new certificate (for code, system etc.) with a new certificate name, to avoid any mismatch
- codesign -s ...gdb
- restarting the machine
- gdb results into error SIG ?
- trying different debugger options, with no success
- restarting machine again with CMD+R and csrutil enable --without debug
- checking csrutil status
- reinstalling lazarus (your applications are not deleted)
- checking path of debugger in lazarus
>> NOW, Everything went allright!

So, i cannot explain, which of these steps are important. But what i see is that codesign seems to me a complicated process, in which it can't be seen by the user, what the operating system is really doing(f.i. are links followed up to the exec-files? are both links and exe code signed? etc.)
I hope i could help for your trials. Good luck!

xaver13

  • Jr. Member
  • **
  • Posts: 85
Re: macOS Sierra - Debugging not working
« Reply #39 on: November 12, 2016, 05:10:14 pm »
Thank you cpbns!

I erased my gdb. Then I installed
brew install gdb

and signed it
 codesign -s gdb-cert  /usr/local/Cellar/gdb/7.12_1/bin/gdb
then runed
codesign -s gdb-cert  /usr/local/Cellar/gdb/7.12_1/bin/gdb

and for me it was all, Lazarus started working,   csrutil was disabled from prior
« Last Edit: November 13, 2016, 12:16:59 pm by xaver13 »
--
Jiri Cvrk

Brian Coleman

  • New member
  • *
  • Posts: 34
Re: macOS Sierra - Debugging not working
« Reply #40 on: November 12, 2016, 05:23:37 pm »
Hi,
Hi,

Some people have mentioned the possibility of running Lazarus under Sierra WITHOUT THE DEBUGGER.

For making minimal changes to my already functional program, I'm sure I could live with this, at least for the moment.

Maybe someone might kindly let me know WHAT HAS TO BE DONE TO BYPASS THE DEBUGGER.

Maybe this is a naive question, but I'm a relative amateur.



Brian

Brian Coleman

  • New member
  • *
  • Posts: 34
Re: macOS Sierra - Debugging not working
« Reply #41 on: November 17, 2016, 01:59:41 pm »
Hi,

Found the simple answer - not immenditely apparent  - in the options debugger menu.

However, program will not compile under Sierra.
Message (Lazarus 1.4.4):
Compiling package FCL 1.0.1: Exit code 13, Errors 11

 



xinyiman

  • Hero Member
  • *****
  • Posts: 1717
Re: macOS Sierra - Debugging not working
« Reply #42 on: November 26, 2016, 08:21:51 pm »

Hi, well I can not run away the debugger on Sierra. Come I do a Fix?
Ubuntu and Mac
Lazarus: 1.8.0
FPC: 3.0.4

tolisoft

  • Newbie
  • Posts: 4
Re: macOS Sierra - Debugging not working
« Reply #43 on: December 02, 2016, 02:00:38 pm »
I have tried everything mentioned in this thread but I did not manage to have working debugger with lazarus.

Any new ideas?

ZXDunny

  • New member
  • *
  • Posts: 7
Re: macOS Sierra - Debugging not working
« Reply #44 on: December 07, 2016, 10:49:38 am »
FWIW, Debugging in Delphi has also died a death with Sierra 10.12.1 - Embarcadero have been unable to fix it, though they said a month or so ago that a fix was coming "soon"... and in the interim, Update 2 has been released for Delphi Berlin and no fix has been forthcoming.

 

Recent

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