Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Marc Khouzam <marc.khouzam@ericsson.com>
To: "'Michael Snyder'" <msnyder@vmware.com>, "'Doug Evans'" <dje@google.com>
Cc: "'gdb-patches@sourceware.org'" <gdb-patches@sourceware.org>,
	        "'Greg Law'" 	<glaw@undo-software.com>,
	        "'Pedro Alves'" <pedro@codesourcery.com>,
	        "'Hui Zhu'" 	<teawater@gmail.com>
Subject: RE: [patch] only update dcache after write succeeds
Date: Mon, 14 Sep 2009 19:29:00 -0000	[thread overview]
Message-ID: <F7CE05678329534C957159168FA70DEC515363D1E3@EUSAACMS0703.eamcs.ericsson.se> (raw)
In-Reply-To: <4AAE98F1.3000501@vmware.com>

 

> -----Original Message-----
> From: Michael Snyder [mailto:msnyder@vmware.com] 
> Sent: Monday, September 14, 2009 3:27 PM
> 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
> 
> 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.

Just a note that PRecord used to return -1 which caused memory
to be changed even when the query was answered with 'n'.
That is why Hui changed it to error()

> 
> 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  <dje@google.com>
> > 
> > 	* 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;
> 
> 


  reply	other threads:[~2009-09-14 19:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14 19:17 Doug Evans
2009-09-14 19:26 ` Michael Snyder
2009-09-14 19:29   ` Marc Khouzam [this message]
2009-09-14 20:21     ` Michael Snyder
2009-09-14 19:43   ` Doug Evans
2009-09-14 20:20     ` Michael Snyder
2009-09-14 20:40       ` Pedro Alves
2009-09-14 20:43         ` Michael Snyder
2009-09-14 20:41       ` Doug Evans
2009-09-14 20:45         ` Michael Snyder
2009-09-14 19:26 ` Greg Law
2009-09-14 19:28   ` Marc Khouzam
2009-09-15  0:11 ` Hui Zhu
2009-09-15  6:58 ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F7CE05678329534C957159168FA70DEC515363D1E3@EUSAACMS0703.eamcs.ericsson.se \
    --to=marc.khouzam@ericsson.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=glaw@undo-software.com \
    --cc=msnyder@vmware.com \
    --cc=pedro@codesourcery.com \
    --cc=teawater@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox