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: diff --git a/src/test/debuginfo/pretty-huge-vec.rs b/src/test/debuginfo/pretty-huge-vec.rs new file mode 100644 index 00000000000..bb538523523 --- /dev/null +++ b/src/test/debuginfo/pretty-huge-vec.rs @@ -0,0 +1,41 @@ +// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-windows failing on win32 bot +// ignore-freebsd: gdb package too new +// ignore-android: FIXME(#10381) +// compile-flags:-g +// min-gdb-version 7.7 +// min-lldb-version: 310 + +// === GDB TESTS =================================================================================== + +// gdb-command: run + +// gdb-command: print vec +// gdb-check:$1 = Vec(len: 1000000000, cap: 1000000000) = {[...]...} + +// gdb-command: print slice +// gdb-check:$2 = &[u8](len: 1000000000) = {[...]...} + + +#![allow(unused_variables)] + +fn main() { + + // Vec + let mut vec: Vec = Vec::with_capacity(1_000_000_000); + unsafe{ vec.set_len(1_000_000_000) } + let slice = &vec[..]; + + zzz(); // #break +} + +fn zzz() { () } diff --git a/src/test/debuginfo/pretty-uninitialized-vec.rs b/src/test/debuginfo/pretty-uninitialized-vec.rs new file mode 100644 index 00000000000..75169658fe6 --- /dev/null +++ b/src/test/debuginfo/pretty-uninitialized-vec.rs @@ -0,0 +1,36 @@ +// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-windows failing on win32 bot +// ignore-freebsd: gdb package too new +// ignore-android: FIXME(#10381) +// compile-flags:-g +// min-gdb-version 7.7 +// min-lldb-version: 310 + +// === GDB TESTS =================================================================================== + +// gdb-command: run + +// gdb-command: print vec +// gdb-check:$1 = Vec(len: [...], cap: [...])[...] + + +#![allow(unused_variables)] + +fn main() { + + let vec; + zzz(); // #break + vec = vec![0]; + +} + +fn zzz() { () }