delve: [OSX 10.10.3] Can't seem to be able to debug a program or attach to an existing one

Running a process then attaching:

296 [13:56] roberto@roberto-aw> sudo dlv attach 59077
Password:
could not attach to pid 59077: could not get thread count
[Hope I was of service hunting your bug!]

The process to be attached is:

574 [13:55] roberto@roberto-aw:src/flightaware-go> ./bin/fa-export
2015/06/30 13:55:55 Connecting to foxtrot.hou.flightaware.com:1501 with TLS
2015/06/30 13:55:56 TLS negociation done.
2015/06/30 13:55:56 Flightaware init done.
2015/06/30 13:55:56 Waiting for data…
2015/06/30 13:55:56 Loop
[1]    59077 killed     ./bin/fa-export

trying to run the process through dlv:

572 [13:54] roberto@roberto-aw:src/flightaware-go> ll !$
ll bin/fa-export
-rwxr-xr-x  1 roberto  staff  5551876 Jun 30 12:06 bin/fa-export*
573 [13:54] roberto@roberto-aw:src/flightaware-go> dlv ./bin/fa-export
could not launch process: could not fork/exec
[Hope I was of service hunting your bug!]

Code is at https://github.com/keltia/flightaware-go/

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

FWIF I had similar issue today:

“sudo dlv exec ./blah” worked fine, but “dlv exec ./blah” would print the dreaded “could not launch process: could not fork/exec”.

I double checked that the certificate was configured properly and that dlv was properly signed. Restarting taskgated did not help in my case.

What helped was - surprisingly - starting XCode. Apparently the first time it starts, it installs some debugging support tools, which seems to allow dlv to run as regular user.

I have same problem that I get error below except root user. could not launch process: could not fork/exec I killed taskgated just before make, but taskgated restarts after make process.

OS: OSX Yosemite 10.10.4 Darwin Kernel Version 14.4.0

In addition, after renamed these files, I am not able to run codesign. /System/Library/LaunchDaemons/com.apple.taskgated-helper.plist /System/Library/LaunchDaemons/com.apple.taskgated.plist

[root]$ codesign -s “dlv-cert” /Users/murotanimari/work/bin/dlv error: One or more parameters passed to a function were not valid.

I had the same issue and it was related to taskgated. I just restarted and everything worked.