From: Rick Hudson Date: Tue, 13 Jan 2015 20:36:42 +0000 (-0500) Subject: runtime: Add some diagnostic messages printing source of unmarked object X-Git-Tag: go1.5beta1~2303 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0635706849e5fb32741df02ff998db9cb4445da1;p=gostls13.git runtime: Add some diagnostic messages printing source of unmarked object Print out the object holding the reference to the object that checkmark detects as not being properly marked. Change-Id: Ieedbb6fddfaa65714504af9e7230bd9424cd0ae0 Reviewed-on: https://go-review.googlesource.com/2744 Reviewed-by: Austin Clements --- diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index 3972d0f2a3..32f13d1d4d 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -276,11 +276,31 @@ func greyobject(obj, base, off uintptr, hbits heapBits, wbuf *workbuf) *workbuf print("runtime:greyobject: checkmarks finds unexpected unmarked object obj=", hex(obj), "\n") print("runtime: found obj at *(", hex(base), "+", hex(off), ")\n") + // Dump the source (base) object + + kb := base >> _PageShift + xb := kb + xb -= mheap_.arena_start >> _PageShift + sb := h_spans[xb] + printlock() + print("runtime:greyobject Span: base=", hex(base), " kb=", hex(kb)) + if sb == nil { + print(" sb=nil\n") + } else { + print(" sb.start*_PageSize=", hex(sb.start*_PageSize), " sb.limit=", hex(sb.limit), " sb.sizeclass=", sb.sizeclass, " sb.elemsize=", sb.elemsize, "\n") + // base is (a pointer to) the source object holding the reference to object. Create a pointer to each of the fields + // fields in base and print them out as hex values. + for i := 0; i < int(sb.elemsize/ptrSize); i++ { + print(" *(base+", i*ptrSize, ") = ", hex(*(*uintptr)(unsafe.Pointer(base + uintptr(i)*ptrSize))), "\n") + } + } + + // Dump the object + k := obj >> _PageShift x := k x -= mheap_.arena_start >> _PageShift s := h_spans[x] - printlock() print("runtime:greyobject Span: obj=", hex(obj), " k=", hex(k)) if s == nil { print(" s=nil\n")