为什么我没有使用gdb(报告错误)来调试windows环境中的golang

时间:2017-07-11 04:39:52

标签: windows go gdb

我正在使用windows环境开发golang。

我用mingw安装gdb7.6。路径为C:\Mingw\bin,我将其附加到Windows环境。

我制作golang项目,并构建它。

最后路径和文件是:

D:\go_code\gdb\src>ls
gdb.go  src.exe

我使用gdb。

D:\go_code\gdb\src>gdb src  
GNU gdb (GDB) 7.6.1  
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 "mingw32".  
For bug reporting instructions, please see:  
<http://www.gnu.org/software/gdb/bugs/>...  
"D:\go_code\gdb\src/src.exe": not in executable format: File format not   recognized  
(gdb)  

它说,src.exe不是可识别的格式。为什么呢?

所以我看看go-gdb的指南,它说:

  

使用(gdb)源C:\ Go \ src \ runtime \ runtime-gdb.py

我按照这个要做。但是仍然会出现错误:

(gdb) source C:\Go\src\runtime\runtime-gdb.py  
C:\Go\src\runtime\runtime-gdb.py:5: Error in sourced command file:  
Undefined command: "".  Try "help".  
(gdb) 

为什么?

我在windows中安装了python3.6,并在windowns环境中添加它。

我真的不知道要解决它。

1 个答案:

答案 0 :(得分:0)

Delve是go编程语言的调试器,可用于调试Golang代码。