Delve: Support plugins

Created on 8 Jun 2017  路  6Comments  路  Source: go-delve/delve

Please answer the following before submitting your issue:

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

  1. What version of Delve are you using (dlv version)? 0.12.2
  2. What version of Go are you using? (go version)? 1.8.1
  3. What operating system and processor architecture are you using? Linux Ubuntu amd64
  4. What did you do?

    dlv exec on an executable that loads a plugin and try to step into the plugin's code.
    The plugin is built with go build -buildmode=plugin --o plug.so and the exec is built with the standard go build -o exec main.go. The code executes fine normally, however I am tracking down a SIGSEGV in the plugin code when it hits an edge case, that is when I try to step into the code and dlv panics.

  5. What did you expect to see?

The child callframe in the plugin

  1. What did you see instead?

This panic stack trace:

Command failed: Internal debugger error: runtime error: invalid memory address or nil pointer dereference
runtime.call32 (0x454328)
        /usr/local/go/src/runtime/asm_amd64.s:514
runtime.gopanic (0x42a07f)
        /usr/local/go/src/runtime/panic.go:489
/runtime.panicmem (0x428f2e)
        /usr/local/go/src/runtime/panic.go:63
runtime.sigpanic (0x43f3ef)
        /usr/local/go/src/runtime/signal_unix.go:290
github.com/derekparker/delve/pkg/proc.next (0x67afd0)
        /home/cgrabowski/go/src/github.com/derekparker/delve/pkg/proc/threads.go:109
github.com/derekparker/delve/pkg/proc.Step (0x67367d)
        /home/cgrabowski/go/src/github.com/derekparker/delve/pkg/proc/proc.go:225
github.com/derekparker/delve/service/debugger.(*Debugger).Command (0x6e09cc)
        /home/cgrabowski/go/src/github.com/derekparker/delve/service/debugger/debugger.go:506
github.com/derekparker/delve/service/rpc2.(*RPCServer).Command (0x8967c1)
        /home/cgrabowski/go/src/github.com/derekparker/delve/service/rpc2/server.go:101
 runtime.call64 (0x4543a8)
        /usr/local/go/src/runtime/asm_amd64.s:515
reflect.Value.call (0x4ae0cf)
        /usr/local/go/src/reflect/value.go:434
reflect.Value.Call (0x4ad694)
        /usr/local/go/src/reflect/value.go:302
github.com/derekparker/delve/service/rpccommon.(*ServerImpl).serveJSONCodec.func2 (0x89f6a2)        
       /home/cgrabowski/go/src/github.com/derekparker/delve/service/rpccommon/server.go:319
runtime.goexit (0x456ac1)
        /usr/local/go/src/runtime/asm_amd64.s:2197
kinenhancement

Most helpful comment

I'm surprised there aren't more 'me too' folks on this issue. I guess Go plugins are not so popular. I need to use Go plugins in my project so I will be watching this issue. Thank you.

All 6 comments

I'm surprised there aren't more 'me too' folks on this issue. I guess Go plugins are not so popular. I need to use Go plugins in my project so I will be watching this issue. Thank you.

Hello @aarzilli, sorry for bothering, got one question regarding plugins and debugging.
Currently on go version go1.12.2 darwin/amd64 when you try to build simple plugin and load it you've got error plugin was built with a different version of package math/bits during debugging (for example consider simple plugins from https://github.com/vladimirvivien/go-plugin-example as example). But when you build app and start it, everything is OK. Is it also related to this issue?

Delve builds everything with -gcflags='all=-N -l' the plugins need to be compiled like that too (or you debug the optimized executable with exec).

@aarzilli Thanks a lot! This helped

Closing as this is now supported.

@derekparker

Do you have a plan to support debugging plugin in Mac?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ankur0101 picture ankur0101  路  4Comments

devtoro picture devtoro  路  6Comments

luminacious picture luminacious  路  5Comments

delaneyj picture delaneyj  路  4Comments

wusendong picture wusendong  路  5Comments