Re: [PATCH 5/6] Return target_xfer_status in to_xfer_partial

Yao Qi
2014-02-07T02:11:20Z

On 02/06/2014 10:44 PM, Pedro Alves wrote:
>> -static LONGEST
>> > +static enum target_xfer_status
>> > target_read_live_memory (enum target_object object,
>> > - ULONGEST memaddr, gdb_byte *myaddr, ULONGEST len)
>> > + ULONGEST memaddr, gdb_byte *myaddr, ULONGEST len,
>> > + ULONGEST *xfered_len)
>> > {
>> > - LONGEST ret;
>> > + enum target_xfer_status ret;
>> > struct cleanup *cleanup;
>> >
>> > /* Switch momentarily out of tfind mode so to access live memory.
>> > @@ -1326,8 +1327,8 @@ target_read_live_memory (enum target_object object,
>> > cleanup = make_cleanup_restore_traceframe_number ();
>> > set_traceframe_number (-1);
>> >
>> > - ret = target_read (current_target.beneath, object, NULL,
>> > - myaddr, memaddr, len);
>> > + ret = target_xfer_partial (current_target.beneath, object, NULL,
>> > + myaddr, NULL, memaddr, len, xfered_len);
> This doesn't seem equivalent?
>

We added 'xfered_len' to target_read_live_memory, so we don't have to
call target_read which tries to read all the requested data once.
Instead, we call target_xfer_partial here which stores the length of
transferred data in *xfered_len and target_xfer_partial here fits in the
new target xfer infrastructure.

--
Yao (é½å°§)