Next: , Previous: D, Up: Supported Languages


15.4.3 Go

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
The name of the current package does not need to be specified when specifying global variables and functions.

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
The string type is recognized by gdb and is printed as a string.


Builtin Go functions
The gdb expression parser recognizes the unsafe.Sizeof function and handles it internally.


Restrictions on Go expressions
All Go operators are supported except &^. The Go _ “blank identifier” is not supported. Automatic dereferencing of pointers is not supported.