about summary refs log tree commit diff
path: root/src/etc
diff options
context:
space:
mode:
authorLoïc Damien <loic.damien@dzamlo.ch>2016-07-04 02:43:33 +0200
committerLoïc Damien <loic.damien@dzamlo.ch>2016-07-04 20:22:10 +0200
commit5de76afcfda5d167ece05cf020dc77c5e3ea4a3c (patch)
tree7e371cb3bb66efb87930f5c168232ee9d5497110 /src/etc
parentda099c2322c63144831f8585dee461e3a02e339a (diff)
downloadrust-5de76afcfda5d167ece05cf020dc77c5e3ea4a3c.tar.gz
rust-5de76afcfda5d167ece05cf020dc77c5e3ea4a3c.zip
Use lazy iterator in vec/slice gdb pretty printers
Diffstat (limited to 'src/etc')
-rwxr-xr-xsrc/etc/gdb_rust_pretty_printing.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py
index 38c9fbf9828..33f22e85796 100755
--- a/src/etc/gdb_rust_pretty_printing.py
+++ b/src/etc/gdb_rust_pretty_printing.py
@@ -211,15 +211,12 @@ class RustSlicePrinter:
                 ("(len: %i)" % length))
 
     def children(self):
-        cs = []
         (length, data_ptr) = rustpp.extract_length_and_ptr_from_slice(self.__val)
         assert data_ptr.type.get_dwarf_type_kind() == rustpp.DWARF_TYPE_CODE_PTR
         raw_ptr = data_ptr.get_wrapped_value()
 
         for index in range(0, length):
-            cs.append((str(index), (raw_ptr + index).dereference()))
-
-        return cs
+            yield (str(index), (raw_ptr + index).dereference())
 
 
 class RustStringSlicePrinter:
@@ -245,12 +242,10 @@ class RustStdVecPrinter:
                 ("(len: %i, cap: %i)" % (length, cap)))
 
     def children(self):
-        cs = []
         (length, data_ptr, cap) = rustpp.extract_length_ptr_and_cap_from_std_vec(self.__val)
         gdb_ptr = data_ptr.get_wrapped_value()
         for index in range(0, length):
-            cs.append((str(index), (gdb_ptr + index).dereference()))
-        return cs
+            yield (str(index), (gdb_ptr + index).dereference())
 
 
 class RustStdStringPrinter: