log
logrus
gdb
GOTRACEBACK
SIGABRT
log
logrus
GODEBUG
log
Flags
to include source linelog
examplelogrus
logrus
examplego build -gcflags "-N -l"
to disable optimizationsgo test -gcflags "-N -l" -c
to have Go compile the test, but not run itgdb -d $(go env GOROOT) <your binary>
objdump -h
readelf -w
GOROOT
)list
Print next 10 source linesbreak
break <file.go line>
Insert breakpoint in file.go
at line line
break <p.Func>
Insert breakpoint at function Func
of package p
bt
Print backtracecontinue
Continue to next break pointstep
Run until next source linenext
Run until next source line in the same stack frameinfo args
Show function argumentsinfo locals
Show local variablesp <variable>
Print variable value<slc>->array[<x>]
print element x
of slc
whatis <variable>
Print type of variableinfo goroutines
Print goroutinesgoroutine <n> <cmd>
Execute cmd
in the context of goroutine n
$len()
Gets len$cap()
Gets capacity$dtype()
Get underlying type of interface valueBUILDARGS
to -gcflags "-N -l"
GOTRACEBACK
: Dump stack traces when Go program encounters unrecovered panic or unexpected runtime condition0
: no stack traces1
: dump user goroutines backtrace (default)2
: dump run time and user goroutines backtracecrash
: dump user and run time goroutines and crash in OS specific manner (core dump)SIGABRT
to a running processgdb -d $(go env GOROOT) -c core <your app>
-gcflags "-N -l"
to get debugging informationulimit -c
to non-zero valuelog
logrus
gdb
GOTRACEBACK
SIGABRT
Table of Contents | t |
---|---|
Exposé | ESC |
Full screen slides | e |
Presenter View | p |
Source Files | s |
Slide Numbers | n |
Toggle screen blanking | b |
Show/hide slide context | c |
Notes | 2 |
Help | h |