Here's a blog post explains it very well:
http://panks.me/posts/2013/11/install-gdb-on-os-x-mavericks-from-source/
And the way I get it working:
Create a coding signing certificate via KeyChain Access:
1.1 From the Menu, select KeyChain Access > Certificate Assistant > Create a Certificate...
1.2 Follow the wizard to create a certificate and let's name it gdb-cert
, the Identity Type is Self Signed Root, and the Certificate Type is Code Signing and select the Let me override defaults.
1.3 Click several times on Continue until you get to the Specify a Location For The Certificate screen, then set Keychain to System.
Install gdb via Homebrew: brew install gdb
Restart taskgated
: sudo killall taskgated && exit
Reopen a Terminal window and type sudo codesign -vfs gdb-cert /usr/local/bin/gdb