douyou3619
2014-06-04 21:32
浏览 60
已采纳

使用GDB调试Go时的奇怪行为

I have a Go program that I'm debugging using GDB (also Eclipse/Goclipse, but that uses GDB so it's all the same). Occasionally, when I tell GDB next, it acts like I told it to continue or finish. It's like there's missing stack/frame/etc information in the executable. Help?

gdb -v gives:

Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-apple-darwin13.1.0". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/.

go -v gives:

go version go1.2.1 darwin/amd64

Both were installed with MacPorts under OSX.9

图片转代码服务由CSDN问答提供 功能建议

我有一个Go程序,正在使用GDB(也是Eclipse / Goclipse,但使用GDB进行调试) 全部都一样)。 有时候,当我告诉GDB next 时,它的行为就像我告诉它 continue finish 。 就像可执行文件中缺少堆栈/框架/等信息。

gdb -v 提供帮助:

版权(C)2013自由软件基金会, Inc. 许可GPLv3 +:GNU GPL版本3或更高版本 http://gnu.org/licenses/gpl。 html 这是免费软件:您可以自由更改和重新分发它。 在法律允许的范围内,没有任何担保。 键入“显示复制” 和“显示保修”以获取详细信息。 此GDB配置为“ x86_64-apple-darwin13.1.0”。 有关错误报告的说明,请参见: http://www.gnu.org/software/gdb/bugs/ < / blockquote>

go -v 给出:

go版本go1.2.1 darwin / amd64

两者均已在OSX.9下与MacPorts一起安装

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongyingtang3803 2014-06-04 22:23
    已采纳

    It's not just OSX. gdb doesn't really understand, and can't always follow goroutines, since they can be scheduled across OS threads.

    You can always try to catch the execution again later with another breakpoint, but I don't think there's much else you can do.

    GDB is still useful for stacktraces and breakpoints, but stepping through code just isn't going to work reliably for the foreseeable future. There has been discussion on the golang dev mailing list about continually improving gdb versus abandoning it in favor of something new; but no announcements have been made.

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题