This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Delegate to target_ops->beneath to read cache lines
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 29 Nov 2013 13:47:12 +0000
- Subject: Re: [PATCH] Delegate to target_ops->beneath to read cache lines
- Authentication-results: sourceware.org; auth=none
- References: <1385554824-7159-1-git-send-email-yao at codesourcery dot com> <5295F877 dot 3060004 at redhat dot com> <52980180 dot 1050000 at codesourcery dot com> <529883D7 dot 3030606 at redhat dot com> <52989668 dot 3030604 at codesourcery dot com>
On 11/29/2013 01:28 PM, Yao Qi wrote:
> The endless recursion I saw yesterday is that both current_target.to_xfer_partial
> and current_target.beneath->to_xfer_partial are core_xfer_partial. Looks
> like it delegates to "itself", and causes an endless recursion, so I use
> current_target.beneath instead of ¤t_target. I may mess up
> something then.
Not really. to_xfer_partial is not INHERITed in update_current_target.
current_target.to_xfer_partial is set to current_xfer_partial, which
always delegates to current_target.beneath.
Even it is was inherited, I don't think we'd recurse forever,
because although the callback would be the same, the target_ops
instances are not. It's just that core_xfer_partial would end
up unnecessarily being called twice, before reaching the the exec target:
current_target.to_xfer_partial
==> core_xfer_partial (squashed target, returns 0, try beneath)
current_target.beneath->to_xfer_partial
==> core_xfer_partial (corelow target, returns 0, try beneath)
current_target.beneath->beneath->to_xfer_partial
==> exec_xfer_partial (exec target, returns != 0)
(This is all less clear than it should be; I think
Tromey's target delegation method patch should set us
in the direction of making these things a little clearer.)
--
Pedro Alves