* rs6000-tdep.c (rs6000_fetch_instruction)
[deliverable/binutils-gdb.git] / gdb / gdbserver / regcache.c
index 7b2285a4c3b0abe81216f6c0039c9b2eeedc7576..a324d43df65ccdb6c2d38347bc7f45b564390679 100644 (file)
@@ -86,12 +86,6 @@ regcache_invalidate ()
   for_each_inferior (&all_threads, regcache_invalidate_one);
 }
 
-int
-registers_length (void)
-{
-  return 2 * register_bytes;
-}
-
 void *
 new_register_cache (void)
 {
@@ -121,6 +115,15 @@ free_register_cache (void *regcache_p)
   free (regcache);
 }
 
+static void
+realloc_register_cache (struct inferior_list_entry *thread_p)
+{
+  struct thread_info *thread = (struct thread_info *) thread_p;
+
+  free_register_cache (inferior_regcache_data (thread));
+  set_inferior_regcache_data (thread, new_register_cache ());
+}
+
 void
 set_register_cache (struct reg *regs, int n)
 {
@@ -137,6 +140,13 @@ set_register_cache (struct reg *regs, int n)
     }
 
   register_bytes = offset / 8;
+
+  /* Make sure PBUFSIZ is large enough to hold a full register packet.  */
+  if (2 * register_bytes + 32 > PBUFSIZ)
+    fatal ("Register packet size exceeds PBUFSIZ.");
+
+  /* Re-allocate all pre-existing register caches.  */
+  for_each_inferior (&all_threads, realloc_register_cache);
 }
 
 void
This page took 0.02578 seconds and 4 git commands to generate.