Golang gdb

From wikinotes
Revision as of 16:18, 26 June 2022 by Will (talk | contribs) (→‎gc)

Instructions for debugging go with gdb.
Instructions vary by compiler

Documentation

go blog https://go.dev/doc/gdb

gc

NOTE:

haven't quite gotten this working yet

If compiled with gc (default).

go build -gcflags "-N -l"  # build, disabling optimizations
gdb executable
#> run                    # begin running executable

Then it's regular gdb commands

run                # begin running code
layout src         # show place in code
bt                 # show backtrace
break file.go:123  # set breakpoint in file.go, line:123