简体   繁体   English

调试Go with GDB时的奇怪行为

[英]Strange behavior when debugging Go with GDB

I have a Go program that I'm debugging using GDB (also Eclipse/Goclipse, but that uses GDB so it's all the same). 我有一个Go程序,我正在调试使用GDB(也是Eclipse / Goclipse,但它使用GDB,所以它都是一样的)。 Occasionally, when I tell GDB next , it acts like I told it to continue or finish . 偶尔,当我next告诉GDB时,它就像我告诉它continuefinish It's like there's missing stack/frame/etc information in the executable. 这就像可执行文件中缺少堆栈/帧/ etc信息一样。 Help? 救命?

gdb -v gives: gdb -v给出:

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. 版权所有(C)2013 Free Software Foundation,Inc。许可证GPLv3 +:GNU GPL版本3或更高版本http://gnu.org/licenses/gpl.html这是免费软件:您可以自由更改和重新分发它。 There is NO WARRANTY, to the extent permitted by law. 在法律允许的范围内,不提供任何担保。 Type "show copying" and "show warranty" for details. 输入“show copying”和“show warranty”了解详细信息。 This GDB was configured as "x86_64-apple-darwin13.1.0". 此GDB配置为“x86_64-apple-darwin13.1.0”。 For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/ . 有关错误报告说明,请参阅: http//www.gnu.org/software/gdb/bugs/

go -v gives: go -v给出:

go version go1.2.1 darwin/amd64 去版本go1.2.1 darwin / amd64

Both were installed with MacPorts under OSX.9 两者都在OSX.9下安装了MacPorts

It's not just OSX. 这不仅仅是OSX。 gdb doesn't really understand, and can't always follow goroutines, since they can be scheduled across OS threads. gdb并不真正理解,也不能总是遵循goroutines,因为它们可以跨操作系统线程进行调度。

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. GDB对堆栈跟踪和断点仍然有用,但是在可预见的将来,单步执行代码并不能可靠地工作。 There has been discussion on the golang dev mailing list about continually improving gdb versus abandoning it in favor of something new; golang dev邮件列表中有关于不断改进gdb而不是放弃它以支持新事物的讨论。 but no announcements have been made. 但没有发布任何公告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM