From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 316 invoked by alias); 3 Apr 2013 13:44:47 -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 304 invoked by uid 89); 3 Apr 2013 13:44:47 -0000 X-Spam-SWARE-Status: No, score=-8.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,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; Wed, 03 Apr 2013 13:44:44 +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 r33DifIr000840 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 3 Apr 2013 09:44:41 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r33DidZS003945; Wed, 3 Apr 2013 09:44:39 -0400 Message-ID: <515C3247.3050408@redhat.com> Date: Wed, 03 Apr 2013 17:14:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: Jan Kratochvil 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 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> <20130402152617.GA16641@host2.jankratochvil.net> In-Reply-To: <20130402152617.GA16641@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-04/txt/msg00072.txt.bz2 On 04/02/2013 04:26 PM, Jan Kratochvil wrote: > 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. Ack. It just sounded from the wording you were thinking of some specific case. > 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. Yeah. The history size is 256 by default, so IMO it's no big issue. It'd be worse if the history file could grow unbounded by default, IMO. I didn't realize ddd used annotations... I've updated the wiki's frontend hall of shame^Wfame: http://sourceware.org/gdb/wiki/GDB%20Front%20Ends > > 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. Good. > This command works for me: > unset GDBHISTFILE; gdb -ex "set history filename .gdb_history" Indeed it works. I actually didn't think to try it. I read: tmpenv = getenv ("GDBHISTFILE"); if (tmpenv) history_filename = xstrdup (tmpenv); else if (!history_filename) { /* We include the current directory so that if the user changes directories the file written will be the same as the one that was read. */ #ifdef __MSDOS__ /* No leading dots in file names are allowed on MSDOS. */ history_filename = concat (current_directory, "/_gdb_history", (char *)NULL); #else history_filename = concat (current_directory, "/.gdb_history", (char *)NULL); #endif } read_history (history_filename); noticed the explicit current directory handling and assumed it didn't. But, it doesn't work the same. Vis.: $ gdb (gdb) show history filename The filename in which to record the command history is "/tmp/.gdb_history". (gdb) q Notice, absolute path above. $ cd /tmp $ mkdir a $ gdb -ex "set history filename .gdbhist" (gdb) show history filename The filename in which to record the command history is ".gdbhist". (gdb) cd a Working directory /tmp/a. (gdb) q $ cat a/.gdbhist show history filename cd a q $ ls .gdbhist a/.gdbhist ls: cannot access .gdbhist: No such file or directory a/.gdbhist $ So, the current default resolves the relative .gdb_history path early on, meaning, the history file written is the same that was read, while "set history filename .gdb_history" resolves to different files at read and at write times, as seen in the example above. I'd call that a bug too. > > I do not understand why you mention $cwd, what $cwd should do differently? Not necessary it seems then. The above issue should be addressed though. Probably by making "set history filename"'s set hook resolve the path. Whether to make "show history filename" show just the resolved path, or both, I'm undecided. > > 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". Right. -- Pedro Alves