未定义的信息命令:”goroutines”

huangapple go评论80阅读模式
英文:

Undefined info command: "goroutines"

问题

我是你的中文翻译助手,以下是翻译好的内容:

我对golang还不熟悉。我正在调试我的go应用程序。

当我尝试运行"info goroutines"时,它报错:

未定义的info命令:"goroutines"。
尝试"help info"。

我在我的gdb配置中漏掉了什么?

英文:

I'm new to golang. I was debugging my go application.

While I tried to run "info goroutines", it threw out:

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

What did I miss in my gdb configuration?

答案1

得分: 2

文章《使用GDB调试Go代码》提到:

(gdb)info goroutines

但只是在加载给定二进制文件的扩展脚本的上下文中提到。

工具链使用此功能来扩展GDB,以便检查运行时代码(如goroutines)的内部,并对内置的map、slice和channel类型进行漂亮的打印。

如果你想看看这是如何工作的,或者想要扩展它,请查看Go源代码分发中的src/pkg/runtime/runtime-gdb.py。它依赖于一些特殊的魔术类型(hash<T,U>)和变量(runtime.mruntime.g),链接器(src/cmd/ld/dwarf.c)确保在DWARF代码中描述了它们。

如果你对调试信息的样子感兴趣,运行'objdump -W 6.out'并浏览.debug_*部分。

因此,请确保在调试会话中启用这些扩展。

英文:

The article "Debugging Go Code with GDB" does mention:

(gdb) info goroutines

But only in the context of loading extension scripts for a given binary.

> The tool chain uses this to extend GDB with a handful of commands to inspect internals of the runtime code (such as goroutines) and to pretty print the built-in map, slice and channel types.

> If you'd like to see how this works, or want to extend it, take a look at src/pkg/runtime/runtime-gdb.py in the Go source distribution.
It depends on some special magic types (hash&lt;T,U&gt;) and variables (runtime.m and runtime.g) that the linker (src/cmd/ld/dwarf.c) ensures are described in the DWARF code.

> If you're interested in what the debugging information looks like, run 'objdump -W 6.out' and browse through the .debug_* sections.

So make sure your debug session is run with those extensions activated.

答案2

得分: 0

在gdb会话中运行以下命令:

source $GOROOT/src/runtime/runtime-gdb.py

其中$GOROOT是Go的安装路径(可以使用go env | grep ROOT查看)。

根据Golang文档的建议,你应该使用https://github.com/go-delve/delve作为调试工具。

英文:

in the gdb session run

source $GOROOT/src/runtime/runtime-gdb.py

where $GOROOT is go lives (see go env | grep ROOT)

you should use https://github.com/go-delve/delve as recommended by golang docs https://golang.org/doc/gdb

huangapple
  • 本文由 发表于 2014年11月7日 16:59:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/26797527.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定