From 827f100cee10ed58ef9d22de35ba1d61db73e541 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Tue, 12 Nov 2013 20:49:52 +0800 Subject: 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 Yao Qi * 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/varobj-iter.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gdb/varobj-iter.h') diff --git a/gdb/varobj-iter.h b/gdb/varobj-iter.h index 3a530bc..9eb672d 100644 --- a/gdb/varobj-iter.h +++ b/gdb/varobj-iter.h @@ -14,9 +14,18 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -struct varobj_iter_ops; +/* A node or item of varobj, composed of the name and the value. */ + +typedef struct varobj_item +{ + /* Name of this item. */ + char *name; -typedef PyObject varobj_item; + /* Value of this item. */ + struct value *value; +} varobj_item; + +struct varobj_iter_ops; /* A dynamic varobj iterator "class". */ -- cgit v1.1