From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21440 invoked by alias); 2 Apr 2013 15:26:37 -0000 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 Received: (qmail 21175 invoked by uid 89); 2 Apr 2013 15:26:29 -0000 X-Spam-SWARE-Status: No, score=-7.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 02 Apr 2013 15:26:26 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r32FQN0o016174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 2 Apr 2013 11:26:23 -0400 Received: from host2.jankratochvil.net (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r32FQIXO012253 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 2 Apr 2013 11:26:21 -0400 Date: Tue, 02 Apr 2013 17:10:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: mbilal , gdb-patches@sourceware.org, tromey@redhat.com Subject: Re: Fwd: [PATCH] Fix for PR gdb/15224 should "set history save on" by default Message-ID: <20130402152617.GA16641@host2.jankratochvil.net> References: <51558CB4.8010003@codesourcery.com> <51558EC5.2030806@codesourcery.com> <20130329141514.GA16671@host2.jankratochvil.net> <5159707E.9090209@redhat.com> <20130401122930.GA14029@host2.jankratochvil.net> <5159966F.1030809@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5159966F.1030809@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-04/txt/msg00049.txt.bz2 On Mon, 01 Apr 2013 16:15:11 +0200, Pedro Alves wrote: > On 04/01/2013 01:29 PM, Jan Kratochvil wrote: > >> > The history's filename is also tweakable with the GDBHISTFILE > >> > environment variable (there's HISTSIZE too; 'GDBHISTFILE= gdb' effectively > >> > disables history load/save). Doesn't feel quite right to tie this to .gdbinit. > > It matters how are the existing environments set up. And by default neither > > HISTSIZE nor GDBHISTFILE environment variables are set. > > Not clear to me which environments you're referring to here, How >90% of GDB users run it. > if you're referring to any specific environments. (HISTSIZE won't be as rare, > because that's also the variable used by bash. We should probably > have a GDBHISTSIZE too.) I meant >90% of GDB users do not have GDBHISTFILE environment variables set. > I think however, that whether to write history to file should also > check whether we're in interactive debugging mode: > > /* Save the history information if it is appropriate to do so. */ > if (write_history_p && history_filename) > write_history (history_filename); > > That is, e.g., this touches history: > > $ ls -als ~/.gdbhist > 4 -rw-------. 1 pedro pedro 27 Apr 1 14:10 /home/pedro/.gdbhist > $ date > Mon Apr 1 14:37:01 WEST 2013 > $ gdb -ex "set history filename ~/.gdbhist" < /dev/null > (gdb) quit > $ ls -als ~/.gdbhist > 4 -rw-------. 1 pedro pedro 27 Apr 1 14:37 /home/pedro/.gdbhist > > That, I'd call a bug. I agree. > > Probably, it'd be best to use input_from_terminal_p, which also > checks for --batch mode, among other things. > > I think that all covers cases like abrt and other crash catchers that > spawn gdb? Hopefully they usually use redirection from file so ISATTY should catch that which I did not realize before. OK, that seems as a good plan - with patching the GDB testsuite to disable history saving. I expect it will still affect some 3rd party testsuite using GDB but you have convinced me such cases will not be significant enough. I tested now that "ddd" will store the history commands like "step". But as it runs GBD with "gdb -q -fullname PROGNAME" it already happens if one has "set history save on" in ~/.gdbinit so I would not call that a regression. http://pkgs.fedoraproject.org/cgit/gdb.git/plain/gdb-6.5-BEA-testsuite.patch is using: cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" > $LOG which should get handled by existing ISATTY in GDB. > > I see there should be also changed the default to: > > set history filename ~/.gdb_history > > > > Otherwise it is a similar pain to ./.gdbinit, it is also non-standard to any > > other normal application which use history files in $HOME, I do not find using > > ./.gdb_history by default as acceptable. > > That'd be fine with me. However, we'd need a way to be able to specify > "./.gdbinit" back. We have precedent for "$cwd", so perhaps that would > best be addressed by making "set history filename $cwd/.gdb_history" work. This command works for me: unset GDBHISTFILE; gdb -ex "set history filename .gdb_history" I do not understand why you mention $cwd, what $cwd should do differently? I was expecting that by default cd /tmp; (unset GDBHISTFILE; gdb -nx) will change from (gdb) show history filename The filename in which to record the command history is "/tmp/.gdb_history". to (gdb) show history filename The filename in which to record the command history is "/home/user/.gdb_history". . Jan