regcache = (struct regcache *) inferior_regcache_data (thread);
+ if (regcache == NULL)
+ return;
+
if (regcache->registers_valid)
{
struct thread_info *saved_inferior = current_inferior;
struct regcache *regcache
= (struct regcache *) inferior_regcache_data (thread);
+ if (regcache != NULL)
+ regcache_invalidate_one (thread_p);
free_register_cache (regcache);
set_inferior_regcache_data (thread, new_register_cache ());
}
{
int offset, i;
+ /* Before changing the register cache internal layout, flush the
+ contents of valid caches back to the threads. */
+ regcache_invalidate ();
+
reg_defs = regs;
num_registers = n;