From: Doug Evans <dje@google.com>
To: Tom Tromey <tromey@redhat.com>
Cc: pmuldoon@redhat.com, gdb-patches@sourceware.org
Subject: Re: [patch] Add an evaluation function hook to Python breakpoints.
Date: Wed, 15 Dec 2010 16:21:00 -0000 [thread overview]
Message-ID: <AANLkTimVN=3CKL2VmKWERSmGxiMA7wDv7pMrSQZc1DMO@mail.gmail.com> (raw)
In-Reply-To: <m34oags1q1.fsf@fleche.redhat.com>
On Tue, Dec 14, 2010 at 9:28 AM, Tom Tromey <tromey@redhat.com> wrote:
> This patch addresses two bits of functionality we have needed in Python.
>
> First, we need a clean way to run some code at a given breakpoint
> location -- but with the caveats that the code always be run, regardless
> of other breakpoints, and that the code not interfere with stepping.
>
> By "clean" I just mean that we want it not to have user-visible effects
> other than the effects we intend. Yes, we can do it using a python
> convenience function -- but the convenience function's name is visible
> and in a flat namespace.
The reference to convenience functions was *not* a serious attempt at
arguing against doing something.
It was just an off the cuff comment regarding hacky solutions.
> The use case for this is something like gdb-heap, where we want to
> install a breakpoint that collects some information but doesn't
> interfere with ordinary debugging.
>
>
> Second, we want a way to stop the inferior when such the data collection
> step decides. Our use case here is a (to-be-written) mutex-tracking
> extension, that collects information about pthread locking and
> unlocking, and stops when a deadlock is detected.
Right. These are the "existing needs" I was referring to.
> Doug> I realize the _p convention mightn't be sufficiently common to use in
> Doug> the Python API, but for example a better name might be stop_p.
> Doug> And then one would have another method (I don't have a good name for
> Doug> it ATM) to use to collect data.
> Doug> Setting aside name choices, I like that API better.
>
> Having two methods seems worse to me. It is more complicated without
> any added benefits.
One thought I had was that maybe one might have a situation where it'd
be useful to run all the collect methods first, and then run all the
stop_p methods.
Plus I still like the API design of keeping data collection separate
from stop/don't-stop.
> First, both such methods will be called in the same place in gdb. This
> is necessary to implement the needed features. But then .. why call two
> methods when you can just call one?
>
> Second, consider the mutex-watching use case. To implement this in the
> two-method case, you must have the data collector set a flag, which is
> then returned by the condition method. Or ... just do all the work in
> the condition method -- which is where we are now.
Setting a flag seems hardly onerous.
But don't let my $0.02 cents get in the way ... btw ...
If you *really* want to go this route, go for it.
Btw, if some mutex-checker or whatever detected a condition that it
wanted to report to the user, IWBN to be able to throw an error that
some higher level construct could recognize and deal with.
Is a simple boolean result from stop_p (I'm only calling that for
clarity's sake) going to be sufficient?
[Heh. And if one bkpt did throw an error in stop_p, one might have
wished one could have collected one's own data first. 1/2 :-)]
next prev parent reply other threads:[~2010-12-15 16:21 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-13 13:50 Phil Muldoon
2010-12-13 14:19 ` Eli Zaretskii
2010-12-13 14:47 ` Phil Muldoon
2010-12-13 15:07 ` Eli Zaretskii
2010-12-13 17:21 ` Phil Muldoon
2010-12-13 17:46 ` Eli Zaretskii
2010-12-13 14:33 ` Pedro Alves
2010-12-13 14:56 ` Phil Muldoon
2010-12-13 15:07 ` Pedro Alves
2010-12-13 20:45 ` Doug Evans
2010-12-13 21:02 ` Phil Muldoon
2010-12-14 3:31 ` Doug Evans
2010-12-14 17:18 ` Phil Muldoon
2010-12-14 17:28 ` Tom Tromey
2010-12-14 19:51 ` Phil Muldoon
2010-12-14 20:00 ` Phil Muldoon
2010-12-15 15:34 ` Phil Muldoon
2010-12-15 20:51 ` Tom Tromey
2011-01-27 12:44 ` Phil Muldoon
[not found] ` <AANLkTimi6ugruNAqUGHni8Kvkz+B5-s2aAkEoTY2D_gT@mail.gmail.com>
2011-01-27 21:40 ` Phil Muldoon
2011-01-28 10:42 ` Tom Tromey
2010-12-15 16:21 ` Doug Evans [this message]
2010-12-15 20:57 ` Tom Tromey
2010-12-21 17:33 ` Doug Evans
2010-12-21 20:02 ` Tom Tromey
2010-12-22 16:34 ` Doug Evans
2010-12-22 17:35 ` Tom Tromey
2010-12-28 5:53 ` Doug Evans
2011-01-05 18:35 ` Tom Tromey
2011-01-05 20:23 ` Phil Muldoon
2011-01-09 20:32 ` Doug Evans
2010-12-14 17:46 ` Pedro Alves
2010-12-14 16:35 ` Tom Tromey
2010-12-14 17:02 ` Phil Muldoon
2010-12-14 17:48 ` Tom Tromey
2010-12-14 16:42 ` 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='AANLkTimVN=3CKL2VmKWERSmGxiMA7wDv7pMrSQZc1DMO@mail.gmail.com' \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--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