From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22629 invoked by alias); 23 Mar 2011 12:44:47 -0000 Received: (qmail 22495 invoked by uid 22791); 23 Mar 2011 12:44:45 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Mar 2011 12:44:38 +0000 Received: (qmail 16788 invoked from network); 23 Mar 2011 12:44:36 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 23 Mar 2011 12:44:36 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch gdb]: Fix some DOS-path related issues in gdb Date: Wed, 23 Mar 2011 14:16:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.35-28-generic; KDE/4.6.1; x86_64; ; ) Cc: Kai Tietz , Eli Zaretskii , Joel Brobecker References: <83tyfkw00f.fsf@gnu.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201103231244.33842.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg01021.txt.bz2 On Wednesday 23 March 2011 10:39:33, Kai Tietz wrote: > --- gdb.orig/source.c 2011-03-23 10:30:42.614811600 +0100 > +++ gdb/source.c 2011-03-23 10:56:17.194745900 +0100 > @@ -569,15 +569,10 @@ add_path (char *dirname, char **which_pa > p = *which_path; > while (1) > { > - /* FIXME: strncmp loses in interesting ways on MS-DOS and > - MS-Windows because of case-insensitivity and two different > - but functionally identical slash characters. We need a > - special filesystem-dependent file-name comparison function. > - > - Actually, even on Unix I would use realpath() or its work- > + /* Actually, even on Unix I would use realpath() or its work- > alike before comparing. Then all the code above which > removes excess slashes and dots could simply go away. */ > - if (!strncmp (p, name, len) > + if (!filename_ncmp (p, name, len) > && (p[len] == '\0' || p[len] == DIRNAME_SEPARATOR)) Without the previous paragraph, the comment left now doesn't make sense on its own as is. The "Actually, even on Unix" appears out of the blue. > --- gdb.orig/xml-support.c 2011-03-23 10:30:42.620811600 +0100 > +++ gdb/xml-support.c 2011-03-23 10:56:17.265754900 +0100 > @@ -25,6 +25,7 @@ > > #include "gdb_string.h" > #include "safe-ctype.h" > +#include "filenames.h" > > /* Debugging flag. */ > static int debug_xml; > @@ -946,7 +947,7 @@ fetch_xml_builtin (const char *filename) > const char *(*p)[2]; > > for (p = xml_builtin; (*p)[0]; p++) > - if (strcmp ((*p)[0], filename) == 0) > + if (filename_cmp ((*p)[0], filename) == 0) > return (*p)[1]; > > return NULL; I don't think this one makes sense to behave different depending on host. These are files that are built into the GDB binary, with filenames hardcoded, and always basenamed. No need to do case insensitive, or path separator style sensitive match. > --- gdb.orig/dwarf2read.c 2011-03-23 10:32:00.336248300 +0100 > +++ gdb/dwarf2read.c 2011-03-23 10:56:17.285257400 +0100 > @@ -5211,7 +5211,8 @@ find_file_and_directory (struct die_info > directory, get rid of it. */ > char *cp = strchr (*comp_dir, ':'); > > - if (cp && cp != *comp_dir && cp[-1] == '.' && cp[1] == '/') > + if (cp && cp != *comp_dir && cp[-1] == '.' > + && IS_ABSOLUTE_PATH (&cp[1])) > *comp_dir = cp + 1; > } > I've already told you in another thread that this one is wrong. We do not want to match anything other than '/' here, even on Windows. On a Windows x Irix gdb, we'd want to check for '/', literally. The Irix native cc compiler is not going to use '\' or drive names: if (*comp_dir != NULL) { /* Irix 6.2 native cc prepends .: to the compilation directory, get rid of it. */ char *cp = strchr (*comp_dir, ':'); if (cp && cp != *comp_dir && cp[-1] == '.' && cp[1] == '/') *comp_dir = cp + 1; } -- Pedro Alves