diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-11-22 10:37:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-22 10:37:48 +0100 |
| commit | fa3941cb9917c022ff3bde5192ba7bc4341b5d3e (patch) | |
| tree | a1e3d51c6110ff236efcb64391b2b6a8b972ad2b /src/etc | |
| parent | 89e0fcee4041e038b91dfbe0afbcc1d8306d404d (diff) | |
| parent | a9a48ed3da1134364052322d628fd9d9418998f4 (diff) | |
| download | rust-fa3941cb9917c022ff3bde5192ba7bc4341b5d3e.tar.gz rust-fa3941cb9917c022ff3bde5192ba7bc4341b5d3e.zip | |
Rollup merge of #55961 - tromey:Bug-55944-vecdeque, r=nikomatsakis
Fix VecDeque pretty-printer This fixes the VecDeque pretty-printer to handle cases where head < tail. Closes #55944
Diffstat (limited to 'src/etc')
| -rwxr-xr-x | src/etc/gdb_rust_pretty_printing.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py index e6d5ef1a23f..27275ba3795 100755 --- a/src/etc/gdb_rust_pretty_printing.py +++ b/src/etc/gdb_rust_pretty_printing.py @@ -293,15 +293,23 @@ class RustStdVecDequePrinter(object): def to_string(self): (tail, head, data_ptr, cap) = \ rustpp.extract_tail_head_ptr_and_cap_from_std_vecdeque(self.__val) + if head >= tail: + size = head - tail + else: + size = cap + head - tail return (self.__val.type.get_unqualified_type_name() + - ("(len: %i, cap: %i)" % (head - tail, cap))) + ("(len: %i, cap: %i)" % (size, cap))) def children(self): (tail, head, data_ptr, cap) = \ rustpp.extract_tail_head_ptr_and_cap_from_std_vecdeque(self.__val) gdb_ptr = data_ptr.get_wrapped_value() - for index in xrange(tail, head): - yield (str(index), (gdb_ptr + index).dereference()) + if head >= tail: + size = head - tail + else: + size = cap + head - tail + for index in xrange(0, size): + yield (str(index), (gdb_ptr + ((tail + index) % cap)).dereference()) class RustStdBTreeSetPrinter(object): |
