From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10709 invoked by alias); 13 Mar 2012 14:52:01 -0000 Received: (qmail 10629 invoked by uid 22791); 13 Mar 2012 14:51:58 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Mar 2012 14:51:38 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2DEpF3I001602 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 Mar 2012 10:51:15 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q2DEpEOW021695; Tue, 13 Mar 2012 10:51:14 -0400 Message-ID: <4F5F5EE2.7060009@redhat.com> Date: Tue, 13 Mar 2012 14:52:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: Jan Kratochvil CC: Joel Brobecker , gdb-patches@sourceware.org Subject: Re: Problem after hitting breakpoint on Windows (with GDBserver) References: <1331602756-23567-1-git-send-email-brobecker@adacore.com> <20120313142418.GA29255@host2.jankratochvil.net> In-Reply-To: <20120313142418.GA29255@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-03/txt/msg00436.txt.bz2 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