Go語言gdb調試踩坑

來源:互聯網
上載者:User

標籤: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調試踩坑

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.