This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v9 21/29] record-btrace: provide xfer_partial target method
- From: Pedro Alves <palves at redhat dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>, "jan dot kratochvil at redhat dot com" <jan dot kratochvil at redhat dot com>
- Date: Mon, 13 Jan 2014 16:42:44 +0000
- Subject: Re: [PATCH v9 21/29] record-btrace: provide xfer_partial target method
- Authentication-results: sourceware.org; auth=none
- References: <1387471499-29444-1-git-send-email-markus dot t dot metzger at intel dot com> <1387471499-29444-22-git-send-email-markus dot t dot metzger at intel dot com> <52B34555 dot 8040200 at redhat dot com> <A78C989F6D9628469189715575E55B230AA3B9AE at IRSMSX104 dot ger dot corp dot intel dot com> <A78C989F6D9628469189715575E55B230AA3B9DE at IRSMSX104 dot ger dot corp dot intel dot com> <52B4688E dot 2090603 at redhat dot com> <52B469FB dot 3090503 at redhat dot com>
On 12/20/2013 04:02 PM, Pedro Alves wrote:
> On 12/20/2013 03:55 PM, Pedro Alves wrote:
>> + /* Check if the section we found is readonly. */
>> + if ((bfd_get_section_flags (section->the_bfd_section->owner,
>> + section->the_bfd_section)
>> + & SEC_READONLY) != 0)
>> + {
>> + /* Truncate the request to fit into this section. */
>> + len = min (len, section->endaddr - offset);
>> + break;
>>
>> ... here, this should return TARGET_XFER_E_IO rather than break and
>> falling through to the code that defers to the target beneath, as the
>> caller will already do that for memory transfers.
>
> Ah, no, ignore that. You need to truncate len, so it wouldn't work
> correctly, of course. Silly me.
BTW, for the record, after sending that, I started thinking that it
might be better/simpler to move this
falling-through-to-the-target-beneath to the targets even for
memory (like in your target), instead of having the core code
do it. That is, remove the loop from raw_memory_xfer_partial.
I think all reasons that might require that memory be handled
differently have disappeared over the years (like., e.g.,
TARGET_OBJECT_RAW_MEMORY now traverses the stack too).
Having all target objects behave the same seems better by not
having special cases. Though I guess only actually trying it
would tell better.
--
Pedro Alves