Delve: Can't get headless mode to work with client

Created on 6 Oct 2017  路  3Comments  路  Source: go-delve/delve

  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

Most helpful comment

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

All 3 comments

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

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

Facing the same issue. Not able to add breakpoints post launching. Is there a workaround/fix for this?

Was this page helpful?
0 / 5 - 0 ratings