This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/8] add target method delegation
- From: Tom Tromey <tromey at redhat dot com>
- To: "Metzger\, Markus T" <markus dot t dot metzger at intel dot com>
- Cc: "gdb-patches\ at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 30 Jul 2013 08:47:18 -0600
- Subject: Re: [PATCH 2/8] add target method delegation
- References: <1375116324-32092-1-git-send-email-tromey at redhat dot com> <1375116324-32092-3-git-send-email-tromey at redhat dot com> <A78C989F6D9628469189715575E55B230A98E0FE at IRSMSX104 dot ger dot corp dot intel dot com>
>>>>> "Markus" == Metzger, Markus T <markus.t.metzger@intel.com> writes:
Markus> Once we have all the delegates in place, shouldn't we rewrite
Markus> the original target_~ functions to call the respective
Markus> target_delegate_~ with ¤t_target as first argument?
Yeah, that would be good.
Tom> To fix the second problem, this patch adds find_target_at to determine
Tom> whether a target appears at a given stratum. This may seem like
Tom> overkill somehow, but I have a subsequent patch series (see archer.git
Tom> tromey/multi-target) that uses it more heavily.
Markus> I'd rather consistently add struct target_opc *self as first
Markus> parameter to all target functions.
I considered this, but the difficulty is that I can't test, or even
compile, a reasonable subset of the changes.
If that doesn't bother people then I'm happy to change things that way.
I do think it would be cleaner.
Markus> Otherwise, we rely on the fact that the target doing the
Markus> delegation is at the top of its stratum. This holds for record
Markus> targets and I may be ignorant enough to not realize that this
Markus> holds in general. If we could have another target on top of us
Markus> in the same stratum, though, we would delegate to ourselves.
Only a single target can appear at a given stratum. This is enforced by
push_target. This is pretty obscure due to how the code is written; but
with my other target stack series this becomes more obvious.
So I don't think there is an issue here. However, I do agree that it is
a violation of the abstraction.
Tom