public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Remove gdb_fildes_t
Date: Mon, 13 Apr 2020 21:10:48 +0000 (GMT)	[thread overview]
Message-ID: <20200413211048.3BFDA39518BA@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=73944e9f6317fa826044d79a6c15ea4448270ee8

commit 73944e9f6317fa826044d79a6c15ea4448270ee8
Author: Tom Tromey <tom@tromey.com>
Date:   Mon Apr 13 12:42:59 2020 -0600

    Remove gdb_fildes_t
    
    gdb_fildes_t and pfildes are no longer used, so remove them.
    
    gdbserver/ChangeLog
    2020-04-13  Tom Tromey  <tom@tromey.com>
    
            * server.h (gdb_fildes_t): Remove typedef.
            * remote-utils.c (remote_desc, list_desc): Now int.
            (INVALID_DESCRIPTOR): Remove.
            (gdb_connected, remote_close)
            (check_remote_input_interrupt_request): Update.
            * utils.h (pfildes): Don't declare.
            * utils.c (pfildes): Remove.

Diff:
---
 gdbserver/ChangeLog       | 10 ++++++++++
 gdbserver/remote-utils.cc | 16 +++++-----------
 gdbserver/server.h        |  7 -------
 gdbserver/utils.cc        | 12 ------------
 gdbserver/utils.h         |  1 -
 5 files changed, 15 insertions(+), 31 deletions(-)

diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index 1d0fbb87c06..2b381455ed7 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,13 @@
+2020-04-13  Tom Tromey  <tom@tromey.com>
+
+	* server.h (gdb_fildes_t): Remove typedef.
+	* remote-utils.c (remote_desc, list_desc): Now int.
+	(INVALID_DESCRIPTOR): Remove.
+	(gdb_connected, remote_close)
+	(check_remote_input_interrupt_request): Update.
+	* utils.h (pfildes): Don't declare.
+	* utils.c (pfildes): Remove.
+
 2020-04-13  Tom Tromey  <tom@tromey.com>
 
 	* server.h (handle_serial_event, handle_target_event): Update.
diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc
index 6249691954d..67c560d1c87 100644
--- a/gdbserver/remote-utils.cc
+++ b/gdbserver/remote-utils.cc
@@ -78,12 +78,6 @@ typedef int socklen_t;
 
 #ifndef IN_PROCESS_AGENT
 
-#if USE_WIN32API
-# define INVALID_DESCRIPTOR INVALID_SOCKET
-#else
-# define INVALID_DESCRIPTOR -1
-#endif
-
 /* Extra value for readchar_callback.  */
 enum {
   /* The callback is currently not scheduled.  */
@@ -108,8 +102,8 @@ struct sym_cache
 
 static int remote_is_stdio = 0;
 
-static gdb_fildes_t remote_desc = INVALID_DESCRIPTOR;
-static gdb_fildes_t listen_desc = INVALID_DESCRIPTOR;
+static int remote_desc = -1;
+static int listen_desc = -1;
 
 #ifdef USE_WIN32API
 # define read(fd, buf, len) recv (fd, (char *) buf, len, 0)
@@ -119,7 +113,7 @@ static gdb_fildes_t listen_desc = INVALID_DESCRIPTOR;
 int
 gdb_connected (void)
 {
-  return remote_desc != INVALID_DESCRIPTOR;
+  return remote_desc != -1;
 }
 
 /* Return true if the remote connection is over stdio.  */
@@ -425,7 +419,7 @@ remote_close (void)
   if (! remote_connection_is_stdio ())
     close (remote_desc);
 #endif
-  remote_desc = INVALID_DESCRIPTOR;
+  remote_desc = -1;
 
   reset_readchar ();
 }
@@ -788,7 +782,7 @@ check_remote_input_interrupt_request (void)
   /* This function may be called before establishing communications,
      therefore we need to validate the remote descriptor.  */
 
-  if (remote_desc == INVALID_DESCRIPTOR)
+  if (remote_desc == -1)
     return;
 
   input_interrupt (0);
diff --git a/gdbserver/server.h b/gdbserver/server.h
index 039082e2eff..09989e46264 100644
--- a/gdbserver/server.h
+++ b/gdbserver/server.h
@@ -81,13 +81,6 @@ extern bool disable_packet_T;
 extern bool run_once;
 extern bool non_stop;
 
-#if USE_WIN32API
-#include <winsock2.h>
-typedef SOCKET gdb_fildes_t;
-#else
-typedef int gdb_fildes_t;
-#endif
-
 #include "gdbsupport/event-loop.h"
 
 /* Functions from server.c.  */
diff --git a/gdbserver/utils.cc b/gdbserver/utils.cc
index d88f4ac5ca7..d52d2ac8736 100644
--- a/gdbserver/utils.cc
+++ b/gdbserver/utils.cc
@@ -113,15 +113,3 @@ paddress (CORE_ADDR addr)
 {
   return phex_nz (addr, sizeof (CORE_ADDR));
 }
-
-/* Convert a file descriptor into a printable string.  */
-
-char *
-pfildes (gdb_fildes_t fd)
-{
-#if USE_WIN32API
-  return phex_nz (fd, sizeof (gdb_fildes_t));
-#else
-  return plongest (fd);
-#endif
-}
diff --git a/gdbserver/utils.h b/gdbserver/utils.h
index fa3ca9bb945..fc56f33f9f3 100644
--- a/gdbserver/utils.h
+++ b/gdbserver/utils.h
@@ -20,6 +20,5 @@
 #define GDBSERVER_UTILS_H
 
 char *paddress (CORE_ADDR addr);
-char *pfildes (gdb_fildes_t fd);
 
 #endif /* GDBSERVER_UTILS_H */


                 reply	other threads:[~2020-04-13 21:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200413211048.3BFDA39518BA@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).