Delve

Debugging tests with delve

有些话、适合烂在心里 提交于 2020-01-12 07:29:11
问题 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 ? 回答1: Use dlv test: $ dlv test -- -test.v Type 'help' for list of commands. (dlv) continue === RUN TestReadFileError --- PASS: TestReadFileError (0.00s) === RUN TestReadFile --- PASS: TestReadFile (0.00s) [..] PASS Process 8014 has exited with status 0 (dlv) quit Process 8014

Unable to debug Go code: could not launch process: decoding dwarf section info at offset 0x0: too short

≡放荡痞女 提交于 2019-12-24 10:39:52
问题 we are trying to debug Go code and getting this error: could not launch process: decoding dwarf section info at offset 0x0: too short our settings: WITSC02X6385JGH:orderer sjain68$ uname -a Darwin WITSC02X6385JGH 17.7.0 Darwin Kernel Version 17.7.0: Fri Jul 6 19:54:51 PDT 2018; root:xnu-4570.71.3~2/RELEASE_X86_64 x86_64 WITSC02X6385JGH:orderer sjain68$ go version go version go1.11 darwin/amd64 WITSC02X6385JGH:orderer sjain68$ dlv version Delve Debugger Version: 1.1.0 Build: $Id:

Remote debugging - Unverified breakpoint

做~自己de王妃 提交于 2019-12-19 09:56:19
问题 Hope I can explain this right. Update: I can confirm that dlv debug -l 127.0.0.1:2345 does work. Therefore I must be in VsCode launch.json Update: removed the panic. There was a different in go versions. Now the debugger in VsCode is just not working, it says "Unverified breakpoint". But it works fine if I use dlv from terminal, if I am in the folder with the code. I am trying to remote debug with this sample code. It works with this change. Do you know what to do? I have tried to change the

vscode debug issues with Delve

梦想与她 提交于 2019-12-12 10:44:30
问题 When I am debugging Go Lang code in visual studio code the below error message occured: 2018/04/03 18:19:32 server.go:73: Using API v1 2018/04/03 18:19:32 debugger.go:98: launching process with args: [$GOPATH/src/about/debug] could not launch process: EOF Process exiting with code: 1 回答1: I tried below scenario and It worked.. sudo rm -rf /Library/Developer/CommandLineTools then go to page https://developer.apple.com/download/more/ download and install previous version Command Line Tools

unable to run delve in eclipse che - could not launch process, operation not permitted

五迷三道 提交于 2019-12-12 04:47:29
问题 I am trying to use delve in Eclipse Che Running Eclipse Che in docker with --privileged is not helping docker run -it --privileged --rm -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/data eclipse/che start When running dlv debug main.go I get could not launch process: fork/exec /projects/desktop-go-simple/debug: operation not permitted Can you run dlv debugger in Eclipse Che 回答1: Adding --privileged adds capabilities to Eclipse Che CLI only. Instead of that add CHE_DOCKER_PRIVILEGED

golang dlv unable to see source:: no such file or directory

人盡茶涼 提交于 2019-12-11 07:51:00
问题 In a docker container: docker run \ --rm -it \ -p 80:80 \ -p 2345:2345 \ -v $(pwd)/src:/go/src/ \ --security-opt="seccomp=unconfined" \ --privileged \ --cap-add SYS_PTRACE \ golang bash In the container at $GOPATH: go get -u github.com/derekparker/delve/cmd/dlv dlv version Delve Debugger Version: 1.1.0 Build: $Id: 1990ba12450cab9425a2ae62e6ab988725023d5c dlv debug app --headless --listen=0.0.0.0:2345 --api-version=2 In mac terminal at $GOPATH:: dlv version Delve Debugger Version: 1.1.0 Build:

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

做~自己de王妃 提交于 2019-12-06 15:42:12
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. Thanks! I am using the GoLand debugger. Martin Tournoij As far as I know, there is no built-in way to do this in the manner you described. But you can do more or less the same using build tags to indicate that the delve debugger is running. You can pass build tags to dlv with the --build-flags argument. This is basically the same technique as I described in

dlv进行debug时报_cgo_export.c:3:10: fatal error: stdlib.h: No such file or directory错误

与世无争的帅哥 提交于 2019-12-04 20:47:21
环境模拟 使用docker启用golang的调试环境,镜像使用golang:1.13.4-alpine3.10 启用调用环境: docker run -d --name golang-debug golang:1.13.4-alpine3.10 sleep 1d 进入容器: docker exec -it golang-debug sh 安装git和dlv apk add git go get -u github.com/derekparker/delve/cmd/dlv cd $GOPATH git clone project_ repository_url 开始调试debug dlv debug ./main.go 报错 解决方法 apk add musl-dev 来源: https://my.oschina.net/jennerlo/blog/3130875

Debugging tests with delve

陌路散爱 提交于 2019-12-03 12:42:33
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 ? Martin Tournoij Use dlv test : $ dlv test -- -test.v Type 'help' for list of commands. (dlv) continue === RUN TestReadFileError --- PASS: TestReadFileError (0.00s) === RUN TestReadFile --- PASS: TestReadFile (0.00s) [..] PASS Process 8014 has exited with status 0 (dlv) quit Process 8014 has exited with status 0 You can also pass -test.run to select tests to run (just like go

Remote debugging - Unverified breakpoint

北慕城南 提交于 2019-12-02 02:12:34
Hope I can explain this right. Update: I can confirm that dlv debug -l 127.0.0.1:2345 does work. Therefore I must be in VsCode launch.json Update: removed the panic. There was a different in go versions. Now the debugger in VsCode is just not working, it says "Unverified breakpoint". But it works fine if I use dlv from terminal, if I am in the folder with the code. I am trying to remote debug with this sample code. It works with this change. Do you know what to do? I have tried to change the launch.json to "program": "${workspaceRoot}", to include the path like "program": "${workspaceRoot}/src