This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] Unbreak and de-multiarch tty_input[]
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 14 Nov 2001 21:55:42 -0500
- Subject: [patch] Unbreak and de-multiarch tty_input[]
Hello,
The attatched patch takes remote.c:tty_input[] off of the multi-arch
variable list. It turns out that it doesn't need to be multi-arched and
all multi-arching had achieved was to make it a very very small input
buffer :-(
Andrew
2001-11-14 Andrew Cagney <ac131313@redhat.com>
* remote.c: Include "gdb_assert.h".
(tty_input): Wire buffer to 400 bytes.
(readsocket): Check tty_input doesn't overflow.
(build_remote_gdbarch_data, _initialize_remote): Don't multi-arch
tty_input.
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.64
diff -p -r1.64 remote.c
*** remote.c 2001/10/21 17:19:37 1.64
--- remote.c 2001/11/15 02:51:50
***************
*** 37,42 ****
--- 37,43 ----
#include "remote.h"
#include "regcache.h"
#include "value.h"
+ #include "gdb_assert.h"
#include <ctype.h>
#include <sys/time.h>
*************** enum
*** 5404,5411 ****
}
minitelnet_return;
! /* shared between readsocket() and readtty() */
! static char *tty_input;
static int escape_count;
static int echo_check;
--- 5405,5413 ----
}
minitelnet_return;
! /* Shared between readsocket() and readtty(). The size is arbitrary,
! however all targets are known to support a 400 character packet. */
! static char tty_input[400];
static int escape_count;
static int echo_check;
*************** readsocket (void)
*** 5451,5456 ****
--- 5453,5459 ----
{
if (tty_input[echo_check] == data)
{
+ gdb_assert (echo_check <= sizeof (tty_input));
echo_check++; /* Character matched user input: */
continue; /* Continue without echoing it. */
}
*************** static void
*** 5787,5795 ****
build_remote_gdbarch_data (void)
{
build_remote_packet_sizes ();
-
- /* Cisco stuff */
- tty_input = xmalloc (PBUFSIZ);
remote_address_size = TARGET_ADDR_BIT;
}
--- 5790,5795 ----
*************** _initialize_remote (void)
*** 5819,5825 ****
/* architecture specific data */
build_remote_gdbarch_data ();
- register_gdbarch_swap (&tty_input, sizeof (&tty_input), NULL);
register_remote_packet_sizes ();
register_gdbarch_swap (&remote_address_size,
sizeof (&remote_address_size), NULL);
--- 5819,5824 ----