Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I cannot attach to delve on Mac #6

Open
grandmore opened this issue Feb 2, 2017 · 3 comments
Open

I cannot attach to delve on Mac #6

grandmore opened this issue Feb 2, 2017 · 3 comments

Comments

@grandmore
Copy link

I have read your docs and everything is installed but I cannot get delveAppengine to attach to the pid.

I am on a Mac 10.12.3.

This is what I see

2017/02/02 20:38:45 server.go:71: Using API v1
2017/02/02 20:38:45 debugger.go:54: attaching to pid 3351
2017/02/02 20:38:45 main.go:133: could not attach to pid 3351: could not attach to 3351

I ran pstree -w and can see that the pid number is correct, it's just is not attaching.

What can I do to get it working?

Thanks.

@dbenque
Copy link
Owner

dbenque commented Feb 3, 2017

Hard for me to reproduce, I have no Mac...
Can you please confirm that you are running everything with the same user ?
Can you attempt to attach directly delve to the process without using delveAppengine to confirm that the problem comes from delveAppengine and not another part ?

Also let me quote one part of the article:

If you have an extra log with the following error:

Could not attach to pid 27836

set proc/sys/kernel/yama/ptrace_scope to 0

(On linux) You will have to modify your configuration and edit the file “proc/sys/kernel/yama/ptrace_scope” so that it contains the value “0” (zero).

echo 0|sudo tee /proc/sys/kernel/yama/ptrace_scope

For more details: https://www.kernel.org/doc/Documentation/security/Yama.txt
Once the change is done, modify a source file of the module, save: the module will be redeployed, and this time the debugger should be able to attach to the process.

I have no idea on how this translate to Mac, but worth looking that way.

@grandmore
Copy link
Author

grandmore commented Feb 3, 2017

I compiled everything with the same user but had to fight with the location of the SDK and the original go etc. I can run Delve directly and it works fine I just can't get it to work inside VSCode with this library.

I did look into ptrace_scope as it seems the logical issue, but I could not find any references to Mac so I was a bit lost.

@cedriclam can you help as you created the Darwin port.

Any help would be really appreciated.

@clamoriniere
Copy link
Contributor

I suppose it is because the binary that you have generated with the build is not signed that will allow it to attach other process.
like it is done during the delve make install (https://github.com/derekparker/delve/blob/master/Makefile#L45)

I will try to check it with my Mac this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants