Commit 98651d6e authored by Austin Clements's avatar Austin Clements

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/4936Reviewed-by: default avatarMinux Ma <minux@golang.org>
parent 54568685
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment