dlv version)?What version of Go are you using? (go version)?
Go 1.12.6 or go version devel +bc27b64dba
What operating system and processor architecture are you using?
Windows 10 / amd64
main.go file contents with the following ones: https://play.golang.org/p/dJWkRJx1cqNThen, run the debugger as usual against the main.go and run the following commands:
b main.go:43
b main.go:61
c
When the breakpoint hits, invoke the following function call call strconv.ParseInt("123", 10, 64)
What did you expect to see?
I would expect to see the result of the evaluation.
What did you see instead?
I got the following error message:
call not at safe point
However, change the commands above to the following sequence and then the function call will work (the debugger is stopped at line 35):
b main.go:35
b main.go:43
b main.go:61
c
From my understanding, this comes from the Go runtime itself, and this does not seem to be fixed in Go 1.13 either, but please confirm this is the case and I'll follow-up with the Go team in a separate ticket.
Thank you!
It doesn't have anything to do with whether the function was already called or not: some lines of code (really: some instructions) are not safe points and functions can't be called there, because the garbage collector wouldn't be able to deal with the resulting stack frame. Nothing we can do about it.
Is there a way to know where these safe points are? For clients, this could be useful as they could tell the users a more clear error or suggest a different place to execute the calls.
Is there a way to know where these safe points are?
No, we could parse the bitmap used by the runtime but since there's ongoing work on safepoints it's a bad time to do it.
Closing, not a bug.