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

Can't get headless mode to work with client #982

Closed
primalmotion opened this Issue Oct 6, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@primalmotion

primalmotion commented Oct 6, 2017

  1. What version of Delve are you using (dlv version)?
Delve Debugger
Version: 1.0.0-rc.1
Build: 5c9b2009cab214c1f912a2d8c6c89eec9f3ada2b

But I also tried 0.12.1 and HEAD

  1. What version of Go are you using? (go version)?
go version go1.9.1 darwin/amd64
  1. What operating system and processor architecture are you using?
    macOS High Sierra 10.13 (17A405)

  2. What did you do?
    I have this little demo program

package main

import (
	"flag"
	"fmt"
	"os"
	"os/signal"
	"time"
)

func main() {
	var mode string
	flag.StringVar(&mode, "mode", "1", "mode")
	flag.Parse()

	switch mode {
	case "1":
		f1()
	case "2":
		f2()
	case "3":
		f3()
	}
}

func f1() {
	fmt.Println("runing mode 1")
	go func() {
		for range time.Tick(1 * time.Second) {
			fmt.Println("ping")
		}
	}()

	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)
	<-c
}

func f2() {
	fmt.Println("runing mode 2")
	go func() {
		for range time.Tick(1 * time.Second) {
			fmt.Println("ping")
		}
	}()

	for range time.Tick(10 * time.Second) {
	}
}

func f3() {
	fmt.Println("runing mode 3")
	for range time.Tick(1 * time.Second) {
		fmt.Println("ping")
	}
}

Then I start delve by doing in a terminal

$ dlv debug --headless --listen :2345 --log  -- -mode=1 # mode 1, 2 or 3 actually end up not working the same
2017/10/06 13:38:08 server.go:73: Using API v1
2017/10/06 13:38:08 debugger.go:97: launching process with args:[/Users/tonio/Documents/Aporeto/workspace/code/go/src/github.com/aporeto-inc/test/debugger/debug -mode=1]
API server listening at: [::]:2345

Then I connect from another terminal:

$ dlv connect 127.0.0.1:2345
Type 'help' for list of commands.
(dlv)

So far so good. Now if I type c the program starts, but I never get the possibility to to anything else until I CTRL-C the dlv client

Here is a little gif
oct-06-2017 13-41-33

I did this reduction as I was using VSCode and realized that the headless server never responds to the client.

  1. What did you expect to see?
    stuff

  2. What did you see instead?
    no stuff

@aarzilli

This comment has been minimized.

Show comment
Hide comment
@aarzilli

aarzilli Oct 8, 2017

Collaborator

Yes, you can not interact with the target process unless it's stopped.

Collaborator

aarzilli commented Oct 8, 2017

Yes, you can not interact with the target process unless it's stopped.

@aarzilli aarzilli closed this Oct 8, 2017

@primalmotion

This comment has been minimized.

Show comment
Hide comment
@primalmotion

primalmotion Jan 6, 2018

I can't even pause the process. So I have to plan all my breakpoints before I start delve?

primalmotion commented Jan 6, 2018

I can't even pause the process. So I have to plan all my breakpoints before I start delve?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment