Re: [PATCH 2/2] Try to initialize data-directory by first searching for "data-directory" in the same directory as the gdb binary

Joel Brobecker
2012-09-24T20:49:54Z

> > > A simpler alternative would be to detect if the gdb_program_name
> > > == $BUILDDIR/gdb/gdb, then only look for
> > > $BUILDDIR/gdb/data-directory. It would still hard code parts of
> > > the build directory into the binary (i.e., make sure you don't
> > > have any embarrassing/privacy-leaking paths in your home directory
> > > structure), but would much lessen the risk of a stray
> > > data-directory. What do you think?
> >
> > Here's yet another alternative: gdb already tries to locate
> > data-directory in $BUILDDIR/share/gdb as part of the relocation
> > logic; we can install a symlink there that points to
> > $BUILDDIR/gdb/data-directory, or make a copy for platforms that
> > don't support symlinks.
>
> I liked the first of these two better. It is simpler.

I am not sure it is simpler, because I don't think that the GDB binary
knows what the $BUILDDIR was. I am also wondering whether we might
activate the in-true use feature by accident too. I like the second
suggestion because it's very simple (as you could see from the patch),
and avoids touching the behavior in the installed-case. In other words,
our requirement does not affect the behavior at the end-user level.

--
Joel