Re: [PATCH] Prelimit number of bytes to read in "vFile:pread:"

Pedro Alves
2015-08-19T11:44:15Z

On 08/19/2015 11:41 AM, Gary Benson wrote:
> Pedro Alves wrote:
>> The fact that Gary's chunk size limiting patch made things much
>> faster on the nios2 board is still mysterious to me. I'd expect the
>> slowness to be latency bound, given the request/response nature of
>> the RSP, but then I'd expect that more chunking would slow things
>> down, not speed it up.
>
> I think I figured this out...
>
> While handling "vFile:pread:" packets, gdbserver would read the
> number of bytes requested regardless of whether this would fit
> into the reply packet. gdbserver would then return a packet's
> worth of data and discard the remainder. When accessing large
> binaries GDB (via BFD) routinely makes large "vFile:pread:"
> requests, resulting in gdbserver allocating large unnecessary
> buffers and reading some portions of the file many times over.
>
> This commit causes gdbserver to limit the number of bytes to be
> read to a sensible maximum prior to allocating buffers and reading
> data.
>
> Built and regtested on RHEL 6.6 x86_64.
>
> May I push this to HEAD and to the branch?

OK.

Thanks,
Pedro Alves