Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] -iex and -ix: Execute them _after_ gdbinits
Date: Fri, 22 Jun 2012 07:51:00 -0000	[thread overview]
Message-ID: <20120622075113.GA9742@host2.jankratochvil.net> (raw)
In-Reply-To: <83sjdpdbac.fsf@gnu.org>

On Wed, 20 Jun 2012 21:38:03 +0200, Eli Zaretskii wrote:
> > are you still against this patch to reach gdb-7.5 before it gets branched?
> 
> I don't remember seeing any arguments to the contrary.  If others
> disagree with me, I'd love to hear why.

> Specifically, why isn't it a
> good feature to be able to execute commands before loading .gdbinit?

I do not see how it could be useful, in such cases one can execute the
commands after loading /etc/gdbinit or ~/.gdbinit with the same effect.  If
you mean ./.gdbinit then this proposed patch (change A to B) does not change
anything in such scenarios.

A - execute -iex/-ix as is in FSF GDB HEAD
  - execute /etc/gdbinit and ~/.gdbinit
B - execute -iex/-ix as is proposed in this patch
  - load inferior
  - load current directory ./.gdbinit
C - execute -ex/-x as always have been in any previous GDB

It was found out we need (=it would be useful to) to have feature B - see the
examples X1 and X2 below.

Having A is nice but if it does the same as B (see example Z) then feature
A is just a burden of additional option/command/documentation.  I think that
if we already have B then we should remove A.  Therefore just rename A to B.

Example Y shows when B is useful and neither A or C can be used instead but it
really is a made up case which makes no sense in real world to me.  Unless
someone figures out a better example of the Y type than I could.


X1 - Example when B is useful and neither A nor C can be used instead:
/etc/gdbinit:set auto-load safe-path $debugdir:$datadir/auto-load:/opt
gdb -iex "add-auto-load-safe-path $PWD" ./emacs
without having B:
warning: File ".../emacs-23.2/src/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/opt".
 - Using A option -iex does not work, it gets overriden by /etc/gdbinit.
 - Using C option -ex  does not work, it is too late.
with having B:
".../emacs-23.2/src/.gdbinit" gets successfully executed.

X2 - Example when B is useful and neither A nor C can be used instead:
/etc/gdbinit:set debug-file-directory /usr/lib/debug
gdb -iex 'set debug-file-directory ~/lib/debug' ~/bin/inferior
without having B:
Reading symbols from /home/user/bin/inferior...(no debugging symbols found)...done.
 - Using A option -iex does not work, it gets overriden by /etc/gdbinit.
 - Using C option -ex  does not work, it is too late.
with having B:
Reading symbols from /home/user/bin/inferior/bin/inferior...Reading symbols from /home/user/lib/debug/bin/inferior.debug...done.done.

Y - Example when A is useful and neither B nor C can be used instead:
build/gdb/configure --with-separate-debug-dir=/wrong/path/to/debug
/etc/gdbinit or ~/.gdbinit:file /bin/bash
gdb -iex 'set debug-file-directory /usr/lib/debug'
with having A:
Reading symbols from /bin/bash...Reading symbols from /usr/lib/debug/bin/bash.debug...done.done.
 - Using B option -iex or C option -ex are both too late.
without having A:
Reading symbols from /bin/bash...(no debugging symbols found)...done.

X1 and X2 seem to be real world cases to me.  I have given Y as a proof such
case exists but loading inferior from /etc/gdbinit or ~/.gdbinit makes no
sense to me, it is not a real world scenario.  FYI loading inferior from
./.gdbinit is not the Y case:

Z - Example when both A and B work the same (C cannot be used):
/etc/gdbinit:set auto-load safe-path $debugdir:$datadir/auto-load:/opt
./.gdbinit:file ./emacs
with having either A or B:
gdb -iex "add-auto-load-safe-path $PWD" ./emacs
".../emacs-23.2/src/.gdbinit" gets successfully executed.
 - Using both A and B option -iex works the same.
without having either A or B (not discussed here, such GDB has never existed):
gdb -ex "add-auto-load-safe-path $PWD" ./emacs
warning: File ".../emacs-23.2/src/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/opt".
 - Using C option -ex would be too late.

Thanks for the discussion but I would like to fix it for the first public
release (7.5).


Thanks,
Jan


  reply	other threads:[~2012-06-22  7:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-16 19:54 Jan Kratochvil
2012-06-16 20:05 ` Eli Zaretskii
2012-06-16 20:13   ` Jan Kratochvil
2012-06-16 21:14     ` Eli Zaretskii
2012-06-16 21:32       ` Jan Kratochvil
2012-06-17  2:52         ` Eli Zaretskii
2012-06-17  6:50           ` Jan Kratochvil
2012-06-20 19:01             ` Jan Kratochvil
2012-06-20 19:38               ` Eli Zaretskii
2012-06-22  7:51                 ` Jan Kratochvil [this message]
2012-06-22  9:44                   ` Eli Zaretskii
2012-06-22 11:32                     ` Jan Kratochvil
2012-06-22 13:26                       ` Eli Zaretskii
2012-06-22 13:48                         ` Jan Kratochvil
2012-06-22 14:19                         ` Tom Tromey
2012-06-22 14:41                           ` Eli Zaretskii
2012-07-02 12:05                         ` [commit] " Jan Kratochvil
2012-06-22 14:18           ` Tom Tromey
2012-06-19  7:59         ` Doug Evans
2012-06-22 14:17   ` Tom Tromey
2012-06-18 16:45 ` Joel Brobecker
2012-06-22 14:17 ` Tom Tromey
2012-06-22 16:12   ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120622075113.GA9742@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox