Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Better error message when non-signed Delve is installed #20

Closed
caledhwa opened this issue Nov 18, 2015 · 26 comments
Closed

Better error message when non-signed Delve is installed #20

caledhwa opened this issue Nov 18, 2015 · 26 comments
Assignees
Labels

Comments

@caledhwa
Copy link

I can

sudo dlv debug main.go

But no dice from VSCode. Any thoughts?

I did code sign dlv and all the dlv tools work as running sudo

Result

When using a main.go with a very simple 3 line program which outputs a string to stdout, a breakpoint can be set, but when running, the only feedback I get is that the debug bar shows and appears to be running, but the breakpoint isn't fired and the blue bar at the bottom of Code turns to orange.

@lukehoban
Copy link
Contributor

Yeah - dlv is invoked as a normal user, so if you have signed dlv such that it cannot be used as a normal user it will not work with the VS Code integration currently.

I'm not sure of options for working around this, other than distributing our owned signed binary along with the plugin.

Thoughts?

@mattetti
Copy link
Contributor

The first thing might be to not tell users to go get delve on this page: https://marketplace.visualstudio.com/items/lukehoban.Go It looks like the issue I'm encountering is due to the fact that I installed on OS X without noticing that I should be signing the binary. I'm also not getting any errors being reported or logs so it's a bit hard to understand what's wrong. I'll properly reinstall delve and see if it helps :)

@caledhwa
Copy link
Author

So, from the delve Wiki:

https://github.com/derekparker/delve/wiki/Building

Installing on Mac OSX, there really doesn't seem to be anything regarding USER here. So, the self-signing cert seemed to work. I wonder what I'd need to do differently to make this work.

Did you try this on Mac OS? Just curious... if others are having this experience. I also agree with @mattetti that I was almost drawn off by the go get.

@mattetti
Copy link
Contributor

Alright, so after reinstalling with the cert, everything looks good with the exception of my local variables not showing up (but hovering them in my code displays the values)

@caledhwa
Copy link
Author

So, uninstalling delve, what did you do? I feel like I did it right the first time, but then after it didn't work, I did the go get - maybe if I start over with that... @mattetti

@mattetti
Copy link
Contributor

@caledhwa I went into the delve repo that I go get'd, created a cert and used make install with the cert info to rebuild and reinstall delve.

@lukehoban
Copy link
Contributor

That's right - the instructions on installing Delve are here: https://github.com/derekparker/delve/wiki/Building. On OS X this requires creating a self-signed cert and then using that to CERT=dlv-cert make install.

I've modified the README to not suggest go get for Delve since that won't work on OS X.

I'll leave this open to track reporting a better error message when a non-signed dlv binary is installed.

@lukehoban lukehoban changed the title Debugging isn't working when I can't run dlv as normal user Better error message when non-signed Delve is installed Nov 21, 2015
@lukehoban
Copy link
Contributor

We're now reporting back the errors from Delve itself, so you'll get the same somewhat cryptic error that Delve provides to tell you that you don't have a signed dlv:

2015/11/21 18:51:15 debugger.go:56: launching process with args: [./debug]
could not launch process: could not fork/exec

That will be enough to easily search for the issue. I'll leave communicating this failure case more explicitly to Delve itself for now.

@caledhwa
Copy link
Author

Thanks for this! 👍 I just need to figure out what I did wrong when I signed Delve.

@lukehoban
Copy link
Contributor

FWIW - The most common issue I've seen has been accidentally missing this step:

In keychains select “System”, and you should find your new certificate. Use the context menu for the certificate, select “Get Info”, open the “Trust” item, and set “Code Signing” to “Always Trust”.

@shdatta
Copy link

shdatta commented Nov 28, 2015

I also got some errors while building delve. I had to do following to get additional packages and depenecies..(on Mac)
go get github.com/peterh/liner
go get github.com/spf13/cobra
go get gopkg.in/yaml.v1
go get golang.org/x/sys/unix
go get gopkg.in/yaml.v2

Then CERT=dlv-cert make install worked and I am able to debug the programs.

Looks like there are still some issues with adding variables to watch window ( or may be its user error). But glad to have gotten so far

@bruparel
Copy link

bruparel commented Dec 3, 2015

I am new to Go and Delve both, therefore, I am sure I am doing something wrong. I am on a Mac using OS X. I followed Derek's instructions for 'Building'. The last bullet item says:

Run the following: CERT=dlv-cert make install, which will install the binary and codesign it.

Which binary are we installing? When I ran the command at the command prompt in my home directory, I get the following response:

Bharat:~
→ CERT=dlv-cert make install
make: *** No rule to make target `install'. Stop.

I named my cert 'dlv-cert'.

Please help.

@lukehoban
Copy link
Contributor

@bruparel Sounds like you are not in the right directory. You need to be in the directory where you cloned https://github.com/derekparker/delve before you run make install.

@bruparel
Copy link

bruparel commented Dec 4, 2015

@lukehoban Thank you. That worked.

@erm0l0v
Copy link

erm0l0v commented Sep 14, 2016

Hello I've installed delve via brew.

So in terminal this command works perfect:

dlv debug main.go (no root user)

However I still get error in vscode:

2016/09/14 18:18:36 server.go:71: Using API v1
2016/09/14 18:18:36 debugger.go:61: launching process with args: [./debug]
could not launch process: could not fork/exec

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "remotePath": "",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${workspaceRoot}",
            "env": {},
            "args": [],
            "showLog": true
        }
    ]
}

dlv version

Delve Debugger
Version: 0.11.0-alpha
Build: v0.11.0

go version

go version go1.7.1 darwin/amd64

@ameykpatil
Copy link

@erm0l0v I am facing an exact same issue, did you able to solve it?

@ThreeBearsDan
Copy link

@erm0l0v I encounter this problem, too. dlv can work under terminal, but doesn't work under IDE vscode. help!

@danbricedatascience
Copy link

danbricedatascience commented Dec 26, 2016

Same issue.

2016/12/26 22:44:41 debugger.go:55: launching process with args: [./debug]
2016/12/26 22:44:42 server.go:301: method Run has wrong number of ins: 1
2016/12/26 22:44:42 server.go:301: method Stop has wrong number of ins: 2
2016/12/26 22:44:42 debugger.go:239: continuing
Hello World!
101

When running a very simple Hello World. Breakpoints are "bypassed" and the program simply complete like if it is not in debug mode.

It perfectly works with dlv command line.

I'm on MacOSX 10.11.6, delve is installed from homebrew - certificate is well created.

Simple Hello World program used.

package main

import "fmt"

func main() {
	fmt.Println("Hello World!")
	i := 101   // Where I put the breakpoint
	fmt.Println(i)
}

@ramya-rao-a
Copy link
Contributor

@roblourens can you take a look at this?

@roblourens
Copy link
Member

This seems kind of far from the original issue so hopefully I'm not missing a thread. @erm0l0v that error message could not launch process: could not fork/exec would probably be coming from your code, so I don't know why it would be working via command line but not vscode. Could that be the case?

@ThreeBearsDan Do you see that exact error message or do you just share the issue that it works via CLI but not vscode? Can you post the console output?

@danbricedatascience What's your delve version? That was a delve bug at some point at least - https://github.com/derekparker/delve/issues/378

@erm0l0v
Copy link

erm0l0v commented Dec 27, 2016

@roblourens Currently debug works for me well. Problem was in certificate.

During first debug session OS ask me about root password and after filling password debug starts working in console but not in vs-code. This confused me and I am complained this problem.

@ThreeBearsDan @danbricedatascience Please try to restart system and run debug if OS ask you about root password - that mean that you have some issue with certificate (as I understand).

I did several steps to fix this problem and don't remeber which of the helped me. Probably it was manual installation of delve

@danbricedatascience
Copy link

@roblourens Version: 0.11.0-alpha

@erm0l0v Restart MacOS X does not change anything.

I will try manual installation of delve instead of brew.

@skeleton1231
Copy link

I have the same problem
work well on Terminal

image

but still fail on vscode

image

anyone help?
I use brew install delve

@ThreeBearsDan
Copy link

ThreeBearsDan commented Jan 11, 2017

@roblourens I am sorry for late reply. That work well now. I do nothing, just upgrade vsnode to Version 1.7.1. So I think it must be something wrong with vscode.
@erm0l0v Thank u. It's not the issue with certificate. I think it's the issue with vscode. I just upgrade vscode and it work well.
image

@ramya-rao-a
Copy link
Contributor

@skeleton1231. @ameykpatil Let's use #717 to track the issue where you get the error

server.go:71: Using API v1
debugger.go:61: launching process with args: [./debug]
could not launch process: could not fork/exec

This is coming from delve it self and #717 is tracking this.

@erm0l0v @ThreeBearsDan Glad to hear that you are unblocked now.

Anyone else coming to this thread with the same error as above, please see #717 , #269 and https://github.com/derekparker/delve/issues/357

@skeleton1231
Copy link

@ramya-rao-a

Thanks!

I solved the problem, here is my step:

  1. brew uninstall delve
    2.delete the keychain for delve
    3.Manual install the delve through the instruction (https://github.com/derekparker/delve/blob/master/Documentation/installation/osx/install.md)

image

This was referenced Jan 12, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests