Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Kai Tietz <ktietz70@googlemail.com>, Eli Zaretskii <eliz@gnu.org>,
	Joel Brobecker <brobecker@adacore.com>
Subject: Re: [patch gdb]: Fix some DOS-path related issues in gdb
Date: Wed, 23 Mar 2011 14:16:00 -0000	[thread overview]
Message-ID: <201103231244.33842.pedro@codesourcery.com> (raw)
In-Reply-To: <AANLkTimbAO3DwL76PGV9AOyOSCPAapcf5=n+a_iBXHEv@mail.gmail.com>

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 <machine>.: 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


  parent reply	other threads:[~2011-03-23 12:44 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTi=QoOiBg3XmMv+hRNe8DkT2YiVGZ=7NhaQwzCey@mail.gmail.com>
2011-03-03 12:10 ` Kai Tietz
2011-03-03 13:24   ` Eli Zaretskii
2011-03-03 13:48     ` Kai Tietz
2011-03-03 14:00       ` Eli Zaretskii
2011-03-03 14:58         ` Joel Brobecker
2011-03-03 15:25           ` Kai Tietz
2011-03-03 15:32           ` Pedro Alves
2011-03-03 15:41             ` Kai Tietz
2011-03-03 16:09               ` Pedro Alves
2011-03-03 16:19                 ` Kai Tietz
2011-03-03 16:42                   ` Pedro Alves
2011-03-03 17:32                     ` Kai Tietz
2011-03-04  7:23                       ` Vladimir Simonov
2011-03-04  8:23                         ` Joel Brobecker
2011-03-07 19:28             ` Jan Kratochvil
2011-03-07 19:28               ` Pedro Alves
2011-03-07 19:34                 ` Jan Kratochvil
2011-03-03 18:09           ` Eli Zaretskii
2011-03-04  5:12             ` Joel Brobecker
2011-03-04 13:05               ` André Pönitz
2011-03-04  9:48             ` Kai Tietz
2011-03-04 10:37               ` Mark Kettenis
2011-03-05  9:13                 ` Kai Tietz
2011-03-05 11:38                   ` Vladimir Simonov
2011-03-05 12:45                     ` Kai Tietz
2011-03-23 11:16             ` Kai Tietz
2011-03-23 12:44               ` Mark Kettenis
2011-03-23 14:07                 ` Kai Tietz
2011-03-23 14:16               ` Pedro Alves [this message]
2011-03-23 14:18                 ` Kai Tietz
2011-03-23 14:29                   ` Pierre Muller
     [not found]                   ` <-544184502231544940@unknownmsgid>
2011-03-23 14:44                     ` Kai Tietz
2011-03-23 15:29                   ` Pedro Alves
2011-03-23 15:29                     ` Kai Tietz
2011-03-23 18:24                     ` Eli Zaretskii
2011-03-23 21:11                       ` Kai Tietz
2011-03-03 17:02         ` Mark Kettenis

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=201103231244.33842.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=ktietz70@googlemail.com \
    /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