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-24T18:12:53Z

> From: Khoo Yit Phang <khooyp@cs.umd.edu>
> Date: Mon, 24 Sep 2012 12:45:21 -0400
> Cc: Joel Brobecker <brobecker@adacore.com>, Jan Kratochvil <jan.kratochvil@redhat.com>, GDB Patches <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.