]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.8] runtime: print debug info on "base out of range"
authorAustin Clements <austin@google.com>
Thu, 11 May 2017 19:22:10 +0000 (15:22 -0400)
committerChris Broadfoot <cbro@golang.org>
Tue, 23 May 2017 19:41:17 +0000 (19:41 +0000)
Cherry-pick of CL 43310.

This adds debugging information when we panic with "heapBitsForSpan:
base out of range".

Updates #20259.

Change-Id: I0dc1a106aa9e9531051c7d08867ace5ef230eb3f
Reviewed-on: https://go-review.googlesource.com/43410
Run-TryBot: Austin Clements <austin@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/mbitmap.go

index 89d8a4cc76e43c1431c5721ad1fac9c64af65fe8..9b988fae255ee80f8361b0971a272a50200110e7 100644 (file)
@@ -374,6 +374,7 @@ func heapBitsForAddr(addr uintptr) heapBits {
 // heapBitsForSpan returns the heapBits for the span base address base.
 func heapBitsForSpan(base uintptr) (hbits heapBits) {
        if base < mheap_.arena_start || base >= mheap_.arena_used {
+               print("runtime: base ", hex(base), " not in range [", hex(mheap_.arena_start), ",", hex(mheap_.arena_used), ")\n")
                throw("heapBitsForSpan: base out of range")
        }
        return heapBitsForAddr(base)