Here is a better way of enabling gdb on your Mac. First, if you haven't installed gdb, do so.
$ brew install gdb
If you are using Sierra or above, run the following as well:
$ echo "set startup-with-shell off" >> ~/.gdbinit
Next, this is the part where we give gdb debug other processes. Open up Keychain Access application and on the menu select Keychain Access -> Certificate Assistant -> Create a certificate.
Enter gdb-cert for the name, select Self Signed Root for Identity Type, select Code Signing for Certificate Type, and check the box Let me override defaults.
Click Continue several times until you see Specify a Location For the Certificate window. Select System for the Keychain and proceed.
Once the certificate is created, double click on it, and in the Trust section locate Code Signing item. Select Always Trust and exit. You will be prompted with your admin password to make the change.
Finally, you can close Keychain Access app and type in the following in terminal:
$ sudo killall taskgated
$ codesign -fs gdb-cert $(which gdb)
That's it! You will be able to use gdb on your Mac!
$ brew install gdb
If you are using Sierra or above, run the following as well:
$ echo "set startup-with-shell off" >> ~/.gdbinit
Next, this is the part where we give gdb debug other processes. Open up Keychain Access application and on the menu select Keychain Access -> Certificate Assistant -> Create a certificate.
Enter gdb-cert for the name, select Self Signed Root for Identity Type, select Code Signing for Certificate Type, and check the box Let me override defaults.
Click Continue several times until you see Specify a Location For the Certificate window. Select System for the Keychain and proceed.
Once the certificate is created, double click on it, and in the Trust section locate Code Signing item. Select Always Trust and exit. You will be prompted with your admin password to make the change.
Finally, you can close Keychain Access app and type in the following in terminal:
$ sudo killall taskgated
$ codesign -fs gdb-cert $(which gdb)
That's it! You will be able to use gdb on your Mac!
No comments:
Post a Comment