Debug Golang code and attach it to local process - debugging

Im having a Golang code which I create from it binary for mac via go build
like:
build darwin amd64 myapp
Currently Im able to run the binary and see the logs.
Now I want to debug it , is there a way to debug the binary with Goland or Intellij or VSCode ? regular debug with delve is working from all the IDE's above but now I want to attach it to the binary process which I was able to run,Any idea if it possible?

If you use GoLand 2018.1+ you should be able to use the Run | Attach to Local Process feature and it will allow you to debug a running binary.
I suggest that you compile the binary with all the optimizations turned off and compiled with Go 1.10+ in order to get the best debugging experience.
Furthermore, the IDE can launch the binary and debug it in a single click, removing the need to perform multiple steps.
One last issue that I can mention is that you currently will not be able to correctly debug Go apps via Delve, so regardless of which editor you use, due to a bug introduced by Apple in the latest developer tools. For more information please see the issue on our tracker: https://youtrack.jetbrains.com/issue/GO-5527 and on Delve's tracker: https://github.com/derekparker/delve/issues/1165
Edit:
The issue mentioned above was resolved in GoLand 2018.1.1.

Related

How to compile the Prometheus UI static binary for Windows?

I am trying to Access GCP Managed Prometheus metrics from Grafana on Windows, for which I need to compile a Windows static binary for the Prometheus UI Frontend so that I can use it as an authentication proxy for Grafana.
I have downloaded the Go source from GitHub as well as Go for Windows v1.19.3.
Running go run main.go resulted in a bunch of errors similar to the following:
main.go:43:2: no required module provides package github.com/GoogleCloudPlatform/prometheus-engine/pkg/ui; to add it:
go get github.com/GoogleCloudPlatform/prometheus-engine/pkg/ui
I whittled these down by running the go get commands as indicated. One such command resulted in a further complaint about git being unavailable, so I added the Windows binary for that as well to the PATH and proceeded with the process. Ultimately however I'm left with the following error:
D:\Go>go get github.com/GoogleCloudPlatform/prometheus-engine/pkg/ui
go: github.com/GoogleCloudPlatform/prometheus-engine/pkg/ui: no matching versions for query "upgrade"
A web search for the error hasn't been of much help. Suspecting some sort of version conflict I've tried with Go v1.18.8 as well, but that results in the same error. Since I'm simply Going about this blindly, having zero prior experience with Go, I'd really appreciate some help in this matter.

golang breakpoints not work in intellij idea 2016.1.1

I was debugging a GoLang program. I set break points and run the debugger. But the break points only works the first time I run the debugger and failed in the second, the third, and all following debugging whatever I do. I cancelled them and reset them, I close the debugging window and open a new one, I change the settings in the "Breakpoints" tool window. All these didn't work at all.
What's the problem?
Update, this has been fixed in the latest release of the plugin, please check it out
This is a well known problem and it lies in delve not the plugin itself. Please see this this issue for further reference.

Debugging cucumber steps in WebStorm

I'm experimenting with Cucumber/WebdriverIO UI tests using Webstorm (NodeJs platform). At certain steps I would really love to stop it in debug mode, check the retrieved element and see what can I do with it.
But unfortunately the Debug button is disabled and I couldn't find anything specific in Webstorm documentation as well.
If I can achieve my original goal (stopping a step and experimenting with the elements) without using Webstorm's Debug mode, that's totally fine for me.
Debugging Cucumber specs is not currently supported, please vote for WEB-15146
I'm not sure how this would work with Cucumber but WebdriverIO now has a debug command you can use

IDEA 13 community can't debug Haxe

I use the IDEA13 community to work with the Haxe openFL. I had installed the Haxe plugin. I create a haxe project. I can run it with any target, such as Flash,HTML5, mac and so on. But I can't debug it with any target platform. To my surprise, I even not see the red point after I click the IDEA side which would appear a red point when I do the same in a java project.
Then I tried to use debug icon button to debug it. But nothing show me after the compile complete.
Can anybody know whether the IDEA13 support to debug Haxe project? if can, how can I set?
I need help.
I wish everyone goes well.
Unfortunately the community plugin does not provide debugging for all the targets.
Currently only flash and an experimental cpp debugger(tivo fork) are the only implementations provided.
For html5 the plugin requires work to integrate with idea's javascript debugger. You can however use the Haxe generated source maps for break points on Haxe source code within the chrome developer tools.
There is activity for this plugin on github so it may just be a matter of time.

Making Android NDK apps with NativeActivity?

I know that in a normal NDK build, the C++ libraries are built and packed into an apk file. But how can I automate this in Eclipse? I have tried following http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/ to run the native-activity sample that came with the NDK, and it ended up not working. Even after I got past most of the reference errors via including, nothing happens when I run it as an Android Application (with a Motorola phone plugged in).
I have looked around quite a bit about this and am still stuck, so I'm open to suggestions at this point. Thanks!
(Please keep in mind that I'm using MinGW/MSys on Windows 7, mostly for running scripts with bash)
I've just decided to go with an Ubuntu VM and use that, and with some tweaking it seems to be working the way it should. I used a combination of http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/ and http://developer.android.com/sdk/ndk/overview.html#native-activity to get everything set up. Also a very important note, go to C/C++ General -> Code Analysis -> Launching in your Eclipse project settings and disable both of those options for any native activities you make. I'm not sure if there's a good way to set the libs and includes up for it to work, but currently live bug checking screws things up in the NDK, and I can currently build successfully without it. Plus it'll still mark errors in red after a failed build, so you shouldn't be completely in the middle of nowhere when finding errors.

Resources