diff options
author | Yao Qi <yao@codesourcery.com> | 2013-08-30 09:44:46 +0800 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2014-06-12 15:27:15 +0800 |
commit | e525021603958709381fc4dc296cc2586aaa5dd7 (patch) | |
tree | 329c330c7a6febccb5e29d93fd96e06fecea512f /gdb/Makefile.in | |
parent | 5a2e0d6e89f69f0c3d013cf43f3bd3d97b5e628b (diff) | |
download | gdb-e525021603958709381fc4dc296cc2586aaa5dd7.zip gdb-e525021603958709381fc4dc296cc2586aaa5dd7.tar.gz gdb-e525021603958709381fc4dc296cc2586aaa5dd7.tar.bz2 |
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/Makefile.in')
-rw-r--r-- | gdb/Makefile.in | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gdb/Makefile.in b/gdb/Makefile.in index ea27cf5..deb64a1 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -376,7 +376,8 @@ SUBDIR_PYTHON_OBS = \ py-threadevent.o \ py-type.o \ py-utils.o \ - py-value.o + py-value.o \ + py-varobj.o SUBDIR_PYTHON_SRCS = \ python/python.c \ @@ -413,7 +414,8 @@ SUBDIR_PYTHON_SRCS = \ python/py-threadevent.c \ python/py-type.c \ python/py-utils.c \ - python/py-value.c + python/py-value.c \ + python/py-varobj.c SUBDIR_PYTHON_DEPS = SUBDIR_PYTHON_LDFLAGS= SUBDIR_PYTHON_CFLAGS= @@ -865,7 +867,8 @@ proc-utils.h aarch64-tdep.h arm-tdep.h ax-gdb.h ppcfbsd-tdep.h \ ppcnbsd-tdep.h cli-out.h gdb_expat.h breakpoint.h infcall.h obsd-tdep.h \ exec.h m32r-tdep.h osabi.h gdbcore.h solib-som.h amd64bsd-nat.h \ i386bsd-nat.h xml-support.h xml-tdesc.h alphabsd-tdep.h gdb_obstack.h \ -ia64-tdep.h ada-lang.h varobj.h frv-tdep.h nto-tdep.h serial.h \ +ia64-tdep.h ada-lang.h ada-varobj.h varobj.h varobj-iter.h frv-tdep.h \ +nto-tdep.h serial.h \ c-lang.h d-lang.h go-lang.h frame.h event-loop.h block.h cli/cli-setshow.h \ cli/cli-decode.h cli/cli-cmds.h cli/cli-utils.h \ cli/cli-script.h macrotab.h symtab.h common/version.h \ @@ -2506,6 +2509,10 @@ py-value.o: $(srcdir)/python/py-value.c $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-value.c $(POSTCOMPILE) +py-varobj.o: $(srcdir)/python/py-varobj.c + $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-varobj.c + $(POSTCOMPILE) + # # Dependency tracking. Most of this is conditional on GNU Make being # found by configure; if GNU Make is not found, we fall back to a |