Index: gdb/ser-tcp.c |
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c |
index d96a8e5f461cc22255b1ff13a8cc6b6e20efebdb..d8c1ed62881fde245a11e32f4864769d6a0e9d53 100644 |
--- a/gdb/ser-tcp.c |
+++ b/gdb/ser-tcp.c |
@@ -1,7 +1,6 @@ |
/* Serial interface for raw TCP connections on Un*x like systems. |
- Copyright (C) 1992-1996, 1998-1999, 2001, 2005-2012 Free Software |
- Foundation, Inc. |
+ Copyright (C) 1992-2013 Free Software Foundation, Inc. |
This file is part of GDB. |
@@ -25,6 +24,7 @@ |
#include "gdbcmd.h" |
#include "cli/cli-decode.h" |
#include "cli/cli-setshow.h" |
+#include "filestuff.h" |
#include <sys/types.h> |
@@ -53,7 +53,7 @@ |
#endif |
#include <signal.h> |
-#include "gdb_string.h" |
+#include <string.h> |
#include "gdb_select.h" |
#ifndef HAVE_SOCKLEN_T |
@@ -73,7 +73,7 @@ static int tcp_auto_retry = 1; |
/* Timeout period for connections, in seconds. */ |
-static int tcp_retry_limit = 15; |
+static unsigned int tcp_retry_limit = 15; |
/* How many times per second to poll deprecated_ui_loop_hook. */ |
@@ -84,7 +84,7 @@ static int tcp_retry_limit = 15; |
Returns -1 on timeout or interrupt, otherwise the value of select. */ |
static int |
-wait_for_connect (struct serial *scb, int *polls) |
+wait_for_connect (struct serial *scb, unsigned int *polls) |
{ |
struct timeval t; |
int n; |
@@ -166,7 +166,7 @@ net_open (struct serial *scb, const char *name) |
#else |
int ioarg; |
#endif |
- int polls = 0; |
+ unsigned int polls = 0; |
use_udp = 0; |
if (strncmp (name, "udp:", 4) == 0) |
@@ -208,9 +208,9 @@ net_open (struct serial *scb, const char *name) |
retry: |
if (use_udp) |
- scb->fd = socket (PF_INET, SOCK_DGRAM, 0); |
+ scb->fd = gdb_socket_cloexec (PF_INET, SOCK_DGRAM, 0); |
else |
- scb->fd = socket (PF_INET, SOCK_STREAM, 0); |
+ scb->fd = gdb_socket_cloexec (PF_INET, SOCK_STREAM, 0); |
if (scb->fd == -1) |
return -1; |
@@ -339,7 +339,10 @@ net_close (struct serial *scb) |
int |
net_read_prim (struct serial *scb, size_t count) |
{ |
- return recv (scb->fd, scb->buf, count, 0); |
+ /* Need to cast to silence -Wpointer-sign on MinGW, as Winsock's |
+ 'recv' takes 'char *' as second argument, while 'scb->buf' is |
+ 'unsigned char *'. */ |
+ return recv (scb->fd, (void *) scb->buf, count, 0); |
} |
int |
@@ -425,8 +428,11 @@ Show auto-retry on socket connect"), |
add_setshow_uinteger_cmd ("connect-timeout", class_obscure, |
&tcp_retry_limit, _("\ |
-Set timeout limit for socket connection"), _("\ |
-Show timeout limit for socket connection"), |
- NULL, NULL, NULL, |
- &tcp_set_cmdlist, &tcp_show_cmdlist); |
+Set timeout limit in seconds for socket connection"), _("\ |
+Show timeout limit in seconds for socket connection"), _("\ |
+If set to \"unlimited\", GDB will keep attempting to establish a\n\ |
+connection forever, unless interrupted with Ctrl-c.\n\ |
+The default is 15 seconds."), |
+ NULL, NULL, |
+ &tcp_set_cmdlist, &tcp_show_cmdlist); |
} |