From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17425 invoked by alias); 26 Mar 2005 08:47:21 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 17241 invoked from network); 26 Mar 2005 08:47:13 -0000 Received: from unknown (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org with SMTP; 26 Mar 2005 08:47:13 -0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.0/8.13.0) with ESMTP id j2Q8jqgd004335; Sat, 26 Mar 2005 09:45:52 +0100 (CET) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.3/8.13.3) with ESMTP id j2Q8jqTs013064; Sat, 26 Mar 2005 09:45:52 +0100 (CET) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.3/8.13.3/Submit) id j2Q8jlLC019248; Sat, 26 Mar 2005 09:45:47 +0100 (CET) Date: Sat, 26 Mar 2005 08:47:00 -0000 Message-Id: <200503260845.j2Q8jlLC019248@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: mark@codesourcery.com CC: gdb-patches@sources.redhat.com In-reply-to: <200503260127.j2Q1R59a022152@sethra.codesourcery.com> (message from Mark Mitchell on Fri, 25 Mar 2005 17:27:05 -0800) Subject: Re: PATCH: Windows sockets References: <200503260127.j2Q1R59a022152@sethra.codesourcery.com> X-SW-Source: 2005-03/txt/msg00334.txt.bz2 Date: Fri, 25 Mar 2005 17:27:05 -0800 From: Mark Mitchell Here's the first "interesting" patch for Windows support. This patch modifies ser-tcp.c to support Windows, so that we can use a GDB running on Windows to talk to a gdbserver process. Yikes. This is real ugly and I'm not too happy about this. Here is a sumary of the changes in this patch: 1. Link with -lws2_32 on MinGW so we can use sockets. Can't you just use a standard autoconf check to check for that library instead of hardcoding it to be linked in on MinGW? 2. In defs.h, define WINAPI so that source files know whether they are supposed to use the Windows API. This is bad. Yet another #ifdef WINDHOOS when we really are trying to get rid of those. 3. Move ser_unix_readchar and friends (which were only barely UNIX-specific) into ser-base.c, renaming appropriately. Fair enough. 4. Add a new member (read_prim) to struct serial_ops, and use it from ser_base_readchar. The reason for this is that sockets must be read with "recv" on Windows; plain "read" does not work. So, we need a way to indicate which low-level primitive to use to read from a file descriptor. But write(2) does work and you don't need to use send(2). Oh you do but things are not quite symmetric. Could you fix that? Isn't it a better idea to change the #ifdef WINAPI in a #ifdef HAVE_RECV, add an autoconf check for recv(2), and always prefer it over read(2) if available for reading from a socket? 5. Make a handful of minor changes to ter-tcp.c to account for differences in the BSD and Windows sockets APIs. You mean that Windows doesn't have the proper BSD socket API even though Microsoft stole^Wused the BSD TCP stack? I really think these changes are too pervasive and that you really need to create a ser-win32.c that has all the Windows-specific cruft in it. 6. Tweak safe_strerror to deal with Windows sockets error codes. I'm defenitely not thrilled by this tweak. You're only changing "undocumented" into "winsock". I presume it helps with debugging this stuff, but is it really worth the clutter it adds? Sorry, Mark