Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 4/4] Introduce class target_stack
Date: Tue, 29 May 2018 11:34:00 -0000	[thread overview]
Message-ID: <87h8mrxify.fsf@tromey.com> (raw)
In-Reply-To: <20180528161041.32497-5-palves@redhat.com> (Pedro Alves's message	of "Mon, 28 May 2018 17:10:41 +0100")

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> The problem then is in finding a target's "beneath" target, if we
Pedro> consider that for some target_ops types, we'll be sharing a
Pedro> single target_ops instance between several inferiors.  For
Pedro> example, so far, I found no need to have multiple instances of
Pedro> the spu_multiarch_target / exec_target / dummy_target targets.

Is it the case that sometimes a particular target_ops instance will have
to be shared among multiple target stacks?

If so, then this all makes sense to me.

If not, then it seems maybe slightly off, because then if you need to
add state to some existing target_ops, you will have to check whether it
is shareable and then ensure it is unshared -- does this make sense?
But on the other hand, an instance of something like dummy_target should
be cheap (sizeof == 24 here).  So maybe a simpler rule is available.

On the third hand, it's only slightly off, and I don't want to get in
the way of this important project; but I would still like to understand.

Pedro> +/* The target stack.  */
Pedro> +static target_stack g_target_stack;

As an aside, I often wonder about blank lines between comments and
definitions.

I prefer not to have them, though not for any actual reason.  But some
spots have them and some do not, so in practice what I do is either
follow the local style; or leave the blank line out if I think I can; or
else feel guilty since I vaguely recall there was a rule to have one and
so put it in even though I'd rather not.

Pedro> +   Note that rather than allow an empty stack, we always have the
Pedro> +   dummy target at the bottom stratum, so we can call the function
Pedro> +   vectors without checking them.  */

Probably just "methods" rather than "function vectors".

Tom


  reply	other threads:[~2018-05-29  3:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-28 16:10 [PATCH 0/4] Change target stack representation Pedro Alves
2018-05-28 16:10 ` [PATCH 1/4] target_stack -> current_top_target() throughout Pedro Alves
2018-05-29  3:13   ` Tom Tromey
2018-05-28 16:19 ` [PATCH 2/4] target_ops::beneath -> target_ops::beneath() Pedro Alves
2018-05-28 17:39 ` [PATCH 3/4] Eliminate find_target_beneath Pedro Alves
2018-05-28 17:47 ` [PATCH 4/4] Introduce class target_stack Pedro Alves
2018-05-29 11:34   ` Tom Tromey [this message]
2018-05-29 14:59     ` 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=87h8mrxify.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@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