aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRick Hudson <rlh@golang.org>2015-01-13 15:36:42 -0500
committerRick Hudson <rlh@golang.org>2015-01-20 19:58:22 +0000
commit0635706849e5fb32741df02ff998db9cb4445da1 (patch)
tree37385fb4cc36b903d623b1d196048f4f3950a72f /src
parentde47e9ca54deccae631468b107a90f64b3c0cd79 (diff)
downloadgo-0635706849e5fb32741df02ff998db9cb4445da1.tar.xz
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 <austin@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/mgc.go22
1 files changed, 21 insertions, 1 deletions
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")