[PATCH] Fix calling gcore when gdb is not in $PATH.
Luis Machado
lgustavo@codesourcery.com
Fri Oct 11 14:46:00 GMT 2013
On 10/11/2013 11:31 AM, Jan Kratochvil wrote:
> On Fri, 11 Oct 2013 16:10:16 +0200, Luis Machado wrote:
>> --- a/gdb/gcore.in
>> +++ b/gdb/gcore.in
>> @@ -51,7 +51,7 @@ for pid in $*
>> do
>> # `</dev/null' to avoid touching interactive terminal if it is
>> # available but not accessible as GDB would get stopped on SIGTTIN.
>> - @GDB_TRANSFORM_NAME@ </dev/null --nx --batch \
>> + "$(dirname "$0")"/@GDB_TRANSFORM_NAME@ </dev/null --nx --batch \
>
> I have only some concern if $0 does not contain a directory name.
> Then `dirname basename` will be . and gdb -> ./gdb will be a regression as
> ./gdb will typically not be found.
>
> For example if you run:
> $ sh gcore foo
> then sh (or bash) executes /usr/bin/gcore but $0 is still just "gcore".
>
> It IMO even corresponds to the sh $0 POSIX description ("command_file"):
> http://pubs.opengroup.org/onlinepubs/007908799/xcu/sh.html
Right. That situation can indeed happen. Though it looks a little
awkward to call something in your path like that.
I suppose we can extend the check to cover that case as well. Let me go
back to the drawing board.
Thanks,
Luis
More information about the Gdb-patches
mailing list