7.5.1 Codesigning the Debugger

The Darwin Kernel, used by Apple’s OS X, requires the debugger to have special permissions before it’s allowed to control other processes. These permissions are granted by codesigning the GDB executable. Without these permissions, the debugger will report error messages such as:

Starting program: /x/y/foo
Unable to find Mach task port for process-id 28885: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))

Codesigning requires a certificate. The following procedure explains how to create one:

Once you’ve created a certificate as above, you can codesign the debugger by running the following command in a Terminal:

$ codesign -f -s  "gdb-cert"  <gnat_install_prefix>/bin/gdb

with gdb-cert replaced by the actual certificate name chosen above, and gnat_install_prefix replaced by the location where you installed GNAT. Also, be sure that users of GDB are in the Unix group _developer.