Questions tagged [delve]

Delve is a debugger for Go

Delve is a debugger for the Go. Most Go editors/IDEs use delve as the backend for their debugger features.

Homepage.

201 questions
37
votes
4 answers

How do I print the full value of a string variable in delve?

I'm using the delve go debugger to debug some code. When I try to print a string variable, it gives me an abbreviated version. (dlv) print myString "my string...+539 more" How do I get it to print the full string?
Alex Altair
  • 3,246
  • 3
  • 21
  • 37
35
votes
6 answers

How to use Delve debugger in Visual Studio Code

I have installed the Go extension for VS Code, but unable to make it work. "dlv debug" works alright from the terminal. dlv debug src/github.com/user/hello The launch.json: { "version": "0.2.0", "configurations": [ { …
Chris G.
  • 23,930
  • 48
  • 177
  • 302
24
votes
2 answers

How do I setup VScode debug session for Golang and AppEngine?

VScodeDebugGoAppEngine Hello World tutorial that shows how to setup VS Code to debug Golang App Engine code with Visual Studio (aka VScode ) This is using using the Helloworld code from AppEngine documentation: go get -u -d…
BryanWheelock
  • 12,146
  • 18
  • 64
  • 109
24
votes
2 answers

Debugging tests with delve

I'm using "go test -v" to run bunch of unit tests. I'd like to debug them using delve. When I try to run debugger, I get an "Can not debug non-main package" error. So, how can I debug unit tests using delve debugger ?
SpiderRico
  • 1,890
  • 8
  • 28
  • 48
24
votes
2 answers

How can I set breakpoints by the sourcefile line number in Delve?

The title pretty much says it all. The only way I know how to set one is either during the runtime of the program or just before with breakpoint main.main Is there a way I can do this by line number like breakpoint ./otherfile.go:200?
benbot
  • 1,217
  • 1
  • 12
  • 28
15
votes
2 answers

how to debug goroutine in vscode?

consider the small snippet below: package main import ( "fmt" "sync" ) func main() { var wg sync.WaitGroup wg.Add(2) go func() { defer wg.Done() for i := 1; i < 100; i++ { fmt.Println("A:", i) …
newbieee
  • 193
  • 1
  • 4
13
votes
1 answer

Passing arguments to executable when debugging with Delve

I would like to pass arguments to the binary file when executing it with dlv dlv --listen=:5432 exec /mypath/binary --config=config.toml But when I am doing it I get following error: Error: unknown flag: --config How can I pass arguments to binary…
Rudziankoŭ
  • 10,681
  • 20
  • 92
  • 192
12
votes
1 answer

Unable to stop dlv debug --headless again - running in a docker container on mac

How do you stop delve headless debugger? Note: I am runningthis from a docker container on mac, and installed like this: go get -u github.com/derekparker/delve/cmd/dlv From this it starts ok, but how do you stop it again. dlv debug --headless…
Chris G.
  • 23,930
  • 48
  • 177
  • 302
11
votes
5 answers

How can I see if the GoLand debugger is running in the program?

In C# the executing program can detect if it's running in the debugger using: System.Diagnostics.Debugger.IsAttached Is there an equivalent in Go? I have some timeouts which I would like to be disabled while I am stepping through the code.…
Philip Beber
  • 1,115
  • 12
  • 18
10
votes
2 answers

Cannot Install Delve Go Debugger on Mac

I am trying to follow along with the following YouTube video on getting started with Go Debugging. It recommends following the Delve installation instructions on the official Delve github repo. For Mac users, they are as follows: Making sure the…
HMLDude
  • 1,547
  • 7
  • 27
  • 47
10
votes
2 answers

Debugging Go code in Visual Studio Code WSL

I have a Visual Studio Code environment with the Linux Subsystem for windows running and it's compiling and running a Go project just fine. Now I'm trying to get the delve debugger running following this…
Serve Laurijssen
  • 9,266
  • 5
  • 45
  • 98
9
votes
2 answers

error obtaining vcs status when running delve as root

I am trying to run sudo dlv debug on Arch Linux and I keep getting following error: error obtaining VCS status: exit status 128 Use -buildvcs=false to disable VCS stamping. exit status 1 When I remove the .git folder, sudo dlv debug runs as…
doemsche
  • 892
  • 2
  • 12
  • 25
9
votes
2 answers

Unable to Call Function in Go debugger

I am following the "Little Go Book" by Karl Seguin, in order to learn Go. My working environment is Visual Studio Code. Upon debugging, when I try to call a function from the debug console, i get the following error: "function calls not allowed…
Elie Asmar
  • 2,995
  • 4
  • 17
  • 30
9
votes
1 answer

Why doesn't my Go debugger load all symbols, causing local variables to be missing from the debugger?

I've built my binary with: go build -gcflags "$gc_flags" -o ./bin/grafana-server ./pkg/cmd/grafana-server, where $gc_flags is '-N -l'. When I run this file, ./bin/grafana-server, and attach to it in my debugger (Goland), not all of my symbols are…
MrDuk
  • 16,578
  • 18
  • 74
  • 133
9
votes
4 answers

fork/exec ./debug: operation not permitted

My goal is to be able to remote debug from Atom.io. into a docker container running go in dlv debugger. This is the first problem: Update:1. I am running Docker container on a mac, but that should not influence the code signing thing as I am running…
Chris G.
  • 23,930
  • 48
  • 177
  • 302
1
2 3
13 14