Hi all, some of you may know me from GDB, and a few with long memories may remember that I did a couple Mac ports of GNU a while back (those silly mpw-. files scattered everywhere are my fault). I've just started working for Apple's Mac OS X tools team. This may come as a surprise, but Mac OS X is basically FreeBSD 3.2 with a GUI. Apple Mac Gdb for developers: Explain probe Definition candidate driver communicates with a device and verifies whether it can drive; Explain Shift-click Definition This combination is used to select multiple objects or to extend a selection; Explain endpoint Definition See MIDI endpoint; Explain UTF-16 Definition form of Unicode in which 16-bits are used to encode a character.
It is this time of the year again. Apple has released a new version of their operating system, now named macOS Sierra.
We started running some tests on that platform, and although we do not have full results yet, things are looking good.
The compiler and most tools work as expected.
However, Apple has once again further restricted what tools can do on the system (for sure that should result in a safer system). The major impact is on our command line debugger, gdb, since this is a tool whose whole purpose is to view and modify running processes on the system. Not something that macOS likes very much in general, although Apple's own debugger of course works flawlessly.
In previous versions of OSX, it was enough for us to codesign gdb. This no longer works, and so far there doesn't seem to be something that we can do on our side (other tools in the Apple ecosystems have similar unresolved issues).
The solutions differ on Sierra 10.12.0 and Sierra 10.12.1.
The solution will require you to slightly lower the security of your system by partially disabling SIP (System Integrity Protection). This can be done as follows:
Note that disabling this will lower the security of your system, so doing the above should really be your decision.
Another impact of this change is that the DYLD_LIBRARY_PATH variable is no longer reset when spawning new processes via the shell. This variable is used by the dynamic linker to find dynamic libraries. It takes precedence over the search path coded in the executables, so is considered as unsafe by the OS. As a result, macOS by default unsets the variable so that the executable you spawn uses its own libraries. We recommend using the DYLD_FALLBACK_LIBRARY_PATH instead, which comes after the application's library search path, in case some libraries are still not found.
The solution requires a patched version of GDB, so either a recent wavefront of GNAT Pro (date >= 2016-11-08) or a fresh snapshot from FSF sources (the patch was committed today 2016-11-09).
In addition to that, you will need to add the line 'set startup-with-shell off' at the start of your GDB session, which can be done once and for all by copying it to your file .gdbinit on your $HOME. The benefit of putting it in .gdbinit is that it will work with IDEs that launch GDB for you on the program (like GPS, GNATbench or Emacs).
For reference, see Apple's forum.
We will edit this post as we discover more things about macOS Sierra
Edit: The solution for Sierra 10.12.1 still requires user action to avoiding spawning a shell from GDB. We haven't found a better solution yet, we will update the post when there is one.
Emmanuel Briot has been with AdaCore between 1998 and 2017. He has been involved in a variety of projects, in particular oriented towards graphical user interfaces, including GtkAda, GPS, XML/Ada, GnatTracker and our internal CRM. He holds an engineering degree from the Ecole Nationale des Telecommunications (Brest, France).