This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] Try to initialize data-directory by first searching for "data-directory" in the same directory as the gdb binary
Hi,
On Sep 24, 2012, at 12:09 PM, Khoo Yit Phang wrote:
> Hi,
>
> On Sep 24, 2012, at 11:26 AM, Joel Brobecker wrote:
>
>> Alternatively, we could think of having a routine that detects that
>> the GDB binary is uninstalled, and relocate all the various directories
>> differently. But that might be a bigger change that you'd want to, and
>> I'm not sure this is something that the community might want (because
>> it would add useless code for most users, only used by developers).
>
> 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.
Yit
September 24, 2012