Skip to content

Use lazy range in gdb pretty printers #34669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/etc/gdb_rust_pretty_printing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@

import gdb
import re
import sys
import debugger_pretty_printers_common as rustpp

if sys.version_info.major >= 3:
xrange = range
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you be sure to add a comment here as well indicating why we're doing this?


#===============================================================================
# GDB Pretty Printing Module for Rust
#===============================================================================
Expand Down Expand Up @@ -215,7 +219,7 @@ def children(self):
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):
for index in xrange(0, length):
yield (str(index), (raw_ptr + index).dereference())


Expand Down Expand Up @@ -244,7 +248,7 @@ def to_string(self):
def children(self):
(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):
for index in xrange(0, length):
yield (str(index), (gdb_ptr + index).dereference())


Expand Down