[PATCH 2/8] add target method delegation
Tom Tromey
tromey@redhat.com
Tue Jul 30 14:47:00 GMT 2013
>>>>> "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
More information about the Gdb-patches
mailing list