Codesigning gdb on Mac OSX
Forked and modifed from hlissner’s post.
If you are getting this in gdb on OSX while trying to run a program:
Unable to find Mach task port for process-id 57573: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
- Open Keychain Access
- In menu, open Keychain Access > Certificate Assistant > Create a certificate
- Give it a name (e.g.
gdbc)- Identity type: Self Signed Root
- Certificate type: Code Signing
- Check: let me override defaults
- (Optional)Extend the expiration date
- Continue until “specify a location for…”
- Keychain = System
- Close. Find certificate in System keychains.
- Get Info
- Expand Trust, set Code signing to
always trust sudo killall taskgatedsudo codesign -fs gdbc /usr/local/bin/gdb- Disable root account
Done!
Appendix.