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

Khoo Yit Phang
2012-09-24T13:14:58Z

Hi,

On Sep 24, 2012, at 3:29 AM, Joel Brobecker wrote:

>> Personally, I'm not fond of either my patch or yours, since they hard
>> code parts of the build directory into the binary (whether
>> "data-directory" or "gdb/data-directory"). In either case, they can
>> lead to weird, difficult-to-understand behavior (possibly even
>> dangerous) in the off chance that one those directory exist. I'd
>> rather leave it out.
>
> Well, for my part, I cannot wait for this patch to go in, because
> I've grown accustomed to being able to just run the GDB from the
> build directory. Having to install it now is an important downer
> for me.

How about this solution, instead of patching the gdb binary, I can install a shell script into the build directory that contains:

#!/bin/sh
exec $BUILDDIR/gdb/gdb -data-directory $BUILDDIR/gdb/data-directory "$@"

and call this script "gdb-local" (or alternatively, call this script "gdb" and the rename the actual binary to "gdb.exe" in the build directory).

Yit
September 24, 2012