GDB debug. && GDB debug go && compiler
How do I print the full value of a long string in gdb?
set print elements 0
set print elements number-of-elements Set a limit on how many elements of an array GDB will print.
If GDB is printing a large array, it stops printing after it has printed the number of elements set by the set print elements command.
This limit also applies to the display of strings. When GDB starts, this limit is set to 200. Setting number-of-elements to zero means that the printing is unlimited.
-
info goroutines
:查看 goroutines 信息。在使用前 ,需要注意先执行 source /usr/local/go/src/runtime/runtime-gdb.py goroutine 1 bt
:查看指定序号的 goroutine 调用堆栈- go dev 文档
-
inspecting the source
Use the
"l"
or"list"
command to inspect source code.
通过b [file].[method]
方式进行断点标记,可以显示当前断点的源文件位置包含行号,也可以通过info breakpoints
查看断点信息
-ldflags 'flag list' '-s -w': 压缩编译后的体积 -s: 去掉符号表 -w: 去掉调试信息,不能gdb调试了
-gcflags=all="-N -l"
配置gdb (1) 打开gdb初始化配置文件 vim ~/.gdbinit (2) 增加一行,:wq!保存后退出 add-auto-load-safe-path /usr/local/go/src/runtime/runtime-gdb.py
例子:
SHELL := /bin/bash BASEDIR = $(shell pwd) BUILD_TIME=`date +%FT%T` GIT_REVISION=`git rev-parse --short HEAD` LDFLAGS=-ldflags "-X main.gBuildTime=${BUILD_TIME} -X main.gGitRevision=${GIT_REVISION}" -gcflags "-l -N" export GO111MODULE=on export CGO_ENABLED=0 export GOOS=linux export GOARCH=amd64 all: nps nps: rm -rf ./nps go build ${LDFLAGS} -o nps ./cmd/nps
http代理服务器(3-4-7层代理)-网络事件库公共组件、内核kernel驱动 摄像头驱动 tcpip网络协议栈、netfilter、bridge 好像看过!!!!
但行好事 莫问前程
--身高体重180的胖子