summaryrefslogtreecommitdiff
path: root/gdb/varobj.h
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2013-08-30 09:44:46 +0800
committerYao Qi <yao@codesourcery.com>2014-06-12 15:27:15 +0800
commite525021603958709381fc4dc296cc2586aaa5dd7 (patch)
tree329c330c7a6febccb5e29d93fd96e06fecea512f /gdb/varobj.h
parent5a2e0d6e89f69f0c3d013cf43f3bd3d97b5e628b (diff)
downloadbinutils-gdb-e525021603958709381fc4dc296cc2586aaa5dd7.tar.gz
Generalize varobj iterator
This patch generalizes varobj iterator, in a python-independent way. Note varobj_item is still a typedef of PyObject, we can only focus on API changes, and leave the data type changes to the next patch. As a result, we include "varobj-iter.h" after the typedef of PyObject in varobj.c, but it is an intermediate state. Finally, varobj-iter.h is independent of PyObject. This change is helpful to move some python-related code out of varobj.c. V2: - Fix a missing cleanup. - Fix typos. - Use XNEW. - Check against NULL explicitly. - Update copyright year for new added files. V3: - Call PyGILState_Ensure before Py_XDECREF. - Use CPYCHECKER_STEALS_REFERENCE_TO_ARG. - Code indentation. V4: - use varobj_ensure_python_env instead of PyGILState_Ensure. gdb: 2014-06-12 Pedro Alves <pedro@codesourcery.com> Yao Qi <yao@codesourcery.com> * Makefile.in (SUBDIR_PYTHON_OBS): Add "py-varobj.o". (SUBDIR_PYTHON_SRCS): Add "python/py-varobj.c". (HFILES_NO_SRCDIR): Add "varobj-iter.h". (py-varobj.o): New rule. * python/py-varobj.c: New file. * python/python-internal.h (py_varobj_get_iterator): Declare. * varobj-iter.h: New file. * varobj.c: Include "varobj-iter.h" (struct varobj) <child_iter>: Change its type from "PyObject *" to "struct varobj_iter *". <saved_item>: Likewise. [HAVE_PYTHON] (varobj_ensure_python_env): Make it extern. [HAVE_PYTHON] (varobj_get_iterator): New function. (update_dynamic_varobj_children) [HAVE_PYTHON]: Move python-specific code to python/py-varobj.c. (install_visualizer): Call varobj_iter_delete instead of Py_XDECREF. * varobj.h (varobj_ensure_python_env): Declare.
Diffstat (limited to 'gdb/varobj.h')
-rw-r--r--gdb/varobj.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/varobj.h b/gdb/varobj.h
index 1199e0b024c..991c2e8f9e1 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -308,6 +308,8 @@ extern int varobj_has_more (struct varobj *var, int to);
extern int varobj_pretty_printed_p (struct varobj *var);
+extern struct cleanup *varobj_ensure_python_env (struct varobj *var);
+
extern int varobj_default_value_is_changeable_p (struct varobj *var);
extern int varobj_value_is_changeable_p (struct varobj *var);