Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: "Sérgio Durigan Júnior" <sergiodj@linux.vnet.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/4] 'catch syscall' feature -- Architecture-independent part
Date: Fri, 03 Oct 2008 06:07:00 -0000	[thread overview]
Message-ID: <20081003060629.GQ3665@adacore.com> (raw)
In-Reply-To: <1223001252.9858.11.camel@miki>

Hi Sergio,

> If I understood correctly, you think it's better to create a "generic"
> bptype so that not only "catch syscall" can use it, right?

That's correct. The short answer is that, if we make your catchpoint
use a more generic type and base the actual implementation of
breakpoint_ops methods, then, later on, when someone decides to
implement a new kind of catchpoint with similar functionality,
then all he should have to do is create a new breakpoint_ops vector
with appropriate methods, and voila.

This is pretty much what happened when I implemented catchpoints
on Ada exception.  If you had a look at my patch, you'll notice
that I didn't have to sprinkle "case bp_my_new_kind" everywhere
to make it work.  To me, this makes me so much more confident
that I didn't miss an update somewhere. But my situation was simpler
than yours, however, because my catchpoints were barely more than just
an elaborated breakpoint.

The longer answer is that I have been wondering about making the
breakpoint structure a little more object-oriented. I have this
Vision (no mushrooms involved so far) where there are really two
types of catchpoints:
  (a): Those that are implemented using one or more breakpoints
  (b): Those that are implemented without the use of breakpoins
Either way, I would like to see these breakpoints as objects,
with methods that we would call:
  (1) insert: Insert the physical breakpoint, or activate the
      associated trace, or...
  (2) remove: The opposite of insert
  (3) is_mind: Return true if an event is recognized by the catchpoint
  (3) print_stop_action, print_one, print_mention.
      (the methods already provided by the breakpoint_ops)
  (4) any other method?
So, when the debugger needs to insert breakpoints, he doesn't have
to know how syscall catchpoints are implemented.  It just calls
the associated "insert" method. Same for removing.  When we receive
an event, we could rely on the "is_mine" method to determine that
we stopped due to this catchpoint, and thus call the associated
methods to tell the user about them. Etc.

The thing is, I haven't designed this part of the code, and I don't
know if the breakpoint_ops were meant to be used such that we could
make the core code completely abstract of which breakpoint was hit.
Nor am I certain that it is actually possible.  But it's definitely
something that I would like to try.

Now, going back to your patch, I think it's important not to let
best be the enemy of good either.  I think that the feature that
you are proposing is interesting and would like to make sure that
we don't lose your work.  I am about to go away on a trip, so will
have little time to review the details of your patch, but looks like
Michael has started on that. I would love for you to investigate
my (ahem) Vision (double-ahem), and I'm ready to guide you as much
as I can.  But I am equally happy to incorporate your approach
if another maintainer looks at your code and OKays it.

> The way I see, there's no problem to implement "catch syscall" using
> another way. However, and I think you already know that, the "catch
> fork", "catch vfork" and "catch exec" are implemented using an entry on
> "enum bptype" (and that's specific why I've chosen to do this). Do you
> think we should change this, too?

Not as part of your patch.  But in the long term, I would like to
migrate them to the breakpoint_ops approach if possible.  That's if
we have determined that it's doable, that is.

> I'm not sure if I understood this part correctly. Maybe my GDB-fu isn't
> good enought yet :-). I'll take a look at breakpoint_ops to see if I can
> understand better what you want.

Hopefully the explainations above might have clarified a little bit
the context. Let me know if there are parts that you'd like me to
expand more.

-- 
Joel


  reply	other threads:[~2008-10-03  6:07 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-30 18:12 Sérgio Durigan Júnior
2008-10-02 21:13 ` Joel Brobecker
2008-10-03  2:33   ` Sérgio Durigan Júnior
2008-10-03  6:07     ` Joel Brobecker [this message]
2008-10-03 17:52       ` Daniel Jacobowitz
2008-10-04 23:07         ` Sérgio Durigan Júnior
2008-10-04 23:04       ` Sérgio Durigan Júnior
2008-10-06 17:22         ` Joel Brobecker
2008-10-10 13:12           ` Daniel Jacobowitz
2008-10-10 15:28           ` Sérgio Durigan Júnior
2008-10-12  2:26           ` Sérgio Durigan Júnior
2008-10-15  5:40             ` Joel Brobecker
2008-10-16  3:35               ` Sérgio Durigan Júnior
2008-10-16 12:37                 ` Daniel Jacobowitz
2008-10-16 15:17                   ` Daniel Jacobowitz
2008-10-16 16:28                     ` Joel Brobecker
2008-11-04  4:32 Sérgio Durigan Júnior
2008-11-04 16:17 ` Pedro Alves
2008-11-07  3:30   ` Sérgio Durigan Júnior
2008-11-07 12:12     ` Pedro Alves
2008-11-07 13:30       ` Daniel Jacobowitz
2008-11-08 15:35       ` Sérgio Durigan Júnior
2008-11-04 17:57 ` Tom Tromey
2008-11-04 21:55   ` Thiago Jung Bauermann
2008-11-04 22:33     ` Tom Tromey
2008-11-05 19:05       ` Tom Tromey
2008-11-05 19:13         ` Sérgio Durigan Júnior
2008-11-07  3:41         ` Sérgio Durigan Júnior
2008-11-07  3:39   ` Sérgio Durigan Júnior
2008-11-07 18:21     ` Tom Tromey
2008-11-04 21:13 ` Eli Zaretskii
2008-11-04 22:12   ` Thiago Jung Bauermann
2008-11-04 22:22     ` Eli Zaretskii
2008-11-04 22:35       ` Daniel Jacobowitz
2008-11-05  4:19         ` Eli Zaretskii
2008-11-05 13:34           ` Sérgio Durigan Júnior
2008-11-05 18:42             ` Eli Zaretskii
2008-11-08 19:31             ` Mark Kettenis
2008-11-05 14:55           ` Daniel Jacobowitz
2008-11-05 18:43             ` Eli Zaretskii
2008-11-05 18:59               ` Daniel Jacobowitz
2008-11-05 19:11                 ` Eli Zaretskii
2008-11-06 23:03               ` Mark Kettenis
2008-11-04 22:31     ` Pedro Alves
2008-11-05  4:10       ` Eli Zaretskii
2008-11-05 12:29         ` Pedro Alves
2008-11-05 18:38           ` Eli Zaretskii
2008-11-05 18:57             ` Pedro Alves
2008-11-05 19:10               ` Eli Zaretskii
2008-11-05 19:34                 ` Pedro Alves
2008-11-05 20:36                   ` Eli Zaretskii
2008-11-05 21:10                     ` Pedro Alves
2008-11-06  4:27                       ` Eli Zaretskii
2008-11-06 14:32                         ` Pedro Alves
2008-11-07  9:59                           ` Eli Zaretskii
2008-11-07 10:10                             ` Pedro Alves
2008-11-05 13:32         ` Mark Kettenis

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=20081003060629.GQ3665@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@linux.vnet.ibm.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