Luuk van Dijk 2 November 2010
When it comes to debugging, nothing beats a few strategic print statements to inspect variables or a well-placed panic to obtain a stack trace. However, sometimes you’re missing either the patience or the source code, and in those cases a good debugger can be invaluable. That's why over the past few releases we have been improving the support in Go’s gc linker (6l, 8l) for GDB, the GNU debugger.
In the latest release (2010-11-02), the 6l and 8l linkers emit DWARF3 debugging information when writing ELF (Linux, FreeBSD) or Mach-O (Mac OS X) binaries. The DWARF code is rich enough to let you do the following:
There are still some inconveniences:
chgrp procmod
chmod g+s
v
main
'main.v'
{data = 0x2aaaaab3e320, len = 1, cap = 1}.
Some things don't work yet:
Over the coming months we intend to address these issues, either by changing the compiler and linker or by using the Python extensions to GDB. In the meantime, we hope that Go programmers will benefit from having better access to this well-known debugging tool.
P.S. The DWARF information can also be read by tools other than GDB. For example, on Linux you can use it with the sysprof system-wide profiler.