Re: one week to gdb-7.6 release?

Pedro Alves
2013-04-06T13:56:44Z

On 03/25/2013 04:58 PM, Eli Zaretskii wrote:
>> From: Mark Kettenis <mark.kettenis@xs4all.nl>
>>> From: Eli Zaretskii <eliz@gnu.org>
>>> I think on Posix platforms, the way to convert argv[0] to an absolute
>>> file name is to search PATH.
>>
>> Not really; argv[0] can be set to anything. It's just convention that
>> it gets set to the name of the program being executed.
>
> Well, if it isn't set to the name of the program, and its leading
> directory doesn't name the directory where the real GDB executable
> lives, then relocation of directories simply cannot work, and
> shouldn't be expected to. I think we should only care about the use
> cases where the pre-conditions for relocation do exist.

Replying mainly for the archives. On Linux, we can always
readlink /proc/self/exe to figure out the full program path.
That steps out of Posix, of course.

An easy way to set the argv[0] to anything is with bash's exec
command:

$ (exec -a foo ./gdb)
...
(gdb) ^Z
[1]+ Stopped ( exec -a foo ./gdb )
$ pidof foo
27543
$ readlink /proc/27543/exe
/home/pedro/gdb/mygit/build/gdb/gdb

I'm not suggesting this is a use case we need to bother with.

--
Pedro Alves