This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] -iex and -ix: Execute them _after_ gdbinits
On Sat, 16 Jun 2012 22:05:29 +0200, Eli Zaretskii wrote:
> > Date: Sat, 16 Jun 2012 21:54:17 +0200
> > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> >
> > Before 7.5 gets branched/released I would like to yet change behavior of this
> > new feature. The current order is:
> > 1. -iex and -ix
> > 2. /etc/gdbinit, ~/.gdbinit
> > 2. inferior load
> > 3. -ex and -x etc.
> >
> > I would like to swap 1 <-> 2:
> > 1. /etc/gdbinit, ~/.gdbinit
> > 2. -iex and -ix
> > 2. inferior load
> > 3. -ex and -x etc.
>
> That would make it impossible to run a command before loading
> .gdbinit, right?
There is additionally:
4. load .gdbinit from the inferior's directory
If you are in directory ~ then the .gdbinit file is considered to be
~/.gdbinit (and not inferior .gdbinit).
Does it answer your question? Do you see any problem with the new behavior.
> > In practice I found I need to override 'set auto-load safe-path ...' pre-set
> > by ~/.gdbinit for specific GDB runs by -iex. There is no other way to do it.
>
> We could invent some other way of doing that, but without taking away
> what users can do now.
I have not found a use case where the current behavior is better.
> > Contrary to it I cannot imagine why one would want to get -iex commands
> > overriden by /etc/gdbinit and ~/.gdbinit.
>
> Not overriden by, _executed_before_.
I also agree with "executed before" but in practice it means that if distro
for example (Fedora does not) puts into /etc/gdbinit:
set auto-load safe-path /opt:/distro-dir:/bin
Then there is no chance to use -iex 'set auto-load safe-path ...' currently.
(One can use add-auto-load-safe-path everywhere which would work, but then
still one cannot remove/reset directories.)
Thanks,
Jan