]> Cypherpunks repositories - gostls13.git/commit
runtime: improve invalid pointer error message
authorAustin Clements <austin@google.com>
Fri, 18 Sep 2015 15:55:31 +0000 (11:55 -0400)
committerAustin Clements <austin@google.com>
Fri, 18 Sep 2015 22:23:11 +0000 (22:23 +0000)
commitb7c55ba49684cc454f6c699bd3b3fa8fe6455c67
tree99f4de127da411467df8bf123ae154cfe692d3fe
parent7360638da09bed30bb32c183c9264f7f9f0bb8c9
runtime: improve invalid pointer error message

By default, the runtime panics if it detects a pointer to an
unallocated span. At this point, this usually catches bad uses of
unsafe or cgo in user code (though it could also catch runtime bugs).
Unfortunately, the rather cryptic error misleads users, offers users
little help with debugging their own problem, and offers the Go
developers little help with root-causing.

Improve the error message in various ways. First, the wording is
improved to make it clearer what condition was detected and to suggest
that this may be the result of incorrect use of unsafe or cgo. Second,
we add a dump of the object containing the bad pointer so that there's
at least some hope of figuring out why a bad pointer was stored in the
Go heap.

Change-Id: I57b91b12bc3cb04476399d7706679e096ce594b9
Reviewed-on: https://go-review.googlesource.com/14763
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/crash_test.go
src/runtime/mbitmap.go
src/runtime/mgcmark.go