From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29929 invoked by alias); 14 Sep 2009 19:26:33 -0000 Received: (qmail 29920 invoked by uid 22791); 14 Sep 2009 19:26:32 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Sep 2009 19:26:25 +0000 Received: from jupiter.vmware.com (mailhost5.vmware.com [10.16.68.131]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id F2F56130B2; Mon, 14 Sep 2009 12:26:23 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by jupiter.vmware.com (Postfix) with ESMTP id E296ADC056; Mon, 14 Sep 2009 12:26:23 -0700 (PDT) Message-ID: <4AAE98F1.3000501@vmware.com> Date: Mon, 14 Sep 2009 19:26:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Doug Evans CC: "gdb-patches@sourceware.org" , Marc Khouzam , Greg Law , Pedro Alves , Hui Zhu Subject: Re: [patch] only update dcache after write succeeds References: <20090914191657.E32D6844C3@localhost> In-Reply-To: <20090914191657.E32D6844C3@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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: 2009-09/txt/msg00440.txt.bz2 Doug Evans wrote: > Hi. > > Marc, Greg: Can you see if this patch fixes things for you? Hey Doug, I tested this change, and it does indeed seem to fix the problem with target record -- but. ;-) Part of the reason that it works is that record_xfer_partial calls error() instead of returning -1. If I change it so that it returns -1, things get more complicated. The do-while loop that used to follow and now preceeds this code calls target-beneath, which in our case results in several different target methods being called, one of which eventually returns > 0. That just means that in the present case, calling error is correct. But I worry about some of the other cases where the target method returns -1, and whether badness might occur in some other cases. Michael > 2009-09-14 Doug Evans > > * target.c (memory_xfer_partial): Only update dcache after we know > the write succeeded. > > Index: target.c > =================================================================== > RCS file: /cvs/src/src/gdb/target.c,v > retrieving revision 1.223 > diff -u -p -r1.223 target.c > --- target.c 8 Sep 2009 23:52:45 -0000 1.223 > +++ target.c 14 Sep 2009 19:11:38 -0000 > @@ -1289,19 +1289,6 @@ memory_xfer_partial (struct target_ops * > } > } > > - /* Make sure the cache gets updated no matter what - if we are writing > - to the stack, even if this write is not tagged as such, we still need > - to update the cache. */ > - > - if (inf != NULL > - && readbuf == NULL > - && !region->attrib.cache > - && stack_cache_enabled_p > - && object != TARGET_OBJECT_STACK_MEMORY) > - { > - dcache_update (target_dcache, memaddr, (void *) writebuf, reg_len); > - } > - > /* If none of those methods found the memory we wanted, fall back > to a target partial transfer. Normally a single call to > to_xfer_partial is enough; if it doesn't recognize an object > @@ -1331,6 +1318,20 @@ memory_xfer_partial (struct target_ops * > if (readbuf && !show_memory_breakpoints) > breakpoint_restore_shadows (readbuf, memaddr, reg_len); > > + /* Make sure the cache gets updated no matter what - if we are writing > + to the stack. Even if this write is not tagged as such, we still need > + to update the cache. */ > + > + if (res > 0 > + && inf != NULL > + && writebuf != NULL > + && !region->attrib.cache > + && stack_cache_enabled_p > + && object != TARGET_OBJECT_STACK_MEMORY) > + { > + dcache_update (target_dcache, memaddr, (void *) writebuf, reg_len); > + } > + > /* If we still haven't got anything, return the last error. We > give up. */ > return res;