From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3858 invoked by alias); 23 Sep 2003 19:07:26 -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 3823 invoked from network); 23 Sep 2003 19:07:21 -0000 Received: from unknown (HELO gateway.macdonnell.ca) (68.145.162.148) by sources.redhat.com with SMTP; 23 Sep 2003 19:07:21 -0000 Received: from macdonnell.ca (desktop.localdomain [192.168.0.4]) by gateway.macdonnell.ca (8.12.10/8.12.10) with ESMTP id h8NJ7KEE001667; Tue, 23 Sep 2003 13:07:21 -0600 Message-ID: <3F7099F4.1010405@macdonnell.ca> Date: Tue, 23 Sep 2003 19:07:00 -0000 From: Creighton MacDonnell User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com CC: gdb@sources.redhat.com Subject: Re: Problem with COM1 port from with GDB 5.3 under Cygwin 1.5.3-1 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-09/txt/msg00501.txt.bz2 I earlier posted to the gdb@sources.redhat.com list about a problem using the serial port on Cygwin 1.5.3 when using RDI (i.e. ARM Angel Debug Protocol) with GDB 5.3. Using "com1" would hang, and GDB had never allowed names like "/dev/ttyS0", which Cygwin was supposed to support. This patch avoids the Cygwin 1.5.* problem with "com*" port names, while still allowing "com*" names to be used in GDB scripts (they get translated to "/dev/com?"), and also allows "/dev/ttyS*" and "/dev/com*" device names to be used. --- ./gdb/rdi-share/unixcomm.c~ 2002-06-08 14:34:41.000000000 -0600 +++ ./gdb/rdi-share/unixcomm.c 2003-09-23 12:12:43.703125000 -0600 @@ -96,7 +96,15 @@ #define PARPORT2 "/dev/par1" #endif -#if defined(_WIN32) || defined (__CYGWIN__) +#if defined (__CYGWIN__) +#define SERIAL_PREFIX "/dev/com" +#define SERPORT1 "/dev/com1" +#define SERPORT2 "/dev/com2" +#define PARPORT1 "lpt1" +#define PARPORT2 "lpt2" +#endif + +#if defined(_WIN32) #define SERIAL_PREFIX "com" #define SERPORT1 "com1" #define SERPORT2 "com2" @@ -154,6 +162,32 @@ } if (strcmp(name, "2") == 0) return SERPORT2; + #if defined (__CYGWIN__) + + /* allow Linux "/dev/ttyS*" names too */ + if (strncmp(name, "/dev/ttyS", 9) == 0) return name; + + /* allow Windows "com*" names too */ + { + static const char *const real_name[] = { + SERIAL_PREFIX "0", + SERIAL_PREFIX "1", + SERIAL_PREFIX "2", + SERIAL_PREFIX "3", + SERIAL_PREFIX "4", + SERIAL_PREFIX "5", + SERIAL_PREFIX "6", + SERIAL_PREFIX "7", + SERIAL_PREFIX "8", + SERIAL_PREFIX "9", + }; + if (strlen(name) == 4 && strncmp(name, "com", 3) == 0 && + '0' <= name[3] && name[3] <= '9') + return real_name[name[3] - '0']; + } + + #endif + /* It wasn't one of the simple cases, so now we have to parse it * properly */