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

Hi,

On Sep 24, 2012, at 10:24 AM, Eli Zaretskii wrote:

>> From: Khoo Yit Phang <khooyp@cs.umd.edu>
>>
>> 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).
>
> 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. If we patch the gdb binary and incur the risk that a stray data-directory will lead to bugs. The first case is only slightly less convenient for GDB developers, and the second case is permanent to GDB users when installed.

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.

Yit
September 24, 2012