Iterate over 'struct varobj_item' instead of PyObject
authorYao Qi <yao@codesourcery.com>
Tue, 12 Nov 2013 12:49:52 +0000 (20:49 +0800)
committerYao Qi <yao@codesourcery.com>
Thu, 12 Jun 2014 07:27:19 +0000 (15:27 +0800)
commit827f100cee10ed58ef9d22de35ba1d61db73e541
tree8febcc9d98d73986516271aa1d92fa65a09d3cae
parente525021603958709381fc4dc296cc2586aaa5dd7
Iterate over 'struct varobj_item' instead of PyObject

In previous patch, "saved_item" is still a PyOjbect and iteration is
still performed over PyObject.  This patch continues to decouple
iteration from python code, so it changes its type to "struct
varobj_item *", so that the iterator itself is independent of python.

 V2:
 - Call varobj_delete_iter in free_variable.
 - Fix changelog entries.
 - Use XNEW.

 V3:
 - Return NULL early in py_varobj_iter_next if gdb_python_initialized
   is false.

gdb:

2014-06-12  Pedro Alves  <pedro@codesourcery.com>
    Yao Qi  <yao@codesourcery.com>

* python/py-varobj.c (py_varobj_iter_next): Return NULL if
gdb_python_initialized is false.  Move some code from varobj.c.
* varobj-iter.h (struct varobj_item): Moved from varobj.c.
* varobj.c: Move "varobj-iter.h" inclusion earlier.
(struct varobj_item): Moved to varobj-iter.h".
(varobj_clear_saved_item): New function.
(update_dynamic_varobj_children): Move python-related code to
py-varobj.c.
(free_variable): Call varobj_clear_saved_item and
varobj_iter_delete.
gdb/ChangeLog
gdb/python/py-varobj.c
gdb/varobj-iter.h
gdb/varobj.c