douba6365 2016-03-25 08:00 采纳率: 100%
浏览 93
已采纳

我如何使用gdb调试go测试

I have some go tests. I would like to debug with gdb.

But the binaries built by go test are thrown away after running.

So how do I do it?

go 1.6 on windows/64

  • 写回答

1条回答 默认 最新

  • ds34222 2016-03-25 08:10
    关注

    You use go test -c which will produce the executable file xyz.test. Afterwards you use gdb xyz.test to debug.

    Just check go test --help for an explanation of the -c flag:

    Compile the test binary to pkg.test but do not run it (where pkg is the last element of the package's import path). The file name can be changed with the -o flag.

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

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部