GBD
GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
Install
brew update && brew install gdb
Create a Certificate
- Open Keychain Access
- In the menu, open Keychain Access > Certificate Assistant > Create a certificate
- Give it a name
- Identity type: Self Signed Root
- Certificate type: Code Signing
- Check: let me override defaults
- Continue until it prompts you for: “Specify a location for…”
- Set Keychain location to System
- Create a certificate and close assistant.
- Find the certificate in System keychains, right click it > get info (or just double click it)
- Expand Trust, set Code signing to always trust
- Restart taskgated in terminal:
killall taskgated
- Enable root account:
- Open System Preferences
- Go to User & Groups > Unlock
- Login Options > “Join” (next to Network Account Server)
- Click “Open Directory Utility”
- Go up to Edit > Enable Root User
Sign and entitle the gdb binary
Create a gdb-entitlement.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
</pre>
codesign --entitlements gdb-entitlement.xml -fs gdb-cert $(which gdb)
Refresh the system’s certificates and code-signing data
Run sudo killall taskgated
Maybe you can reboot your computer!
Troubleshooting / further diagnosis
On 10.12 (Sierra) or later with SIP, you need to run this:
echo "set startup-with-shell off" >> ~/.gdbinit
Other commands
chmod 755 gdb
chgrp admin gdb