Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Why is the state of cache being changed by regcache_observer_notify_target() ?
@ 2007-05-29 12:13 Kalpana Ramamurthy
  2007-05-31 17:35 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Kalpana Ramamurthy @ 2007-05-29 12:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: kal_pana

I am changing a register like this :
$sp = (long long *)$pa

When value_assign() is called in valops.c, it goes to put_frame_register() 
to set the modified
contents of register SP. While doing this, it sets the registers_valip_p to 
1 in
register_raw_write() after copying over the modified values in the buffer to 
the regcache.

memcpy (register_buffer (regcache, regnum), buf, 
regcache->descr->sizeof_register[regnum]) ;
regcache->register_valid_p[regnum] = 1 ;

But soon after in value_assign(), it calls for 
observer_notify_target_changed() which in turn
calls regcache_observer_target_changed(). This calls for register_changed() 
that immediately
resets the value of register_valid_p to 0. And when register_valid_p is set 
to 0, it indicates that
it is not cached but is fetchable and hence tries to fetch the target 
registers again. Something
which I cannot understand gets messed up after that.

But if I comment out the call to observer_notify_target_changed() in 
value_assign(), everything
works fine and the value of $sp is changed as per what I want.

Why is the regcache_observer_target_changed() changing the values of 
register_valid_p as soon as its set earlier ?

Kalpana
===

_________________________________________________________________
Catch all the cricketing action right here. Live score, match reports, 
photos et al. http://content.msn.co.in/Sports/Cricket/Default.aspx


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Why is the state of cache being changed by regcache_observer_notify_target() ?
  2007-05-29 12:13 Why is the state of cache being changed by regcache_observer_notify_target() ? Kalpana Ramamurthy
@ 2007-05-31 17:35 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2007-05-31 17:35 UTC (permalink / raw)
  To: Kalpana Ramamurthy; +Cc: gdb-patches

On Tue, May 29, 2007 at 12:12:50PM +0000, Kalpana Ramamurthy wrote:
> Why is the regcache_observer_target_changed() changing the values of 
> register_valid_p as soon as its set earlier ?

In case changing one register causes another to change in some
unpredictable way.  The register should be written to the target when
it is changed, and then later read back with the new value.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-31 17:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-29 12:13 Why is the state of cache being changed by regcache_observer_notify_target() ? Kalpana Ramamurthy
2007-05-31 17:35 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox