* defs.h maint.c monitor.c remote-mips.c remote.c: Add support

for `watchdog' variable.  This allows the user to put an upper
	limit on the amount of time that GDB will wait for the target to
	return from a step or continue operation.  This will primarily be
	used for the testsuite, where it is difficult to come up with a
	reasonable timeout for things like function calls, which can take
	as long as three minutes under some circumstances.  If the
	watchdog timer expires, GDB will generate an error that looks like
	`Watchdog has expired.', and will detach from the target.

	* remote-mips.c (mips_open):  Setup initial frame from target.
	Print it out so that user is told where the program is stopped
	when they attach.

	* remote-nrom.c:  Loads of cleanups.  Use serial code to open
	network connections.  Use expect() to wait for response to
	download command.

	* ser-tcp.c (tcp_open):  Retry connection if we get ECONNREFUSED.

	* serial.c serial.h (serial_open serial_fdopen serial_close):
	Allow users to open the same device multiple times.  They all get
	to share the same serial_t.  This is about the only way to have
	multiple active targets use the same device (for download and
	debug).

	* sparcl-tdep.c:  Keep #include <unistd.h> away from GO32.

	* target.c:  Add `targetdebug' variable.  If this is non-zero,
	then a special target is put at the top of the target stack which
	will cause all calls through the target vector to have their args
	and results printed out.
This commit is contained in:
Stu Grossman
1995-06-08 22:42:36 +00:00
parent 311f7c4b6a
commit 4887063b3c
8 changed files with 264 additions and 132 deletions

View File

@@ -79,28 +79,38 @@ tcp_open(scb, name)
return -1;
}
scb->fd = socket (PF_INET, SOCK_STREAM, 0);
if (scb->fd < 0)
return -1;
/* Allow rapid reuse of this port. */
tmp = 1;
setsockopt (scb->fd, SOL_SOCKET, SO_REUSEADDR, (char *)&tmp, sizeof(tmp));
/* Enable TCP keep alive process. */
tmp = 1;
setsockopt (scb->fd, SOL_SOCKET, SO_KEEPALIVE, (char *)&tmp, sizeof(tmp));
sockaddr.sin_family = PF_INET;
sockaddr.sin_port = htons(port);
memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr,
sizeof (struct in_addr));
if (connect (scb->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr)))
for (i = 1; i <= 15; i++)
{
close(scb->fd);
scb->fd = socket (PF_INET, SOCK_STREAM, 0);
if (scb->fd < 0)
return -1;
/* Allow rapid reuse of this port. */
tmp = 1;
setsockopt (scb->fd, SOL_SOCKET, SO_REUSEADDR, (char *)&tmp, sizeof(tmp));
/* Enable TCP keep alive process. */
tmp = 1;
setsockopt (scb->fd, SOL_SOCKET, SO_KEEPALIVE, (char *)&tmp, sizeof(tmp));
sockaddr.sin_family = PF_INET;
sockaddr.sin_port = htons(port);
memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr,
sizeof (struct in_addr));
if (!connect (scb->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr)))
break;
close (scb->fd);
scb->fd = -1;
return -1;
/* We retry for ECONNREFUSED because that is often a temporary condition, which
happens when the server is being restarted. */
if (errno != ECONNREFUSED)
return -1;
sleep (1);
}
protoent = getprotobyname ("tcp");