From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2947 invoked by alias); 22 Jun 2012 07:51:37 -0000 Received: (qmail 2938 invoked by uid 22791); 22 Jun 2012 07:51:34 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 22 Jun 2012 07:51:20 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5M7pHEU018980 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 22 Jun 2012 03:51:17 -0400 Received: from host2.jankratochvil.net (ovpn-116-33.ams2.redhat.com [10.36.116.33]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5M7pD9C007516 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 22 Jun 2012 03:51:16 -0400 Date: Fri, 22 Jun 2012 07:51:00 -0000 From: Jan Kratochvil To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [patch] -iex and -ix: Execute them _after_ gdbinits Message-ID: <20120622075113.GA9742@host2.jankratochvil.net> References: <20120616195417.GA6368@host2.jankratochvil.net> <83txybdnue.fsf@gnu.org> <20120616201312.GA7000@host2.jankratochvil.net> <83sjdvdkns.fsf@gnu.org> <20120616213126.GA12840@host2.jankratochvil.net> <83r4teejkj.fsf@gnu.org> <20120617065014.GA16029@host2.jankratochvil.net> <20120620190124.GA21945@host2.jankratochvil.net> <83sjdpdbac.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83sjdpdbac.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00681.txt.bz2 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