This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Prelimit number of bytes to read in "vFile:pread:"
- From: Pedro Alves <palves at redhat dot com>
- To: Gary Benson <gbenson at redhat dot com>, gdb-patches at sourceware dot org
- Cc: Sandra Loosemore <sandra at codesourcery dot com>, Joel Brobecker <brobecker at adacore dot com>, Doug Evans <dje at google dot com>, Jan Kratochvil <jan dot kratochvil at redhat dot com>, André Pönitz <apoenitz at t-online dot de>, Paul Koning <Paul_Koning at dell dot com>
- Date: Wed, 19 Aug 2015 12:44:09 +0100
- Subject: Re: [PATCH] Prelimit number of bytes to read in "vFile:pread:"
- Authentication-results: sourceware.org; auth=none
- References: <55D3DB83 dot 4050204 at redhat dot com> <1439980862-21305-1-git-send-email-gbenson at redhat dot com>
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