mirror of
https://github.com/golang/go
synced 2024-11-18 11:44:45 -07:00
runtime: in runtime-gdb.py, use SliceValue wrapper
Rather than reaching in to slices directly in the slice pretty printer, use the newly introduced SliceValue wrapper. Change-Id: Ibb25f8c618c2ffb3fe1a8dd044bb9a6a085df5b7 Reviewed-on: https://go-review.googlesource.com/4936 Reviewed-by: Minux Ma <minux@golang.org>
This commit is contained in:
parent
545686857b
commit
98651d6edf
@ -88,11 +88,11 @@ class SliceTypePrinter:
|
||||
return str(self.val.type)[6:] # skip 'struct '
|
||||
|
||||
def children(self):
|
||||
if self.val["len"] > self.val["cap"]:
|
||||
sval = SliceValue(self.val)
|
||||
if sval.len > sval.cap:
|
||||
return
|
||||
ptr = self.val["array"]
|
||||
for idx in range(int(self.val["len"])):
|
||||
yield ('[{0}]'.format(idx), (ptr + idx).dereference())
|
||||
for idx, item in enumerate(sval):
|
||||
yield ('[{0}]'.format(idx), item)
|
||||
|
||||
|
||||
class MapTypePrinter:
|
||||
|
Loading…
Reference in New Issue
Block a user