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: [rfc] Use substitute-path for filename portion too


On Feb 7, 2008 10:13 AM, Daniel Jacobowitz <drow@false.org> wrote:
> On Thu, Feb 07, 2008 at 09:56:58AM -0800, Joel Brobecker wrote:
> > > +
> > > +  if (IS_ABSOLUTE_PATH (filename))
> > >      {
> > > -      /* If dirname is NULL, chances are the path is embedded in
> > > -         the filename.  Try the source path substitution on it.  */
> > > +      /* If filename is absolute path, try the source path
> > > +    substitution on it.  */
> >
> > Do we want to restrict this to filenames that are absolute paths?
> > Imagine the filename was codesourcery/bar/bar.h and the rewrite was
> > s/codesourcery/adacore/, do we want to attempt the rewrite then?
> > I suppose we should wait to see a real example of such a situation
> > before trying to support it...
>
> Are such rules supported?  I couldn't work out from the manual
> what FROM and TO had to be.

There is one related issue that I'd like to get fixed.  If there are
two files foo.c, and I want to set a breakpoint in one of them, there
is currently no robust way to do that.  If DW_AT_name includes _some_
directory information then it can work, i.e. I can say break
bar/foo.c:3 and it will only find bar/foo.c even if there is
baz/foo.c.  But this only works if DW_AT_name contains the requisite
directory instead of DW_AT_comp_dir containing the entire directory.
This can be achieved by specifying the path to gcc, e.g. gcc -c -g
bar/foo.c -o bar/foo.o instead of (cd bar && gcc -c -g foo.c).

I think what should happen is that if I say "break bar/foo.c:3" then
gdb should do the appropriate searching even if DW_AT_name is only
"foo.c".  If there is a collision gdb should probably either give an
error or give the user a choice - I can't imagine the user wanting to
choose "all" but I suppose that could be an option.

In conjunction with that I'd like to have emacs' "C-x space" set the
breakpoint in the correct file, but I'm not sure how much work that
would involve.  [This would extend to other frontends too.]


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