]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: gdb support, fix pretty printing of channels.
authorLuuk van Dijk <lvd@golang.org>
Thu, 29 Sep 2011 19:07:38 +0000 (12:07 -0700)
committerLuuk van Dijk <lvd@golang.org>
Thu, 29 Sep 2011 19:07:38 +0000 (12:07 -0700)
The type to cast the elements to was stolen from a field
that's no longer there.

R=rsc
CC=golang-dev
https://golang.org/cl/5143050

src/pkg/runtime/runtime-gdb.py

index f815e102c1169346ba349c866186a015f88cd906..ace27e66df9ab41faf8aa8516a418c4b51329b35 100644 (file)
@@ -122,8 +122,8 @@ class ChanTypePrinter:
                return str(self.val.type)
 
        def children(self):
-               # see chan.c chanbuf()
-               et = [x.type for x in self.val['free'].type.target().fields() if x.name == 'elem'][0]
+               # see chan.c chanbuf().  et is the type stolen from hchan<T>::recvq->first->elem
+               et = [x.type for x in self.val['recvq']['first'].type.target().fields() if x.name == 'elem'][0]
                 ptr = (self.val.address + 1).cast(et.pointer())
                 for i in range(self.val["qcount"]):
                        j = (self.val["recvx"] + i) % self.val["dataqsiz"]