英文:
Cannot get gdb working for Go 1.3 program
问题
(gdb) info goroutines
Python异常<class 'gdb.error'>
尝试提取一个不是(null)的值的组件:
在Python命令中发生错误:
尝试提取一个不是(null)的值的组件。
版本:
GDB:7.7.1
Python:3.4.1
操作系统:CentOS 6.5 x86_64
英文:
(gdb) info goroutines
Python Exception <class 'gdb.error'>
Attempt to extract a component of a value that is not a (null).:
Error occurred in Python command:
Attempt to extract a component of a value that is not a (null).
Version:
GDB: 7.7.1
Python: 3.4.1
OS: CentOS 6.5 x86_64
答案1
得分: 0
从http://golang.org/doc/gdb中:
> GDB对Go程序的理解不够好。堆栈管理、线程和运行时包含的方面与GDB期望的执行模型有足够的差异,这可能会使调试器混淆,即使程序是使用gccgo编译的。因此,尽管在某些情况下GDB可能有用,但它不是Go程序的可靠调试器,尤其是在涉及大量并发的情况下。此外,解决这些问题对于Go项目来说并不是优先事项,因为这些问题很难解决。简而言之,下面的说明只应作为在GDB正常工作时如何使用的指南,而不是成功的保证。
还可以查看issue 7796
还有一个名为hopwatch的工具,它不像GDB,你需要在代码中自己添加断点。
英文:
From http://golang.org/doc/gdb:
> GDB does not understand Go programs well. The stack management,
> threading, and runtime contain aspects that differ enough from the
> execution model GDB expects that they can confuse the debugger, even
> when the program is compiled with gccgo. As a consequence, although
> GDB can be useful in some situations, it is not a reliable debugger
> for Go programs, particularly heavily concurrent ones. Moreover, it is
> not a priority for the Go project to address these issues, which are
> difficult. In short, the instructions below should be taken only as a
> guide to how to use GDB when it works, not as a guarantee of success.
Also check issue 7796
There's http://ernestmicklei.com/2012/12/14/hopwatch-a-debugging-tool-for-go/, which isn't like gdb, you have to add breakpoints yourself in the code.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论