This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[python] lazily fetch varobj children


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.

Tom

2009-07-09  Tom Tromey  <tromey@redhat.com>

	* 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
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -879,7 +879,7 @@ update_dynamic_varobj_children (struct varobj *var,
     }
   make_cleanup_py_decref (iterator);
 
-  for (i = 0; ; ++i)
+  for (i = 0; var->to < 0 || i < var->to; ++i)
     {
       PyObject *item = PyIter_Next (iterator);
       PyObject *py_v;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]