From: Austin Clements Date: Tue, 17 Feb 2015 03:04:24 +0000 (-0500) Subject: runtime: in runtime-gdb.py, use SliceValue wrapper X-Git-Tag: go1.5beta1~1967 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=98651d6edf32e4cfcff407b4441d0b537d0ad745;p=gostls13.git 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 --- diff --git a/src/runtime/runtime-gdb.py b/src/runtime/runtime-gdb.py index 33fcc76931..6076bcb11b 100644 --- a/src/runtime/runtime-gdb.py +++ b/src/runtime/runtime-gdb.py @@ -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: