macOS Sierra GDB not codesigned
Yes, code signing should work is a substantially better alternative to disabling SIP. I can't really believe how often disabling SIP is suggested as a solution to this problem - if you get desperate I'd sooner advise running sudo gdb (have backups!) than disabling SIP.

For me, the problem was that I repeatedly messed up one or more steps in the procedure. I ended up doing brew reinstall gdb, deleting all the certificates I had created, rebooting and then very carefully following the procedure again. Note that when you install gdb with Homebrew, the following is shown:

==&gt; Caveats
gdb requires special privileges to access Mach ports.
You will need to codesign the binary. For instructions, see:

  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" &gt;&gt; ~/.gdbinit


Those instructions were what worked for me on Sierra. Disabling startup-with-shell so far has not been necessary, but it's worth keeping in mind if you're sure that you did it all correctly and the troubleshooting section of the link is of no use.