Build Your Own GDB on Mac OS X

The GDB coming with XCode 4.5.1 on Mac OS X is an old version (6.3.50).  It is too old that cannot be used to debug Go programs or to work with Emacs 24.  Fortunately, the solution is easy – to build a newer version, say, 7.5 – and every thing would be fine.  To use GDB 7.5 with Emacs 24, do not forget to use the –i=mi parameter:

~/usr/bin/gdb -i=mi hello_world