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的胖子
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
2021-04-24 缺页中断-copy