gdb can be used to debug programs written in Go and compiled with gccgo or 6g compilers.
Here is a summary of the Go-specific features and restrictions:
The current Go package
For example, given the program:
package main var myglob = "Shall we?" func main () { // ... }
When stopped inside main
either of these work:
(gdb) p myglob (gdb) p main.myglob
Builtin Go types
string
type is recognized by gdb and is printed
as a string.
Builtin Go functions
unsafe.Sizeof
function and handles it internally.
Restrictions on Go expressions
&^
.
The Go _
“blank identifier” is not supported.
Automatic dereferencing of pointers is not supported.