This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix calling gcore when gdb is not in $PATH.
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>
- Cc: "'gdb-patches at sourceware dot org'" <gdb-patches at sourceware dot org>
- Date: Fri, 11 Oct 2013 16:31:45 +0200
- Subject: Re: [PATCH] Fix calling gcore when gdb is not in $PATH.
- Authentication-results: sourceware.org; auth=none
- References: <525806C8 dot 8040108 at codesourcery dot com>
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
Thanks,
Jan