Easier Go debugging on the command line with CGDB
Channel: Samuel Lampa
Date: 2013-08-09

(EDIT: Just a little plug: See also my course on linux commandline productivity techniques: http://www.udemy.com/command-line-productivity )

Here I quickly go through how to use CGDB to debug a Go program in an easier way than with the GDB debugger directly, since it continuously shows the code context. I cover the basic GDB commands on how to navigate the code, set breakpoints, step line-by-line and into functions and goroutines.

CGDB (http://cgdb.github.io) is a light-weight wrapper around GDB that adds a split window, with the code context above, and the normal GDB console in the bottom. In being totally command line based, it is quite a neat tool, that you can use ever remotely over SSH connections.

After you are up to speed with the basic commands in CGDB / GDB, make sure to check the this tutorial, for more detailed info on debugging Go programs: http://golang.org/doc/gdb