How to Use Intellij idea14.0.2 to Debug the golang?

huangapple go评论91阅读模式
英文:

How to Use Intellij idea14.0.2 to Debug the golang?

问题

调试按钮被禁用,按下Shift+Alt+F9将显示如下内容:

How to Use Intellij idea14.0.2 to Debug the golang?

如何正确配置调试页面?

How to Use Intellij idea14.0.2 to Debug the golang?

英文:

The Debug button is disable, <kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>F9</kbd> will show this:

How to Use Intellij idea14.0.2 to Debug the golang?

How to properly configure the debug page?

How to Use Intellij idea14.0.2 to Debug the golang?

答案1

得分: 10

更新。自2015年9月起,Go插件在Linux和Mac上支持Delve,在2016年1月起在Windows上支持Delve。

原始答案:

目前,我们正在放弃对gdb调试器的支持,因为它非常难以使用且不稳定。请参阅Go文档中关于gdb调试的内容。

然而,正在努力使开源的Delve调试器支持IDE,这也将使IDEA受益。

请向Go团队提出请求,支持Delve或其他调试器,以获得稳定的解决方案,然后可以进行与IDEA的集成。

英文:

Update. The Go plugin supports Delve on Linux and Mac since September 2015 and on Windows since January 2016.

Original answer:

Currently we are dropping support for the debugger with gdb as it's very hard to use and unstable. Please see the go docs for gdb debugging

However, there are efforts in getting the open-source Delve debugger support for IDEs from which IDEA will benefit as well.

Please bug the Go team to support Delve or another debugger in order to have a stable solution and then integration with IDEA could be done.

答案2

得分: 3

你好,以下是翻译好的内容:

感谢,问题已解决。
Intellij配置不正确。

图片链接:点击这里
GitHub链接:点击这里

英文:

How to Use Intellij idea14.0.2 to Debug the golang?

thanks ,solved it.
Intellij Config is not right

答案3

得分: 1

调试功能是通过问题25提交3a21e14引入的。

> 正确的方法是在IntelliJ中实现调试器接口,并将其连接到正在运行的gdb进程中。

(这是一个手动调用gdb调试Go程序的示例;使用选项-c -gcflags '-N -l':不确定-l是否重要,因为它在OP的截图“Go builder arguments”中缺失)

如果没有为Go调试进程配置gcc,则可能会禁用调试按钮。

还要注意自PR 644以来:

> 如果未启用“运行前构建”,则“调试”将被禁用。
这应该解决问题,当gdb想要运行一个不存在的可执行文件时,因为outputDir未设置。

英文:

The debug feature was introduced by issue 25, and commit 3a21e14

> The correct way is to implement the debugger interfaces in inteliij and to hook them to a running gdb process.

(Here is an example of manually calling gdb to debug a Go program; using the options -c -gcflags &#39;-N -l&#39;: not sure if the -l would matter as it is missing from the OP's screenshot "Go builder arguments")

It is possible the debug button is disabled if no gcc is configure for the Go debug process to use.

Note also that since PR 644:

> "Debug" is disabled, if "Build Before run" is not enabled.
This should fix the problem, when gdb wants to run a not existing executable, because the outputDir is not set.

huangapple
  • 本文由 发表于 2015年1月23日 14:53:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/28104508.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定