Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: pmuldoon@redhat.com
Cc: Pedro Alves <pedro@codesourcery.com>,
	gdb-patches@sourceware.org,        dan@codesourcery.com
Subject: Re: [patch] Add visible flag to breakpoints.
Date: Tue, 12 Oct 2010 21:34:00 -0000	[thread overview]
Message-ID: <m339sbhz7v.fsf@fleche.redhat.com> (raw)
In-Reply-To: <m3wrpnf9bi.fsf@redhat.com> (Phil Muldoon's message of "Tue, 12	Oct 2010 21:24:49 +0100")

>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:

Phil> In this patch iteration I removed any form of storage/tracking of
Phil> breakpoints.  Instead, as above, I placed a reference in the breakpoint
Phil> struct. 

I like this better.

Phil> There are two disadvantages that stem from this:
Phil> * I had to extern breakpoint_chain
Phil> * I had to move the ALL_BREAKPOINTS macro to breakpoint.h
Phil> I'm not sure how to get around those, or, if indeed they are perceived
Phil> as disadvantages.

It is definitely bad to do this.  I think it is fixable, though.

It is a little odd that the observer passes the number and not the
breakpoint itself.

Phil> +  if (internal && PyObject_IsTrue (internal))
Phil> +    internal_bp = 1;

PyObject_IsTrue can return -1 on failure, so this code must account for
that.

I see we have a case where we don't check this in py-prettyprint.c :(
I will fix that.

Phil> +      int i = 0;
Phil> +      ALL_BREAKPOINTS (b)

This instance of ALL_BREAKPOINTS should probably be replaced with some
kind of callback API, like the other iterate_over_* functions in gdb.

Phil> +      {
Phil> +	/* Not all breakpoints will have a companion Python object.
Phil> +	   Only breakpoints that were created via bppy_new, or
Phil> +	   breakpoints that were created externally and are tracked by
Phil> +	   the Python Scripting API.  */
Phil> +	if (b->py_bp_object)
Phil> +	  {
Phil> +	    if (PyTuple_SetItem (result, i, (PyObject *) b->py_bp_object) != 0)

I think that cast to PyObject is unnecessary.

Phil> +	      {
Phil> +		Py_DECREF (result);
Phil> +		return NULL;
Phil> +	      }
Phil> +	    Py_INCREF (b->py_bp_object);

This incref should come before the call to PyTuple_SetItem.

Phil> @@ -667,9 +673,7 @@ gdbpy_breakpoint_created (int num)
Phil>    breakpoint_object *newbp;
Phil>    struct breakpoint *bp = NULL;
Phil>    PyGILState_STATE state;
Phil> -
Phil> -  if (num < 0)
Phil> -    return;
Phil> +  int error = 0;

I am not certain that we want a new breakpoint object to be created for
internal breakpoints set by other modules.  It seems potentially
harmful.

I think one way to do this would be to rephrase this check as

    if (num < 0 && bppy_pending_object == NULL)

Phil> +      newbp->bp->py_bp_object = (PyObject *)newbp;

No cast.

Phil> +  if (! error)
Phil> +    ++bppy_live;

You can get rid of the 'error' local and just push this back up into the
"ok" branch of the preceding 'if'.
 
Phil>    /* Just ignore errors here.  */
Phil>    PyErr_Clear ();

I think this is redundant now.

Phil> +  ALL_BREAKPOINTS (b)
Phil> +  {
Phil> +    if (b->number == num)
Phil> +      {
Phil> +	breakpoint_object *bp_obj = 
Phil> +	  ((breakpoint_object *)b->py_bp_object);

I think you can replace this ALL_BREAKPOINTS with a call to
get_breakpoint.

Space after the close paren in the cast.

Tom


  reply	other threads:[~2010-10-12 21:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30 16:28 Phil Muldoon
2010-09-30 16:41 ` Daniel Jacobowitz
2010-09-30 17:51   ` Phil Muldoon
2010-09-30 17:55     ` Pedro Alves
2010-09-30 18:12       ` Phil Muldoon
2010-10-08 12:51       ` Phil Muldoon
2010-10-08 13:35         ` Pedro Alves
2010-10-08 14:04           ` Phil Muldoon
2010-10-08 18:44             ` Tom Tromey
2010-10-12 20:25               ` Phil Muldoon
2010-10-12 21:34                 ` Tom Tromey [this message]
2010-10-13 12:45                   ` Phil Muldoon
2010-10-13 13:06                     ` Phil Muldoon
2010-10-13 15:36                     ` Tom Tromey
2010-10-16 18:42                     ` Pedro Alves
2010-10-16 19:03             ` Pedro Alves
2010-10-18 16:09               ` Tom Tromey
2010-10-22 21:05                 ` Phil Muldoon
2010-10-22 21:31                   ` Eli Zaretskii
2010-10-22 21:37                     ` Phil Muldoon
2010-10-23  9:07                       ` Eli Zaretskii
2010-10-31 21:07                   ` Pedro Alves
2010-11-11 14:36                     ` Phil Muldoon
2010-11-12 12:43                       ` Ken Werner
2010-11-12 12:49                         ` Pedro Alves
2010-11-12 12:58                           ` Ken Werner
2010-10-08 18:40         ` Tom Tromey
2010-09-30 17:04 ` Pedro Alves
2010-09-30 17:55   ` Phil Muldoon
2010-09-30 17:51 ` Eli Zaretskii
2010-10-05 22:28 ` Tom Tromey

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=m339sbhz7v.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=dan@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    --cc=pmuldoon@redhat.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