How to attach IntelliJ Go debugger to local process

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

How to attach IntelliJ Go debugger to local process

问题

我正在使用IntelliJ IDEA和Go插件编写Go代码。我正在处理一个使用gocui的项目,但它在IntelliJ控制台窗口中无法工作。所以我从控制台运行我的程序。

我该如何将这个很棒的IntelliJ调试器附加到在IntelliJ之外(在我的控制台中)运行的进程上?我尝试了运行->附加到本地进程,但它显示了一个空白框。

英文:

I'm coding in Go using IntelliJ IDEA with Go plugin. I am working on a project that uses gocui, which doesn't work in IntelliJ console window. So I run my program from console.

How can I attach this wonderful IntelliJ debugger to the process that runs outside IntelliJ (in my console)? I tried run -> attach to local process, but it showed an empty box.

1: https://github.com/jroimartin/gocui "gocui"

答案1

得分: 1

很抱歉,目前插件不支持这个功能。你可以在这里跟踪相关请求:https://github.com/go-lang-plugin-org/go-lang-idea-plugin/issues/620

然而,请注意,delve不支持在Windows上附加到正在运行的进程(如果你使用的是Windows操作系统)。

你也可以在这里跟踪相关请求:https://youtrack.jetbrains.com/issue/GO-620,适用于Gogland。

如果我找到一种方法可以帮助你从IDE中运行应用程序,以便你可以更轻松地进行调试,我会更新这个信息。

英文:

Unfortunately right now the plugin does not support this feature. You can track the request for it here: https://github.com/go-lang-plugin-org/go-lang-idea-plugin/issues/620

However, be warned that delve does not support attaching to a running process on Windows (in case that's your OS).

You can also track the request here: https://youtrack.jetbrains.com/issue/GO-620 for Gogland.

I'll update this in case I find a way to help you run the app from the IDE instead so that you can debug it easier.

答案2

得分: 0

我偶然发现了一个小技巧,可以让我在IntelliJ的普通控制台中运行我的应用程序。只需从控制台中运行IntelliJ,然后如果我运行(或调试)我的应用程序,它会在那个控制台中打开。

英文:

I discovered by accident one trick that allows to run my application in normal console from IntelliJ. Simply run IntelliJ from a console. Then, if I run (or debug) my application, it opens in that console.

huangapple
  • 本文由 发表于 2017年2月23日 23:13:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/42419581.html
匿名

发表评论

匿名网友

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

确定