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-24T14:51:40Z

> From: Khoo Yit Phang <khooyp@cs.umd.edu>
> Date: Mon, 24 Sep 2012 10:37:17 -0400
> Cc: Khoo Yit Phang <khooyp@cs.umd.edu>,
> brobecker@adacore.com,
> jan.kratochvil@redhat.com,
> gdb-patches@sourceware.org
>
> > Please don't. Invoking GDB from the build directory should "just
> > work".
>
> What do you mean? If we call the shell script "gdb" (only in the build-directory, to clarify; it will not be installed to /usr/bin), then it will "just work" in almost all cases, except when running gdb on gdb.

First, running gdb on gdb is an important use case.

Second, there are systems (like MS-Windows) which cannot run Unix
shell scripts natively.

Third, why should I trust random shell scripts that come with the
distribution?

Forth, having a shell script that shadows a binary leads to confusion
and aggravation if the user is not aware of that dichotomy.

There are probably more reasons why.

> If we patch the gdb binary and incur the risk that a stray data-directory will lead to bugs.

I don't see how is this different from risk of running a stray shell
script.

> Even before my Python patch, it didn't always "just work", since gdb was picking up the wrong data-directory, and any updates to data-directory (XML signals or Python scripts) would have been missed.

I'm okay with fixing that.