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

debugger fails with could not launch process: stub exited while waiting for connection: exit status 0 on M1 Pro #3059

Closed
thidasapankaja opened this issue Jul 10, 2022 · 15 comments

Comments

@thidasapankaja
Copy link

Please answer the following before submitting your issue:

Note: Please include any substantial examples (debug session output,
stacktraces, etc) as linked gists.

If this is about source listing not showing up (or breakpoints not being
accepted) while running in a container please read our
FAQ
first.

  1. What version of Delve are you using (dlv version)?
Delve Debugger
Version: 1.9.0
Build: $Id: 69310c2f438e492f892d6af22e8e62c8ea1e9d8d $
  1. What version of Go are you using? (go version)?
    go version go1.18.3 darwin/arm64
  2. What operating system and processor architecture are you using?
MacBook Pro (14-inch, 2021)
Apple M1 Pro
  1. What did you do?
package main

import "fmt"

func main() {
	fmt.Println("Hello, World")
}
  1. What did you expect to see?

run the dlv without any error

  1. What did you see instead?

could not launch process: stub exited while waiting for connection: exit status 0

Screenshot 2022-07-10 at 11 34 44

Already followed the installation guide and already had xcode-select installed, enabled Developer Mode and added the user to the Developer Group

@aarzilli
Copy link
Member

This is almost certainly a problem with your computer. You can confirm it by locating the executable of debugserver (it should be /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver) and running it manually on an executable file: path_to_debugserver 127.0.0.1:31337 path_to_some_executable.
It will fail instead of waiting for a connection.

@thidasapankaja
Copy link
Author

thidasapankaja commented Jul 10, 2022

@aarzilli It returns this

debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1316.0.9.46
 for x86_64 (running under translation).
Usage:
  debugserver host:port [program-name program-arg1 program-arg2 ...]
  debugserver /path/file [program-name program-arg1 program-arg2 ...]
  debugserver host:port --attach=<pid>
  debugserver /path/file --attach=<pid>
  debugserver host:port --attach=<process_name>
  debugserver /path/file --attach=<process_name>

@aarzilli
Copy link
Member

You didn't call it correctly, please see my message or the usage message it's printing.

@thidasapankaja
Copy link
Author

I ran it from the path of main.go
sudo /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver 127.0.0.1:31337 .

and getting this error

debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1316.0.9.46
 for x86_64 (running under translation).
error: failed to launch process /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver: Permission denied
Exiting.

I already added user to the Developer group following this command

sudo dscl . append /Groups/_developer GroupMembership $(whoami)

@aarzilli
Copy link
Member

The second argument needs to be the path to an executable, even better if it's a go executable you built to rule out the case were the problem is with permissions. Also no sudo.

@thidasapankaja
Copy link
Author

Getting the same error running this
/Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver 127.0.0.1:31337 main.go
Screenshot 2022-07-10 at 21 46 15

@aarzilli
Copy link
Member

main.go isn't an executable.

@thidasapankaja
Copy link
Author

thidasapankaja commented Jul 10, 2022

@aarzilli sorry. I'm a bit confused. Shouldn't this be .go file ?

EDIT : ran it on build go project as /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver 127.0.0.1:31337 ./hello and it's getting this (os/kern) invalid argument error.

@aarzilli
Copy link
Member

No, dmg files aren't executable either. An executable is the output file of go build, for example.

@thidasapankaja
Copy link
Author

@aarzilli Yea, I updated the answer, getting this as the error now

debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1316.0.9.46
 for x86_64 (running under translation).
error: failed to launch process /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver: (os/kern) invalid argument
Exiting.

@aarzilli
Copy link
Member

Ok, debugserver is failing on its own, without any interaction with delve. This is a problem with your setup. Closing.

@aarzilli
Copy link
Member

PS. I noticed this:

debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1316.0.9.46
 for x86_64 (running under translation).

@thidasapankaja
Copy link
Author

thidasapankaja commented Jul 11, 2022

@aarzilli
Ok. I just ran this

arch -arm64 /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver 127.0.0.1:31337 ./hello

and it is waiting for a connection

debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1316.0.9.46
 for arm64.
Listening to port 31337 for a connection from 127.0.0.1...

@exosyphon
Copy link

@thidasapankaja did you ever get this working? I am at the same point right now that you left off

@exosyphon
Copy link

I figured out my issue. #3804

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

3 participants