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, 28 Oct 2013 16:05:00 -0000 [thread overview]
Message-ID: <526E8B54.8040104@redhat.com> (raw)
In-Reply-To: <1382464769-2465-4-git-send-email-tromey@redhat.com>
On 10/22/2013 06:59 PM, Tom Tromey wrote:
> This patch replaces some code in the record targets with target method
> delegation.
>
> Right now there are two latent problems in the record target.
>
> First, record-full.c stores pointers to many target methods when the
> record target is pushed. Then it later delegates some calls via
> these. This is wrong because it violates the target stack contract.
> In particular it is ok to unpush a target at any stratum, but
> record-full does not keep track of this, so it could potentially call
> into an unpushed target.
>
> Second, RECORD_IS_USED and some other spots look at
> current_target.to_stratum to determine whether a record target is in
> use. This is bad because arch_stratum is greater than record_stratum.
>
> To fix the first problem, this patch introduces a handful of
> target_delegate_* functions, which forward calls further down the
> target stack.
>
> To fix the second problem, this patch adds find_target_at to determine
> whether a target appears at a given stratum. This may seem like
> overkill somehow, but I have a subsequent patch series (see archer.git
> tromey/multi-target) that uses it more heavily.
Hmm, I think this is trying to do too much at once.
Could you please split out the patch for the second problem? I
think it'll be a small one.
Then changes like these:
> #define target_stopped_by_watchpoint() \
> - ((*current_target.to_stopped_by_watchpoint) (¤t_target))
> + (target_delegate_stopped_by_watchpoint (¤t_target))
> +
> +/* Delegate "target_stopped_by_watchpoint" to a target beneath SELF. */
> +
> +extern int target_delegate_stopped_by_watchpoint (struct target_ops *self);
switch from using the inheritance scheme to the run-time walk mechanism,
but leave update_current_target still doing the INHERIT/de_fault business.
What's the plan for the existing target methods that
currently already do a similar beneath lookup? I'd like it that
there's be at least a plan, so we don't end up with yet another
way of doing things, two incomplete transitions, and no clear direction.
> + gdb_assert_not_reached (_("reached end of target stack during delegation"));
> +}
This appears in several places. Whenever I see the same string
repeated over and over, I tend to think it'd be good to add a
utility helper function:
static void
assert_end_of_stack_not_reached_or_something (void)
{
gdb_assert_not_reached (_("reached end of target stack during delegation"));
}
Some of the delegation methods have that assert, while others don't
have anything at the tail end. What's the story there?
> +
> +int
> +target_delegate_insert_breakpoint (struct target_ops *self,
> + struct gdbarch *gdbarch,
> + struct bp_target_info *bp_tgt)
> +{
> + struct target_ops *t;
> +
> + for (t = self->beneath; t != NULL; t = t->beneath)
> + {
> + if (t->to_insert_breakpoint)
if (t->to_insert_breakpoint != NULL)
--
Pedro Alves
next prev parent reply other threads:[~2013-10-28 16:05 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 [this message]
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
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=526E8B54.8040104@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