This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Use winsock2 for mingw gdbserver
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'Pedro Alves'" <pedro at codesourcery dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Sat, 17 Apr 2010 07:39:45 +0200
- Subject: [RFA] Use winsock2 for mingw gdbserver
- References: <000d01cadd79$efa9e2b0$cefda810$@muller@ics-cnrs.unistra.fr> <201004161727.26943.pedro@codesourcery.com> <001f01cadd83$3e5e6b70$bb1b4250$@muller@ics-cnrs.unistra.fr> <201004161815.36864.pedro@codesourcery.com>
I implement this as a separate patch:
I just tested compilation with msys/mingw system.
> -----Message d'origine-----
> De?: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé?: Friday, April 16, 2010 7:16 PM
> À?: Pierre Muller
> Cc?: gdb-patches@sourceware.org
> Objet?: Re: [RFC] Mingw Windows 64-bit gdbserver
>
> On Friday 16 April 2010 17:38:28, Pierre Muller wrote:
> > GDb sources is still a mix:
> >
> > > Typo: I meant winsock2.h instead of winsock.h.
> >
> > $ grep "include.*<winso" *.h gdbserver/*.h *.c gdbserver/*.c
> > gdb_select.h:#include <winsock2.h>
> > serial.h:#include <winsock2.h>
> > m32r-rom.c:#include <winsock.h>
> > remote-m32r-sdi.c:#include <winsock.h>
> > ser-base.c:#include <winsock2.h>
> > ser-tcp.c:#include <winsock2.h>
> > gdbserver/gdbreplay.c:#include <winsock.h>
> > gdbserver/remote-utils.c:#include <winsock.h>
> >
> > should all be moved to winsock2.h?
>
> Probably not a real problem as we only activate
> Winsock 1:
>
> gdb/
> >grep WSAStart *.c -rn
> m32r-rom.c:451: if (WSAStartup (MAKEWORD (1, 1), &wd))
> ser-mingw.c:1255: if (WSAStartup (MAKEWORD (1, 0), &wsa_data) != 0)
>
> gdb/gdbserver/
> >grep WSAStart *.c -rn
> gdbreplay.c:207: WSAStartup (MAKEWORD (1, 0), &wsad);
> remote-utils.c:288: WSAStartup (MAKEWORD (1, 0), &wsad);
>
> Presumably winsock2.h is a superset of winsock.h and so we're
> likely fine. Wouldn't hurt to be consistent, moreso since we
> include winsock2.h in some headers.
>
> > and -lws2_32 as library?
>
> You mean in gdbserver? Shouldn't hurt, yeah.
Here you are:
is this OK?
Once again, it?s the formatting of the
ChangeLog that seems the most uncertain to me...
Pierre
gdbserver ChangeLog entry:
2010-04-17 Pierre Muller <muller@ics.u-strasbg.fr>
* configure.ac: Use `ws2_32' library for srv_mingw.
* configure: Regenerate.
* gdbreplay.c: Use winsock2 header instead of winsock for mingw.
* remote-utils.c: Likewise.
Index: configure
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure,v
retrieving revision 1.47
diff -u -p -r1.47 configure
--- configure 16 Apr 2010 16:22:15 -0000 1.47
+++ configure 17 Apr 2010 05:25:59 -0000
@@ -4056,7 +4056,7 @@ esac
if test "${srv_mingwce}" = "yes"; then
LIBS="$LIBS -lws2"
elif test "${srv_mingw}" = "yes"; then
- LIBS="$LIBS -lwsock32"
+ LIBS="$LIBS -lws2_32"
elif test "${srv_qnx}" = "yes"; then
LIBS="$LIBS -lsocket"
fi
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.ac,v
retrieving revision 1.33
diff -u -p -r1.33 configure.ac
--- configure.ac 23 Feb 2010 19:16:16 -0000 1.33
+++ configure.ac 17 Apr 2010 05:25:59 -0000
@@ -118,7 +118,7 @@ esac
if test "${srv_mingwce}" = "yes"; then
LIBS="$LIBS -lws2"
elif test "${srv_mingw}" = "yes"; then
- LIBS="$LIBS -lwsock32"
+ LIBS="$LIBS -lws2_32"
elif test "${srv_qnx}" = "yes"; then
LIBS="$LIBS -lsocket"
fi
Index: gdbreplay.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/gdbreplay.c,v
retrieving revision 1.24
diff -u -p -r1.24 gdbreplay.c
--- gdbreplay.c 1 Jan 2010 07:31:49 -0000 1.24
+++ gdbreplay.c 17 Apr 2010 05:25:59 -0000
@@ -59,7 +59,7 @@
#endif
#if USE_WIN32API
-#include <winsock.h>
+#include <winsock2.h>
#endif
#ifndef HAVE_SOCKLEN_T
Index: remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/remote-utils.c,v
retrieving revision 1.72
diff -u -p -r1.72 remote-utils.c
--- remote-utils.c 11 Apr 2010 16:33:56 -0000 1.72
+++ remote-utils.c 17 Apr 2010 05:25:59 -0000
@@ -63,7 +63,7 @@
#endif
#if USE_WIN32API
-#include <winsock.h>
+#include <winsock2.h>
#endif
#if __QNX__