Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 02/12] Generalize varobj iterator
Date: Wed, 21 May 2014 17:51:00 -0000	[thread overview]
Message-ID: <874n0jkokw.fsf@fleche.redhat.com> (raw)
In-Reply-To: <1392367471-13527-3-git-send-email-yao@codesourcery.com> (Yao	Qi's message of "Fri, 14 Feb 2014 16:44:21 +0800")

>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao> 2014-02-14  Pedro Alves  <pedro@codesourcery.com>
Yao> 	    Yao Qi  <yao@codesourcery.com>
Yao> 	* Makefile.in (SUBDIR_PYTHON_OBS): Add "py-varobj.o".
Yao> 	(SUBDIR_PYTHON_SRCS): Add "python/py-varobj.c".
Yao> 	(HFILES_NO_SRCDIR): Add "varobj-iter.h".
Yao> 	(py-varobj.o): New rule.
Yao> 	* python/py-varobj.c: New file.
Yao> 	* python/python-internal.h (py_varobj_get_iterator): Declare.
Yao> 	* varobj-iter.h: New file.
Yao> 	* varobj.c: Include "varobj-iter.h"
Yao> 	(struct varobj) <child_iter>: Change its type from "PyObject *"
Yao> 	to "struct varobj_iter *".
Yao> 	<saved_item>: Likewise.
Yao> 	[HAVE_PYTHON] (varobj_ensure_python_env): Make it extern.
Yao> 	[HAVE_PYTHON] (varobj_get_iterator): New function.
Yao> 	(update_dynamic_varobj_children) [HAVE_PYTHON]: Move
Yao> 	python-specific code to python/py-varobj.c.
Yao> 	(install_visualizer): Call varobj_iter_delete instead of
Yao> 	Py_XDECREF.
Yao> 	* varobj.h (varobj_ensure_python_env): Declare.

Yao> +static void
Yao> +py_varobj_iter_dtor (struct varobj_iter *self)
Yao> +{
Yao> +  struct py_varobj_iter *dis = (struct py_varobj_iter *) self;
Yao> +
Yao> +  Py_XDECREF (dis->iter);

I think this has to acquire the GIL before calling Py_XDECREF.

Yao> +static void
Yao> +py_varobj_iter_ctor (struct py_varobj_iter *self,
Yao> +		      struct varobj *var, PyObject *pyiter)
Yao> +{
Yao> +  self->base.var = var;
Yao> +  self->base.ops = &py_varobj_iter_ops;
Yao> +  self->base.next_raw_index = 0;
Yao> +  self->iter = pyiter;
[...]
Yao> +static struct py_varobj_iter *
Yao> +py_varobj_iter_new (struct varobj *var, PyObject *pyiter)
Yao> +{
[...]
Yao> +  py_varobj_iter_ctor (self, var, pyiter);

I think these two functions should be documented as stealing a reference
to PYITER.  It's helpful to see such comments later.

Using CPYCHECKER_STEALS_REFERENCE_TO_ARG would also be nice, but I
appreciate that this isn't easy for everybody to test.

Yao> +  iter = PyObject_GetIter (children);
Yao> + if (iter == NULL)
Yao> +    {

The "if" looks misindented.

Yao> +struct varobj_iter;
Yao> +struct varobj;
Yao> +struct varobj_iter *py_varobj_get_iterator (struct varobj *var,
Yao> +					    PyObject *printer);
Yao>  #endif /* GDB_PYTHON_INTERNAL_H */

Please leave a blank line before the #endif.

Yao> +extern  struct cleanup *varobj_ensure_python_env (struct varobj *var);

Extra space after "extern".

Tom


  parent reply	other threads:[~2014-05-21 17:51 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14  8:46 [RFC 00/12 V2] Visit varobj available children only in MI Yao Qi
2014-02-14  8:46 ` [PATCH 10/12] Match dynamic="1" in the output of -var-list-children Yao Qi
2014-04-24 20:50   ` Keith Seitz
2014-02-14  8:46 ` [PATCH 09/12] Delete varobj's children on traceframe is changed Yao Qi
2014-04-24 20:45   ` Keith Seitz
2014-02-14  8:46 ` [PATCH 04/12] Remove #if HAVE_PYTHON Yao Qi
2014-04-23 19:25   ` Keith Seitz
2014-05-21 17:52   ` Tom Tromey
2014-02-14  8:46 ` [PATCH 06/12] Use varobj_is_dynamic_p more widely Yao Qi
2014-04-24 18:17   ` Keith Seitz
2014-05-21 18:04   ` Tom Tromey
2014-02-14  8:46 ` [PATCH 02/12] Generalize varobj iterator Yao Qi
2014-04-23 19:24   ` Keith Seitz
2014-05-21 17:51   ` Tom Tromey [this message]
2014-05-23  1:23     ` Yao Qi
2014-06-04 20:21       ` Tom Tromey
2014-06-05  5:36         ` Yao Qi
2014-06-05 18:21           ` Tom Tromey
2014-02-14  8:46 ` [PATCH 03/12] Iterate over 'struct varobj_item' instead of PyObject Yao Qi
2014-04-23 19:29   ` Keith Seitz
2014-05-21 18:01   ` Tom Tromey
2014-05-23  1:33     ` Yao Qi
2014-06-04 20:22       ` Tom Tromey
2014-02-14  8:46 ` [PATCH 12/12] NEWS and Doc on --available-children-only Yao Qi
2014-02-14  9:40   ` Eli Zaretskii
2014-02-17  9:46     ` Yao Qi
2014-02-17 15:04       ` Eli Zaretskii
2014-02-18  2:01         ` Yao Qi
2014-02-18  5:11           ` Eli Zaretskii
2014-02-18  7:14             ` Yao Qi
2014-02-18 15:07               ` Eli Zaretskii
2014-02-14  8:46 ` [PATCH 07/12] MI option --available-children-only Yao Qi
2014-04-24 20:02   ` Keith Seitz
2014-02-14  8:46 ` [PATCH 01/12] Use 'struct varobj_item' to represent name and value pair Yao Qi
2014-04-23 18:16   ` Keith Seitz
2014-05-21 17:53   ` Tom Tromey
2014-02-14  8:46 ` [PATCH 05/12] Rename varobj_pretty_printed_p to varobj_is_dynamic_p Yao Qi
2014-04-24 17:39   ` Keith Seitz
2014-05-21 18:02   ` Tom Tromey
2014-02-14  8:46 ` [PATCH 11/12] Test case Yao Qi
2014-04-18 11:45   ` Yao Qi
2014-04-24 20:53     ` Keith Seitz
2014-02-14  8:46 ` [PATCH 08/12] Iterator varobj_items by their availability Yao Qi
2014-04-24 20:28   ` Keith Seitz
     [not found] ` <5327A296.3050605@codesourcery.com>
2014-04-04  2:00   ` [RFC 00/12 V2] Visit varobj available children only in MI Yao Qi
2014-04-17  1:12     ` ping : " Yao Qi
2014-04-21 16:20       ` Joel Brobecker
2014-04-22  2:54         ` Yao Qi
2014-06-12  7:37 ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874n0jkokw.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox