Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
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: Thu, 19 Dec 2013 16:03:00 -0000	[thread overview]
Message-ID: <52B318B7.8090506@redhat.com> (raw)
In-Reply-To: <87wqj1lsp8.fsf@fleche.redhat.com>

On 12/18/2013 10:06 PM, Tom Tromey wrote:
> Pedro> Yeah, not sure either...  squash a few; post only the non-trivial
> Pedro> ones as email; post all of them at once anyway; split in 4 or
> Pedro> 5 batches.  Whatever really is fine with me.
> 
> In case you want to see my progress, I've pushed the current branch to
> my gitorious repository:
> 
> git@gitorious.org:binutils-gdb/gdb.git

I guess that only works for you.  I used:

  git://gitorious.org/binutils-gdb/gdb.git

I like what I see a lot.

> 
> The branch is "target-cleanup".
> 
> I've built the branch but barely tested it.  I'm sure it breaks in some
> configurations -- the fixes are trivial but I did have to do a number of
> them as my refactoring script, while fun, could not perfectly fix
> everything.
> 
> Aside from a few patches at the beginning of the series I think it's all
> split and ordered pretty much as I'd like it to be.
> 
> I converted all the easy target methods to the new inheritance scheme.
> This works out to be nearly all of them.  There are a few more that
> aren't too bad to convert (actually, looking again now I see I missed a
> few more easy ones), and then a handful of tricky ones.
> 
> It's over the 200 patch mark... not sure I want to write those
> ChangeLogs (my refactoring script only did the first 100 or so for
> me...) or even re-read them all for sanity.
> 
> I hope you will agree that the result is much cleaner.  It's simpler to
> explain and understand; and it is obvious which model one ought to
> choose when adding new target methods.  It's also a good setup for the
> multi-target work.

Yes, I definitely agree.

Only thing I wonder is whether:

> /* This is used to indicate the default implementation for a target
>    method.  It is handled by make-target-delegates.  The argument can be:
>    . A simple constant, like "0", in which case the default method
>    returns the constant.
>    . A function call, like "tcomplain ()", in which case the default
>    method simply calls the function.  Ordinarily such functions must
>    therefore be "noreturn".
>    . The name of a function, like "memory_insert_breakpoint", in which
>    case the named function is used as the default method.  */
> #define TARGET_DEFAULT(ARG)

wouldn't be better be made less smart, and require explicit
selection.  I'm thinking of grepability, but mainly, to be
able to distinguish returning enums vs forwarding.  As in, for
example, how do you tell that:

          TARGET_DEFAULT(TARGET_XFER_E_IO)

is not meant to forward to a TARGET_XFER_E_IO target-like
function?  We could look at whether the symbol is uppercase,
but then that seems to be getting fragile and harder
to explain/read/'quickly grasp what happens if you're not
familiar with the target symbols'.

#define TARGET_DEFAULT_FORWARD(function_to_forward_to)
   e.g.:  TARGET_DEFAULT_FORWARD(memory_insert_breakpoint)

#define TARGET_DEFAULT_RET(expression) // constant, function call, etc.
   e.g.:  TARGET_DEFAULT_RET(0)
          TARGET_DEFAULT_RET(TARGET_XFER_E_IO)
          TARGET_DEFAULT_RET(return_zero ())

#define TARGET_DEFAULT_NO_RET(noreturn function/expression)
   e.g.: TARGET_DEFAULT_NO_RET(noprocess ())

(I'm hating the idea of such a change causing a bunch of
redo-series pain, so even if it proves better to be explicit,
I'm fine with leaving it as is for now.)

-- 
Pedro Alves


  reply	other threads:[~2013-12-19 16:03 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 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
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 [this message]
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 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 4/9] PR gdb/13860: make -interpreter-exec console "list" behave more like "list" 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 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=52B318B7.8090506@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