Problem after hitting breakpoint on Windows (with GDBserver)

Pedro Alves palves@redhat.com
Tue Mar 13 14:52:00 GMT 2012


On 03/13/2012 02:24 PM, Jan Kratochvil wrote:

> On Tue, 13 Mar 2012 02:39:15 +0100, Joel Brobecker wrote:
>>     One way to fix that problem was to lift that limitation, by using
>>     a temporary buffer inside memory_xfer_partial, and then copy the
>>     contents of that buffer into the target buffer after the two steps
>>     are complete. But Pedro felt it was too heavy a hammer.
> 
> This problem was affecting also gdbserver which I fixed in December:
> 	[patch] gdbserver: Fix overlapping memcpy (safe now)
> 	http://sourceware.org/ml/gdb-patches/2011-12/msg00057.html
> 
> I tried now shortly and I cannot reproduce the valgrind errors for GDB with
> gdbserver with disabled z* packets but according to the code and according to
> you description it looks as the same problem.


Yeah, it's similar.

> Isn't it safer to fix all the cases?


Joel's patch is equivalent to yours to gdbserver.  It fixes the only code
that needs to bother with this, which is the code that writes to the
shadow buffers.  All other callers don't need to worry about this overlap,
and thus we can avoid heap allocating a temporary buffer as large as the
transfer len for all reads.

I think we could put asserts in breakpoint_xfer_memory like those of
check_mem_read/check_mem_write.

-- 
Pedro Alves



More information about the Gdb-patches mailing list