Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <xdje42@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: Tom Tromey <tromey@redhat.com>,
	gdb-patches@sourceware.org, pmuldoon@redhat.com, 	eliz@gnu.org
Subject: Re: [PATCH, doc RFA] Allow CLI and Python conditions to be set on same breakpoint
Date: Fri, 15 Nov 2013 06:39:00 -0000	[thread overview]
Message-ID: <CAP9bCMRMZGrBgpToFp4RzA0f9TthKy8Kg9hqL_ENX=6B0yUdzg@mail.gmail.com> (raw)
In-Reply-To: <52853D8A.5070908@redhat.com>

On Thu, Nov 14, 2013 at 1:15 PM, Pedro Alves <palves@redhat.com> wrote:
> On 11/14/2013 08:53 PM, Tom Tromey wrote:
>>>>>>> "Doug" == Doug Evans <xdje42@gmail.com> writes:
>>
>> Doug> +A breakpoint may have both a normal breakpoint condition
>> Doug> +(@pxref{Conditions, ,Break Conditions}) and a Python
>> Doug> +@code{gdb.Breakpoint.stop} condition.
>> Doug> +Both will be evaluated and if either return @code{True} then the
>> Doug> +inferior will be stopped, otherwise the inferior will continue.
>>
>> I'm not certain that these are the best semantics.
>>
>> A motivating case for the Python "stop" method was to be able to let
>> Python authors write new kinds of breakpoints.
>>
>> Say, for example, one wanted a breakpoint that triggered based on a
>> Python source file and line.  One could implement this by putting a
>> breakpoint in the Python interpreter with a suitable "stop" method.
>>
>> In order for this to make sense, all the non-matching calls in the
>> interpreter must be discarded.  That is, stop returns false.
>>
>> In this scenario, your proposed patch would go on to evaluate the
>> condition and perhaps break anyway.
>> But this violates the whole idea of
>> the new breakpoint.  Here, the CLI condition would most usefully be an
>> additional condition -- not a parallel one.
>
> That does make sense.  In that scenario, it then sounds like it's
> best to think of the "stop" method more like a ops->check_status
> implementation/extension, than a breakpoint condition.

Need More Data.
In this scenario, when would one typically add a CLI condition to such
a Python interpreter breakpoint?

Plus if this is really a check_status thing then I wonder if
gdb.Breakpoint is going down the wrong path and we should be providing
a class where users can override breakpoint_ops.

>> This particular example would be better with some other additions to the
>> gdb breakpoint API; and maybe those would obviate the need for this dual
>> purposing.  But since we don't have those additions, it remains unclear
>> to me that "|" is better than "&&" here.
>
> Yeah, it does sound like && is more useful.  To get "|", the user can
> set another breakpoint at the same address/whatever with a cli condition.

That's a good point.


  reply	other threads:[~2013-11-15  5:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-13  8:11 [commit] breakpoint.c (breakpoint_cond_eval): Fix and enhance comment Doug Evans
2013-11-14 17:58 ` [PATCH, doc RFA] Allow CLI and Python conditions to be set on same breakpoint Doug Evans
2013-11-14 18:44   ` Pedro Alves
2013-11-14 20:22   ` Phil Muldoon
2013-11-14 20:54   ` Tom Tromey
2013-11-14 21:21     ` Pedro Alves
2013-11-15  6:39       ` Doug Evans [this message]
2013-11-15 12:06         ` Pedro Alves
2013-11-15 16:30           ` Doug Evans
2013-11-15 16:45             ` Pedro Alves
2013-11-17 17:22               ` Doug Evans
2013-11-15 20:58         ` Tom Tromey
2013-11-17 17:59           ` Doug Evans

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='CAP9bCMRMZGrBgpToFp4RzA0f9TthKy8Kg9hqL_ENX=6B0yUdzg@mail.gmail.com' \
    --to=xdje42@gmail.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=pmuldoon@redhat.com \
    --cc=tromey@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