Search code examples
gohugodelve

dlv hugo just hangs


I am trying to learn Hugo using a Go debugger called dlv. And I am pretty stuck. After:

go get -v github.com/gohugoio/hugo
cd $GOPATH/src/github.com/gohugoio/hugo
go  build -gcflags="-N -l"
dlv exec ./hugo -- -s /path/to/the/projectdir

This hangs. Pressing Ctrl+C runs hugo as normal. As far as I can see dlv debug not only produces the same behavior but it's the exact same: the produced binary called debug is the exact same as the hugo I built with go build -gcflags="-N -l".

dlv launches a number of child processes, these disappear after a while. The hugo process is visible via ps and pidof hugo but strace -ppidof hugo`` reports strace: attach: ptrace(PTRACE_ATTACH, ...): No such proce. Checking after, it's still in the ps list, the same pid. I would guess because it's in t state as it is being traced.

How could I then watch Hugo running?


Solution

  • Hmm, doesn't happen for me. dlv prompt appears right away. I am on fedora, have been using hugo regularly over the past week or so.

    $ dlv exec ./hugo -- --cleanDestinationDir -s /path/to/blog/root/
    Type 'help' for list of commands.
    (dlv) c
    
                       | EN  
    +------------------+----+
      Pages            | 25  
      Paginator pages  |  0  
      Non-page files   |  0  
      Static files     | 11  
      Processed images |  0  
      Aliases          |  0  
      Sitemaps         |  1  
      Cleaned          |  0  
    
    Total in 46 ms
    Process 41032 has exited with status 0
    $