gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / ser-tcp.c
index 618d2d931ac6347a82d498735d65e5e18a8f6d03..7dd903dfaad6bd9ecf06a20e31f021f32e3aff8c 100644 (file)
@@ -1,6 +1,6 @@
 /* Serial interface for raw TCP connections on Un*x like systems.
 
-   Copyright (C) 1992-2018 Free Software Foundation, Inc.
+   Copyright (C) 1992-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -24,8 +24,8 @@
 #include "gdbcmd.h"
 #include "cli/cli-decode.h"
 #include "cli/cli-setshow.h"
-#include "filestuff.h"
-#include "netstuff.h"
+#include "gdbsupport/filestuff.h"
+#include "gdbsupport/netstuff.h"
 
 #include <sys/types.h>
 
 #include <sys/ioctl.h>  /* For FIONBIO.  */
 #endif
 
-#include "gdb_sys_time.h"
+#include "gdbsupport/gdb_sys_time.h"
 
 #ifdef USE_WIN32API
-#include <winsock2.h>
-#include <wspiapi.h>
+#include <ws2tcpip.h>
 #ifndef ETIMEDOUT
 #define ETIMEDOUT WSAETIMEDOUT
 #endif
@@ -59,7 +58,7 @@
 #endif
 
 #include <signal.h>
-#include "gdb_select.h"
+#include "gdbsupport/gdb_select.h"
 #include <algorithm>
 
 #ifndef HAVE_SOCKLEN_T
@@ -73,7 +72,7 @@ static struct cmd_list_element *tcp_show_cmdlist;
 
 /* Whether to auto-retry refused connections.  */
 
-static int tcp_auto_retry = 1;
+static bool tcp_auto_retry = true;
 
 /* Timeout period for connections, in seconds.  */
 
@@ -308,7 +307,7 @@ net_open (struct serial *scb, const char *name)
   /* Flag to indicate whether we've got a connection refused.  It will
      be true if any of the connections tried was refused.  */
   bool got_connrefused;
-  /* If a connection succeeeds, SUCCESS_AINFO will point to the
+  /* If a connection succeeds, SUCCESS_AINFO will point to the
      'struct addrinfo' that succeed.  */
   struct addrinfo *success_ainfo = NULL;
   unsigned int polls = 0;
@@ -320,7 +319,7 @@ net_open (struct serial *scb, const char *name)
     {
       got_connrefused = false;
 
-      for (struct addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next)
+      for (addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next)
        {
          /* Iterate over the list of possible addresses to connect
             to.  For each, we'll try to connect and see if it
@@ -371,7 +370,7 @@ net_open (struct serial *scb, const char *name)
 
   ioctl (scb->fd, FIONBIO, &ioarg);
 
-  if (success_ainfo->ai_socktype == IPPROTO_TCP)
+  if (success_ainfo->ai_protocol == IPPROTO_TCP)
     {
       /* Disable Nagle algorithm.  Needed in some cases.  */
       int tmp = 1;
@@ -425,20 +424,6 @@ ser_tcp_send_break (struct serial *scb)
   return (serial_write (scb, "\377\363", 2));
 }
 
-/* Support for "set tcp" and "show tcp" commands.  */
-
-static void
-set_tcp_cmd (const char *args, int from_tty)
-{
-  help_list (tcp_set_cmdlist, "set tcp ", all_commands, gdb_stdout);
-}
-
-static void
-show_tcp_cmd (const char *args, int from_tty)
-{
-  help_list (tcp_show_cmdlist, "show tcp ", all_commands, gdb_stdout);
-}
-
 #ifndef USE_WIN32API
 
 /* The TCP ops.  */
@@ -470,8 +455,9 @@ static const struct serial_ops tcp_ops =
 
 #endif /* USE_WIN32API */
 
+void _initialize_ser_tcp ();
 void
-_initialize_ser_tcp (void)
+_initialize_ser_tcp ()
 {
 #ifdef USE_WIN32API
   /* Do nothing; the TCP serial operations will be initialized in
@@ -480,28 +466,28 @@ _initialize_ser_tcp (void)
   serial_add_interface (&tcp_ops);
 #endif /* USE_WIN32API */
 
-  add_prefix_cmd ("tcp", class_maintenance, set_tcp_cmd, _("\
-TCP protocol specific variables\n\
-Configure variables specific to remote TCP connections"),
-                 &tcp_set_cmdlist, "set tcp ",
-                 0 /* allow-unknown */, &setlist);
-  add_prefix_cmd ("tcp", class_maintenance, show_tcp_cmd, _("\
-TCP protocol specific variables\n\
-Configure variables specific to remote TCP connections"),
-                 &tcp_show_cmdlist, "show tcp ",
-                 0 /* allow-unknown */, &showlist);
+  add_basic_prefix_cmd ("tcp", class_maintenance, _("\
+TCP protocol specific variables.\n\
+Configure variables specific to remote TCP connections."),
+                       &tcp_set_cmdlist, "set tcp ",
+                       0 /* allow-unknown */, &setlist);
+  add_show_prefix_cmd ("tcp", class_maintenance, _("\
+TCP protocol specific variables.\n\
+Configure variables specific to remote TCP connections."),
+                      &tcp_show_cmdlist, "show tcp ",
+                      0 /* allow-unknown */, &showlist);
 
   add_setshow_boolean_cmd ("auto-retry", class_obscure,
                           &tcp_auto_retry, _("\
-Set auto-retry on socket connect"), _("\
-Show auto-retry on socket connect"), 
+Set auto-retry on socket connect."), _("\
+Show auto-retry on socket connect."),
                           NULL, NULL, NULL,
                           &tcp_set_cmdlist, &tcp_show_cmdlist);
 
   add_setshow_uinteger_cmd ("connect-timeout", class_obscure,
                            &tcp_retry_limit, _("\
-Set timeout limit in seconds for socket connection"), _("\
-Show timeout limit in seconds for socket connection"), _("\
+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."),
This page took 0.026208 seconds and 4 git commands to generate.