+2008-05-08 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * regcache.c (registers_length): Remove.
+ (set_register_cache): Verify that PBUFSIZ is large enough to hold a
+ full register packet.
+ * regcache.h (registers_length): Remove prototype.
+ * server.h (PBUFSIZ): Define to 16384.
+
2008-05-03 Ulrich Weigand <uweigand@de.ibm.com>
* configure.srv (powerpc*-*-linux*): Set srv_regobj to
for_each_inferior (&all_threads, regcache_invalidate_one);
}
-int
-registers_length (void)
-{
- return 2 * register_bytes;
-}
-
void *
new_register_cache (void)
{
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 registers_from_string (char *buf);
-/* Return the size in bytes of a string-encoded register packet. */
-
-int registers_length (void);
-
/* Return a pointer to the description of register ``n''. */
struct reg *find_register_by_number (int n);
is chosen to fill up a packet (the headers account for the 32). */
#define MAXBUFBYTES(N) (((N)-32)/2)
-/* Buffer sizes for transferring memory, registers, etc. Round up PBUFSIZ to
- hold all the registers, at least. */
-#define PBUFSIZ ((registers_length () + 32 > 2000) \
- ? (registers_length () + 32) \
- : 2000)
+/* Buffer sizes for transferring memory, registers, etc. Set to a constant
+ value to accomodate multiple register formats. This value must be at least
+ as large as the largest register set supported by gdbserver. */
+#define PBUFSIZ 16384
/* Version information, from version.c. */
extern const char version[];