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

使用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

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题