温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Go语言gdb调试踩坑

发布时间:2020-06-13 17:39:51 来源:网络 阅读:7000 作者:EDELWEISS_21g 栏目:编程语言

整个是一个docker环境

docker版本: 1.12.1,镜像是我自己做的基于ubuntu:14.04.05.

容器操作系统版本: Ubuntu 14.04.5 LTS

go版本: 1.6.3


gdb中执行run命令出错!

 

错误输出:

warning:Error disabling address space randomization: Operation not permitted

环境:docker

 

解决办法:

warning:Error disabling address space randomization: Operation not permitted

 

结论:

When running within a dockercontainer, I got this error until I added--security-optseccomp=unconfined to the dockerrun. – Cameron Taggart Jun 7 at 4:28

 

来自 <http://stackoverflow.com/questions/35860527/warning-error-disabling-address-space-randomization-operation-not-permitted>

 

 

info goroutines: Undefined info command:“goroutines”

错误输出:

(gdb)info goroutines

Undefinedinfo command: "goroutines". Try "help info".

 

相关资料:

  https://golang.org/doc/gdb

Undefinedinfo command: “goroutines”

Debugging Go Code with GDB

Text filesrc/runtime/runtime-gdb.py

 

结论:

使用GDB调试GO程序

http://www.cnblogs.com/guxuanqing/p/5638363.html

建立~/.gdbinit

add-auto-load-safe-path/usr/local/go/src/runtime/runtime-gdb.py                                                                          

setauto-load safe-path /                                                          

pythonsys.path.append("/usr/share/gdb/python")

 

/usr/local/go/src/runtime/runtime-gdb.py里面的gdb怎么搞出来的?

goobjfile= gdb.current_objfile() or gdb.objfiles()[0]

参看上个问题的结论

应该是把/usr/share/gdb/python里的东西加到sys.path里面去了


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI