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

Eli Zaretskii
2012-09-24T21:08:26Z

> Date: Mon, 24 Sep 2012 22:49:31 +0200
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: Khoo Yit Phang <khooyp@cs.umd.edu>, jan.kratochvil@redhat.com,
> gdb-patches@sourceware.org
>
> > > > 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.

What's wrong with "../data-directory" relative to the directory from
which 'gdb' was invoked?