Environment
dlv 1.1.0 (master @ 4e4ed029)
go 1.11.1
os darwin/amd64
What did you do?
With the following test code:
https://gist.github.com/antoineco/262c7dc7860ddd25ef5cd124d2a8ceb3
I ran:
$ dlv test ./
Type 'help' for list of commands.
(dlv) b k8s.io/client-go/testing.(*tracker).add
Breakpoint 1 set at 0x19ec06b for issue/vendor/k8s.io/client-go/testing.(*tracker).add() ./vendor/k8s.io/client-go/testing/fixture.go:309
md5-e1499672e4c4d18dafc7385e3e5d5e50
(dlv) args
**What did you expect to see?**
The `args` command prints the value of the function arguments.
**What did you see instead?**
`Warning: debugging optimized function` is printed and function arguments are unreadable.
```gdb
(dlv) args
gvr = (unreadable empty OP stack)
ns = (unreadable could not find loclist entry at 0x4bed3 for address 0x1e3050b)
obj = (unreadable could not find loclist entry at 0x4bf0f for address 0x1e3050b)
replaceExisting = (unreadable could not find loclist entry at 0x4bf4a for address 0x1e3050b)
t = (unreadable could not find loclist entry at 0x4bf7f for address 0x1e3050b)
~r4 = (unreadable empty OP stack)
Important note
鈿狅笍 Here comes the interesting part.
If one un-comments the commented out lines inside issue.go, the warning will not appear, and Delve will consistently print function arguments:
(dlv) args
gvr = issue/vendor/k8s.io/apimachinery/pkg/runtime/schema.GroupVersionResource {Group: "", Version: "v1", Resource: "events"}
ns = ""
obj = issue/vendor/k8s.io/apimachinery/pkg/runtime.Object(*issue/vendor/k8s.io/api/core/v1.Event) 0xc0000f8dd8
replaceExisting = false
t = (*issue/vendor/k8s.io/client-go/testing.tracker)(0xc0002c5400)
~r4 = (unreadable invalid interface type: could not find str field)
Duplicate of https://github.com/golang/go/issues/27681
it still happens to me after golang/go#27681 has been closed
Same, using the integrated debugger of Goland. The binary is built without optimization, and not all variables are readable.
Using the build flags (go 1.12):
go build -o=/... -gcflags="all=-N -l" ...
Error:
unreadable: could not find loclist entry at 0x... for address 0x...
Most helpful comment
Same, using the integrated debugger of Goland. The binary is built without optimization, and not all variables are readable.
Using the build flags (go 1.12):
go build -o=/... -gcflags="all=-N -l" ...Error:
unreadable: could not find loclist entry at 0x... for address 0x...