This is the mail archive of the
mailing list for the Archer project.
[python] lazily fetch varobj children
- From: Tom Tromey <tromey at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Thu, 09 Jul 2009 10:25:05 -0600
- Subject: [python] lazily fetch varobj children
- Reply-to: Tom Tromey <tromey at redhat dot com>
I'm checking this in on the python branch.
This changes the varobj code to lazily fetch dynamic children if a
child range has been selected.
This will yield some funny results. For one thing it means the child
count of a varobj cannot be relied on -- it may change if you ask for
more children. Perhaps we should add a "dynamic" flag to the varobj
output; this seems like something to discuss upstream.
Also, this change means that a well-behaved printer should not eagerly
fetch children. Some of the existing printers do this to compute the
string form of a container. I'll fix that, but only after some of
this goes upstream.
2009-07-09 Tom Tromey <firstname.lastname@example.org>
* varobj.c (update_dynamic_varobj_children): Terminate loop early
if a child range is selected.
diff --git a/gdb/varobj.c b/gdb/varobj.c
index d068a6e..1412d43 100644
@@ -879,7 +879,7 @@ update_dynamic_varobj_children (struct varobj *var,
- for (i = 0; ; ++i)
+ for (i = 0; var->to < 0 || i < var->to; ++i)
PyObject *item = PyIter_Next (iterator);