lloiser / go-debug

🐛 A go debugger for atom using delve.
https://atom.io/packages/go-debug
MIT License
388 stars 21 forks source link

buildFlags documentation #133

Closed Uplink03 closed 6 years ago

Uplink03 commented 6 years ago

I would like to use the following build flag:

-gcflags='-N -l'

Is there a way to add my flags to buildFlags to the configuration file as it is?

The buildFlags field is a string. I would expect it to be an array similar to args.

lloiser commented 6 years ago

go-debug just passes the buildFlags as --build-flags=... to delve.

Delve also uses a string for build flags: https://github.com/derekparker/delve/blob/678576d2ce3b14f7b6b59692669b8acbd7c427ff/cmd/dlv/cmds/commands.go#L93

Here is the documentation for it: https://github.com/derekparker/delve/blob/678576d2ce3b14f7b6b59692669b8acbd7c427ff/Documentation/usage/dlv.md#options

Uplink03 commented 6 years ago

OK, so now my config looks like this:

"buildFlags": "-gcflags='-N -l'"

and it seems to like it.

I thought that would help with stepping through code, but didn't. When I "step over" through code the current line jumps all over the place.

lloiser commented 6 years ago

Typically you don't need to provide any additional build flags because delve does that for you.

This is very often not a problem with go-debug but with delve itself. Try running delve from the command line using dlv debug or dlv test.

lloiser commented 6 years ago

As I said typically it is not required to pass custom build flags.

If you still think that this is an issue, try to debug your code from the command line using the dlv executable. Also try updating dlv using go get -u github.com/derekparker/delve/cmd/dlv.