Code Signing GNU GDB on Mac

Purpose

Debugging on a Mac machine is definitely not the most pleasant thing to do. I decided to keep a cumulative note here for my experience of code signing gdb on my Mac machine as tools are constantly changing. And actually it is always hard to find the right suggestion for a specific issue. This would be helpful if you are using a Mac, GDB as your debugger, and some kind of IDE like NetBeans.

Specifically, my configuration is as follow:

  • macOS High Sierra Version 10.13.3
  • GNU gdb (GDB) 8.0.1
  • NetBeans IDE 8.2
  • Homebrew 1.5.12-27

Some Known Issues

please check gdb is codesigned - see taskgated(?)

xdavidliu explains and solves this problem very well. Please refer to the answer.

Please make sure that you notice that the latest version of gdb (8.1) cannot be code signed according to the above answer.

An Error Occurred Unknown Error = -2,147,414,007

This can probably happen when you try to create a certificate directly in the System. A workaround for this is to first, create the certificate in Login and export it as a file. Then import the certificate to System. You can find the steps Here.

References