我正在使用IntelliJIDEA15开发golang项目。事先我安装了GDB在mac上进行调试。然后我想在IntelliJIDEA上使用GDB调试golang项目。但是,我找不到如何做到这一点。有知道的请指教提前谢谢你。 最佳答案 从今天开始,不,你不能。然而,该插件集成了Delve,这使得Go应用程序的调试体验更好(如果你在Delve支持的平台上)。查看调试器链接:https://github.com/derekparker/delve一旦GDB正确支持Go应用程序,事情当然可能会改变。
示例文件src/test.gopackagemainimport(."clib")funcmain(){a:="123";b:="456";c:="789";println(a,b,c);Output("ABC");}src/clib/clib.h#ifndefCLIBvoidoutput(char*str);#endifsrc/clib/clib.c#include"clib.h"#includevoidoutput(char*str){printf("%s\n",str);}src/clib/clib.gopackageclib/*#cgoCFLAGS:-g#include"cli
示例文件src/test.gopackagemainimport(."clib")funcmain(){a:="123";b:="456";c:="789";println(a,b,c);Output("ABC");}src/clib/clib.h#ifndefCLIBvoidoutput(char*str);#endifsrc/clib/clib.c#include"clib.h"#includevoidoutput(char*str){printf("%s\n",str);}src/clib/clib.gopackageclib/*#cgoCFLAGS:-g#include"cli
我安装了LiteIDE和GDB。我在LiteIDE中打开了我的Go项目,并在代码中的某个点添加了一个断点。然后我切换回终端并运行应该调用断点的项目二进制文件,但什么也没发生。我究竟做错了什么? 最佳答案 您必须实际从IDE启动可执行文件,断点才能发挥作用。另外请记住,gdb对于Go1.3.x几乎毫无意义,对于1.4(dev)更是如此。来自https://golang.org/doc/gdb:GDBdoesnotunderstandGoprogramswell.Thestackmanagement,threading,andrunti
我安装了LiteIDE和GDB。我在LiteIDE中打开了我的Go项目,并在代码中的某个点添加了一个断点。然后我切换回终端并运行应该调用断点的项目二进制文件,但什么也没发生。我究竟做错了什么? 最佳答案 您必须实际从IDE启动可执行文件,断点才能发挥作用。另外请记住,gdb对于Go1.3.x几乎毫无意义,对于1.4(dev)更是如此。来自https://golang.org/doc/gdb:GDBdoesnotunderstandGoprogramswell.Thestackmanagement,threading,andrunti
例如我有这段代码http://play.golang.org/p/9U22NfrXeq//Aconcurrentprimesievepackagemain//Sendthesequence2,3,4,...tochannel'ch'.funcGenerate(chchan如何查看channel内的内容?例如我想调试这一行:prime:=在gdb中输入'pch'只会打印channel地址。如何获取内容? 最佳答案 你只需要取消引用ch。使用一个非常小的程序:packagemainfuncmain(){ch:=make(chanint,
例如我有这段代码http://play.golang.org/p/9U22NfrXeq//Aconcurrentprimesievepackagemain//Sendthesequence2,3,4,...tochannel'ch'.funcGenerate(chchan如何查看channel内的内容?例如我想调试这一行:prime:=在gdb中输入'pch'只会打印channel地址。如何获取内容? 最佳答案 你只需要取消引用ch。使用一个非常小的程序:packagemainfuncmain(){ch:=make(chanint,
我遇到gdb无法正确打印变量的问题。简单的程序是按以下方式构建的:chmurson-osx:helloworldchmurson$gobuild-gcflags'-N'start.go然后gdb执行:chmurson-osx:helloworldchmurson$gdbstart-d$GOROOTGNUgdb(GDB)7.8Copyright(C)2014FreeSoftwareFoundation,Inc.LicenseGPLv3+:GNUGPLversion3orlaterThisisfreesoftware:youarefreetochangeandredistributeit.
我遇到gdb无法正确打印变量的问题。简单的程序是按以下方式构建的:chmurson-osx:helloworldchmurson$gobuild-gcflags'-N'start.go然后gdb执行:chmurson-osx:helloworldchmurson$gdbstart-d$GOROOTGNUgdb(GDB)7.8Copyright(C)2014FreeSoftwareFoundation,Inc.LicenseGPLv3+:GNUGPLversion3orlaterThisisfreesoftware:youarefreetochangeandredistributeit.
在这个程序中,如何使用调试器中断执行并打印i的值?packagemainimport"fmt"funcmain(){x:="abc"i:=3fmt.Println(i)fmt.Println(x)}我无法打印i。但是我可以打印x:gobuildtest.gogdbtest[...]Readingsymbolsfrom/home/ned/test...done.(gdb)br9(gdb)run(gdb)piNosymbol"i"incurrentcontext.(gdb)px$1="abc" 最佳答案 这听起来像是变量i可能已被编译器