码迷,mamicode.com
首页 > 数据库 > 详细

Go语言gdb调试踩坑

时间:2016-12-24 23:27:27      阅读:2325      评论:0      收藏:0      [点我收藏+]

标签:go gdb docker

整个是一个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里面去了


本文出自 “马兵的博客” 博客,请务必保留此出处http://3732370.blog.51cto.com/3722370/1885740

Go语言gdb调试踩坑

标签:go gdb docker

原文地址:http://3732370.blog.51cto.com/3722370/1885740

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!