Re: Multiplexed registers and invalidating the register cache

Orjan Friberg
2004-04-23T11:25:12Z

Andrew Cagney wrote:
>
> Oops, yes, pass the current_target (I ment that it shouldn't have a
> parameter trying to tell the observers anything beyond the fact that the
> target has changed). (the sed script generates () instead of (void)).

Ok.

> There are architectures where registers live in memory so the
> information is simply misleading.

Ok, I'm convinced. (Thanks for clarifying.)

> Eventually, yes. The two can co-habitate for a bit, first just:
>
> - add the observer

Ok. observer.texi gets the following lines added:

@deftypefun void target_changed (struct target_ops *@var{current_target})
The target's register contents has changed.
@end deftypefun

(Proper patch delayed until I've got all the pieces in place.)

> - add code to frame.c and regcache.c to register themselves

I'm sorry; this is the part I don't get - my skull must be getting really thick.
Are you saying that frame.c and regcache.c should register an observer each
for the target_changed event, like this (frame.c):

void
frame_observer_target_changed (struct target_ops *current_target)
{
flush_cached_frames ();
}
observer_attach_target_changed (frame_observer_target_changed);

and (regcache.c):

void
regcache_observer_target_changed (struct target_ops *current_target)
{
registers_changed ();
}
observer_attach_target_changed (regcache_observer_target_changed);

> - add code to the problem area to trigger the observer

Ok; something like (example from valops.c):

if (deprecated_register_changed_hook)
deprecated_register_changed_hook (-1);
target_changed_event ();
+ observer_notify_target_changed (current_target);
break;
}

--
Orjan Friberg
Axis Communications