If you want to use gdb to inspect a core dump, you can trigger a dump on a program crash, on systems that permit it, by setting GOTRACEBACK=crash in the environment (see the runtime package documentation for more info).

(gdb) list
(gdb) list line
(gdb) list file.go:line
(gdb) break line
(gdb) break file.go:line
(gdb) disas
If you want to use gdb to inspect a core dump, you can trigger a dump on a program crash, on systems that permit it, by setting GOTRACEBACK=crash in the environment (see the runtime package documentation for more info).

(gdb) list
(gdb) list line
(gdb) list file.go:line
(gdb) break line
(gdb) break file.go:line
(gdb) disas
A recent extension mechanism to GDB allows it to load extension scripts for a given binary. The toolchain uses this to extend GDB with a handful of commands to inspect internals of the runtime code (such as goroutines) and to pretty print the built-in map, slice and channel types.

(gdb) p var
Known issue: GDB can’t automatically find the dynamic type of an interface value if its long name differs from its short name (annoying when printing stacktraces, the pretty printer falls back to printing the short type name and a pointer).

(gdb) info goroutines
(gdb) goroutine n cmd
(gdb) help goroutine
For example:

(gdb) goroutine 12 bt
You can inspect all goroutines by passing

(gdb) goroutine all bt
Launch GDB, debugging regexp.test:

$ gdb regexp.test
GNU gdb (GDB) 7.2-gg8
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv  3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
Type "show copying" and "show warranty" for licensing/warranty details.
This GDB was configured as "x86_64-linux".

Reading symbols from  /home/user/go/src/regexp/regexp.test...
done.
Loading Go Runtime support.
(gdb)
Since slices, arrays and strings are not C pointers, GDB can't interpret the subscripting operation for you, but you can look inside the runtime representation to do that (tab completion helps here):

(gdb) p slc
$11 =  []int = {0, 0}
(gdb) p slc-><TAB>
array  slc    len
(gdb) p slc->array
$12 = (int *) 0xf84057af00
(gdb) p slc->array[1]
$13 = 0
If for some reason GDB still can't find that directory or that script, you can load it by hand by telling gdb (assuming you have the go sources in ~/go/):

(gdb) source ~/go/src/runtime/runtime-gdb.py
Loading Go Runtime support.
Interfaces are represented in the runtime as a pointer to a type descriptor and a pointer to a value. The Go GDB runtime extension decodes this and automatically triggers pretty printing for the runtime type. The extension function $dtype decodes the dynamic type for you (examples are taken from a breakpoint at regexp.go line 293.)

(gdb) p i
$4 = {str = "cbb"}
(gdb) whatis i
type = regexp.input
(gdb) p $dtype(i)
$26 = (struct regexp.inputBytes *) 0xf8400b4930
(gdb) iface i
regexp.input: struct regexp.inputBytes *

Recommend

Bootstrap Components Creating your own

Bootstrap Components Responsive

Bootstrap Components Modifiers

Bootstrap Optimize Lean JavaScript Default Exports

Bootstrap Optimize Lean JavaScript

Bootstrap Optimize Lean Sass imports

Bootstrap CSS variables Examples

Bootstrap CSS variables Root variables

Bootstrap Sass Mixins Color schemes

Bootstrap Sass Functions Add and Subtract functions

Bootstrap Sass Functions Color contrast

Bootstrap Sass Functions Colors

Bootstrap Sass Maps and loops Remove from map

Bootstrap Sass Maps and loops Add to map

Bootstrap Sass Maps and loops Modify map

Bootstrap Sass Variable defaults

Bootstrap Sass Importing

Bootstrap Sass File structure

Bootstrap Color Generating utilities

Bootstrap Color Color Sass maps Example

Bootstrap Color Color Sass maps

Bootstrap Color Theme colors

Bootstrap JavaScript Sanitizer

Bootstrap JavaScript Version numbers

Bootstrap JavaScript No conflict (only if you use jQuery)

Bootstrap JavaScript Programmatic API Default settings

Bootstrap JavaScript Programmatic API Asynchronous functions and transitions

Bootstrap JavaScript Programmatic API CSS selectors in constructors

Bootstrap JavaScript Programmatic API

Bootstrap JavaScript jQuery events

Bootstrap JavaScript Events

JavaScript Using Bootstrap as a module

Bootstrap Browsers and devices Supported browsers

Bootstrap Accessibility Overview and limitations Visually hidden content

Bootstrap Webpack and bundlers Importing Styles Importing Compiled CSS

Bootstrap Webpack and bundlers Importing Styles Importing Precompiled Sass

Bootstrap Webpack and bundlers Importing JavaScript

Contents Bootstrap source code

Contents Precompiled Bootstrap

Bootstrap Parcel Build app Build app files

Bootstrap Parcel Build app Run dev script

Bootstrap Parcel Build app Edit package.json

Bootstrap Parcel Build app

Bootstrap Parcel Importing JavaScript

Parcel Install Bootstrap

Bootstrap Download Package managers NuGet

Bootstrap Download Package managers Composer

Bootstrap Download Package managers RubyGems

Bootstrap Download Package managers yarn

Bootstrap Download Package managers npm

Bootstrap Download CDN via jsDelivr

Bootstrap Introduction Important globals Box-sizing

Bootstrap Introduction Important globals Responsive meta tag

Bootstrap Introduction Important globals HTML5 doctype

Bootstrap Introduction Starter template

Bootstrap Introduction Quick start JS Separate

Bootstrap Introduction Quick start JS Bundle

Bootstrap Introduction Quick start CSS

Bootstrap RTL Customize from source LTR and RTL at the same time

Bootstrap RTL Customize from source Alternative font stack

Bootstrap RTL Customize from source Custom RTL values

Bootstrap RTL Required HTML Starter template

Bootstrap RTL Required HTML

Bootstrap RFS Using RFS Using the functions

Bootstrap RFS Using RFS Using the mixins

Bootstrap Interactions Sass Utilities API

Bootstrap Interactions Pointer events

Bootstrap Interactions Text selection

Bootstrap Shadows Sass Utilities API

Bootstrap Shadows Examples

Bootstrap Display property Sass Utilities API

Bootstrap Display property Display in print

Bootstrap Display property Hiding elements

Bootstrap Display property Examples

Bootstrap Position Sass Utilities API

Bootstrap Position Sass Maps

Bootstrap Position Examples

Bootstrap Position Center elements