From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25669 invoked by alias); 14 Sep 2009 19:17:16 -0000 Received: (qmail 25660 invoked by uid 22791); 14 Sep 2009 19:17:16 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Sep 2009 19:17:11 +0000 Received: from spaceape9.eur.corp.google.com (spaceape9.eur.corp.google.com [172.28.16.143]) by smtp-out.google.com with ESMTP id n8EJH1pf013301; Mon, 14 Sep 2009 20:17:02 +0100 Received: from localhost (ruffy.mtv.corp.google.com [172.18.118.116]) by spaceape9.eur.corp.google.com with ESMTP id n8EJGwHG007084; Mon, 14 Sep 2009 12:16:58 -0700 Received: by localhost (Postfix, from userid 67641) id E32D6844C3; Mon, 14 Sep 2009 12:16:57 -0700 (PDT) To: gdb-patches@sourceware.org, Marc Khouzam , Greg Law cc: Pedro Alves , Michael Snyder , Hui Zhu Subject: [patch] only update dcache after write succeeds Message-Id: <20090914191657.E32D6844C3@localhost> Date: Mon, 14 Sep 2009 19:17:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true 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/msg00439.txt.bz2 Hi. Marc, Greg: Can you see if this patch fixes things for you? 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;