From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v4 3/9] add target method delegation
Date: Mon, 16 Dec 2013 13:07:00 -0000 [thread overview]
Message-ID: <52AEFB0A.3090104@redhat.com> (raw)
In-Reply-To: <871u1gz9q2.fsf@fleche.redhat.com>
On 12/13/2013 10:07 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
>
> Tom> Since this is very repetitive I would consider doing it via a ".defs"
> Tom> file and then some macrology to reduce the amount of boilerplate.
>
> I tried this a bit and the result was pretty ugly.
>
> Instead I wrote a little script that can parse just enough of "struct
> target_ops" to auto-generate delegation methods when appropriate.
>
> See patch #1 attached below. This patch just converts the methods used
> by the record targets -- that is, it's just a replacement for patch #3
> in this series.
>
> Note that the patch isn't ready as-is. The log entry is wrong and it
> does the wrong thing for a couple of the target methods. I'm curious to
> know what you think about the overall shape of it.
I like it a lot.
>
>
> As an example of the benefit of this approach, patch #2 converts
> to_detach to the new style. When examining this patch recall that
> target-delegates.c is auto-generated. You can see from this that the
> result is less code to maintain.
>
>
> I then went a little further. It seems to me that we also need a lot of
> boilerplate (not to mention the questionable casts there right now) to
> handle the dummy target methods. Patch #3 makes these into simple
> annotations in the target.h file, getting rid of the list of handled
> methods from make-target-delegates as well.
Nice.
>
>
> Before reaching judgment on patch #3, see patch #4, which converts
> to_attach. I've written a few more like it.
>
>
> The long-term vision for this approach is to regularize all target
> methods according to these rules:
>
> 1. Each method will take a "struct target_ops *" as its first argument.
>
> 2. Nearly every method will be defaulted to the appropriate delegate_
> method. There may be exceptions, coded into
> complete_target_initialization.
>
> 3. de_fault will be completely eliminated. INHERIT will be limited to
> the smallest possible list of fields, like to_shortname. Nearly
> every current_target method will simply delegate.
Sounds like the squashed target will end up mostly unused? It sounds
to me that even for those (data fields) we wouldn't need INHERIT. As
all targets have a name, e.g., target_shortname could be made a method
that returns the name of the currently topmost target in the stack
(not the squashed target).
>
> 4. Target API users will call top-level target_* functions that will in
> most cases just call into current_target.
>
> 5. Any given to_* method implementation will be guaranteed to be called
> with the target_ops with which it was registered. (This rule is
> handy on multi-target, where I split out the target_ops vtable from
> the object itself.)
>
>
> Since I'm on a cleanup kick at the moment, and since a good amount of
> this is relevant to the multi-target work, I think it would be good to
> start the conversion shortly after 7.7 is branched.
>
> This is a bit difficult since I don't have access to many targets. I'm
> not sure what to do about this aspect.
What I've done in that past for this sort of thing is just go ahead
and do the almost mechanical adjustment across the board, and don't
fret about it if something breaks. Publish git test branches, IOW,
make it very easy for people to test, report issues and hopefully
help with targets they care about should help drive this through
faster.
--
Pedro Alves
next prev parent reply other threads:[~2013-12-16 13:07 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-22 17:59 [PATCH v4 0/9] enable target-async by default Tom Tromey
2013-10-22 17:59 ` [PATCH v4 1/9] fix latent bugs in ui-out.c Tom Tromey
2013-10-28 15:20 ` Pedro Alves
2013-10-28 17:36 ` Tom Tromey
2013-10-22 17:59 ` [PATCH v4 5/9] PR gdb/13860: make "-exec-foo"'s MI output equal to "foo"'s MI output Tom Tromey
2013-10-22 17:59 ` [PATCH v4 2/9] add "this" pointers to more target APIs Tom Tromey
2013-10-28 16:04 ` Pedro Alves
2013-10-28 16:37 ` Tom Tromey
2013-10-28 16:44 ` Pedro Alves
2013-10-28 16:52 ` Tom Tromey
2013-11-08 18:04 ` Pedro Alves
2013-11-08 21:53 ` Tom Tromey
2013-11-09 3:35 ` Pedro Alves
2013-12-06 17:40 ` Tom Tromey
2013-12-06 18:35 ` Pedro Alves
2013-12-06 18:23 ` Tom Tromey
2013-12-06 19:06 ` Pedro Alves
2013-10-22 17:59 ` [PATCH v4 3/9] add target method delegation Tom Tromey
2013-10-28 16:05 ` Pedro Alves
2013-10-28 17:51 ` Tom Tromey
2013-10-28 17:53 ` Tom Tromey
2013-10-29 20:55 ` Tom Tromey
2013-11-08 17:44 ` Pedro Alves
2013-12-11 22:03 ` Tom Tromey
2013-12-12 2:46 ` Tom Tromey
2013-12-13 22:07 ` Tom Tromey
2013-12-16 13:07 ` Pedro Alves [this message]
2013-12-16 21:21 ` Tom Tromey
2013-12-17 16:17 ` Pedro Alves
2013-12-18 18:29 ` Tom Tromey
2013-12-18 22:06 ` Tom Tromey
2013-12-19 16:03 ` Pedro Alves
2013-12-19 16:15 ` Tom Tromey
2013-12-20 19:24 ` Tom Tromey
2013-11-08 16:34 ` Pedro Alves
2013-10-22 17:59 ` [PATCH v4 4/9] PR gdb/13860: make -interpreter-exec console "list" behave more like "list" Tom Tromey
2013-10-22 18:11 ` [PATCH v4 8/9] fix py-finish-breakpoint.exp with always-async Tom Tromey
2013-11-11 19:51 ` Pedro Alves
2013-12-09 17:53 ` Tom Tromey
2013-10-22 18:26 ` [PATCH v4 6/9] PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s output in async mode Tom Tromey
2013-10-22 18:26 ` [PATCH v4 9/9] enable target-async Tom Tromey
2013-10-22 20:15 ` Eli Zaretskii
2013-11-11 19:54 ` Pedro Alves
2013-11-12 20:53 ` Pedro Alves
2013-11-15 0:45 ` Tom Tromey
2013-11-18 15:42 ` Pedro Alves
2013-12-06 20:44 ` Tom Tromey
2013-12-09 12:01 ` Pedro Alves
2013-12-09 15:57 ` Tom Tromey
2014-02-21 20:23 ` Tom Tromey
2014-02-24 17:38 ` Tom Tromey
2013-10-22 19:00 ` [PATCH v4 7/9] make dprintf.exp pass in always-async mode Tom Tromey
2013-11-12 0:05 ` Pedro Alves
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=52AEFB0A.3090104@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--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