My app runs fine but gdb fails to debug it with the following error
(gdb) run
Starting program: /path/to/app
Unable to find Mach task port for process-id 83
It works when I change to sudo gdb executableFileName
! :)
You need to create a certificate and sign gdb:
Finally you can sign gdb:
sudo codesign -s gdb-cert /usr/local/bin/ggdb
sudo ggdb ./myprog
This link had the clearest and most detailed step-by-step to make this error disappear for me.
In my case I had to have the key as a "System" key otherwise it did not work (which not every url mentions).
Also killing taskgated
is a viable (and quicker) alternative to having to restart.
I also uninstalled MacPorts before I started this process and uninstalled the current gdb using brew uninstall gdb
.
I followed this tutorial, and everything is OK.
This is a weird approach but it worked for me(MacOs HighSierra 10.13.3). Install CLion. It comes with gdb. Once run the gdb using Terminal. Copy the gdb program to your usr/local/bin/. No problem of signin, sudo etc.
Here is a really useful guide which solved my problem(OSX 10.13.6).
codesign -fs gdbc /usr/local/bin/gdb
in terminal: this asks for the root password