This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v9 21/29] record-btrace: provide xfer_partial target method


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]