Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/cgo: Null pointer is accessed in C code, causing the stack to be destroyed #41070
What version of Go are you using (
The traceback the runtime prints when crashing looks fine:
(But it of course doesn't contain the C part of the stack.)
I can reproduce the gdb problem you're seeing. When run under gdb directly, the stack trace is even weirder.
Delve handles this just fine, although it also doesn't show the C parts:
Not sure why gdb/lldb can't backtrace the Go side. We do generate Dwarf, but maybe it's not sufficient to encode things like stack switches? Or maybe it is just wrong?
gdb behavior can vary a lot by version. I used:
GNU gdb (Ubuntu 9.1-0ubuntu1) 9.1 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
The problem seems to be because we are calling
The unwind info for
Interestingly this doesn't record any location for the saved value for
which also does not list
I'm not sure but I think that the effect of this is that when gdb unwinds past
I spot checked the unwind info of a couple of other Go frames, and they also don't record any information about where
I don't plan to look into this any further myself.