This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch 2/9] Code cleanup: Drop IS_ABSOLUTE_PATH checks


> Date: Fri, 18 Jan 2013 20:34:57 +0100
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: gdb-patches@sourceware.org
> 
> On Fri, 18 Jan 2013 20:20:24 +0100, Eli Zaretskii wrote:
> > > Date: Fri, 18 Jan 2013 19:39:38 +0100
> > > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > > Cc: gdb-patches@sourceware.org
> > > 
> > > On Fri, 18 Jan 2013 08:32:25 +0100, Eli Zaretskii wrote:
> > > > >  int
> > > > >  compare_filenames_for_search (const char *filename, const char *search_name)
> > > > > @@ -171,7 +171,8 @@ compare_filenames_for_search (const char *filename, const char *search_name)
> > > > >       to put the "c:file.c" name into debug info.  Such compatibility
> > > > >       works only on GDB built for DOS host.  */
> > > > >    return (len == search_len
> > > > > -	  || IS_DIR_SEPARATOR (filename[len - search_len - 1])
> > > > > +	  || (!IS_ABSOLUTE_PATH (search_name)
> > > > > +	      && IS_DIR_SEPARATOR (filename[len - search_len - 1]))
> > > > >  	  || (HAS_DRIVE_SPEC (filename)
> > > > >  	      && STRIP_DRIVE_SPEC (filename) == &filename[len - search_len]));
> > > > >  }
> > > > 
> > > > I don't understand why the "match up to a slash" rule is now limited
> > > > to non-absolute file names.
> > > 
> > > FILENAME may contain for example:           /path/to//file.c
> > > Then we may request to put a breakpoint to:          /file.c:main
> > > And without
> > > the '!IS_ABSOLUTE_PATH (search_name) &&' part it would falsely match.
> > 
> > Thanks for explaining.  However, IMO i's wrong to test for double
> > slash with IS_ABSOLUTE_PATH, because the same could happen with
> > foo//bar.c, right?  So why not explicitly test for consecutive
> > slashes instead?
> 
> I do not understand much what do you suggest.

I'm saying that your addition of IS_ABSOLUTE_PATH to the test above
might fail file-name comparisons where they previously succeeded, and
for reasons that seem wrong to me.

IOW, I simply don't see why the test for IS_ABSOLUTE_PATH should be
added there.  What exactly would go wrong if you don't add it?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]