From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22838 invoked by alias); 8 May 2013 17:05:51 -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 22829 invoked by uid 89); 8 May 2013 17:05:50 -0000 X-Spam-SWARE-Status: No, score=-8.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_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, 08 May 2013 17:05:50 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r48H5mHU024933 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 8 May 2013 13:05:48 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r48H5kFv021593; Wed, 8 May 2013 13:05:47 -0400 Message-ID: <518A85EA.3070006@redhat.com> Date: Wed, 08 May 2013 17:05: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: mbilal CC: gdb-patches@sourceware.org, jan.kratochvil@redhat.com Subject: Re: [PATCH 5/7] PR gdb/15224 should "set history save on" by default References: <51877A32.1030503@codesourcery.com> <51877A99.4060503@codesourcery.com> <51877B42.7@codesourcery.com> <51877BC6.6080007@codesourcery.com> <51877C76.2000509@codesourcery.com> In-Reply-To: <51877C76.2000509@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-05/txt/msg00287.txt.bz2 On 05/06/2013 10:48 AM, mbilal wrote: > On Wednesday, April 03, 2013 7:30 PM Jan Kratochvil wrote: > >> (6) Change the default set history filename to ~/.gdb_history. > > patch is here. > > Index: top.c > =================================================================== > RCS file: /cvs/src/src/gdb/top.c,v > retrieving revision 1.235 > diff -u -p -r1.235 top.c > --- top.c 17 Apr 2013 01:02:02 -0000 1.235 > +++ top.c 6 May 2013 07:17:13 -0000 > @@ -1616,7 +1616,8 @@ void > init_history (void) > { > char *tmpenv; > - > + char *homedir; > + homedir = getenv ("HOME"); > tmpenv = getenv ("HISTSIZE"); > if (tmpenv) > { > @@ -1651,10 +1652,10 @@ init_history (void) > that was read. */ > #ifdef __MSDOS__ > /* No leading dots in file names are allowed on MSDOS. */ > - history_filename = concat (current_directory, "/_gdb_history", > + history_filename = concat (homedir, "/_gdb_history", > (char *)NULL); > #else > - history_filename = concat (current_directory, "/.gdb_history", > + history_filename = concat (homedir, "/.gdb_history", > (char *)NULL); > #endif This doesn't handle the case of HOME not being set. It's better to use readline's tilde_expand, which handles that by falling back to looking up the directory in the password database. If I'm reading the source correctly, I believe that's also what bash does (likewise using readline's tilde_expand), though I haven't stepped through it. As simple as: #ifdef __MSDOS__ /* No leading dots in file names are allowed on MSDOS. */ history_filename = tilde_expand ("~/_gdb_history"), #else history_filename = tilde_expand ("~/.gdb_history"); #endif > } > Index: testsuite/gdb.base/default.exp > =================================================================== > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/default.exp,v > retrieving revision 1.64 > diff -u -p -r1.64 default.exp > --- testsuite/gdb.base/default.exp 15 Apr 2013 18:09:02 -0000 1.64 > +++ testsuite/gdb.base/default.exp 6 May 2013 07:52:42 -0000 > @@ -642,7 +642,8 @@ gdb_test "show height" "Number of lines > #test show history expansion > gdb_test "show history expansion" "History expansion on command input is o\[a-z\]*.*" "show history expansion" > #test show history filename > -gdb_test "show history filename" "The filename in which to record the command history is.*.gdb_history.*" "show history filename" > +gdb_test "show history filename" "The filename in which to record the command history is .$env(HOME).*.gdb_history.*." \ > + "show history filename .$env(HOME).*.gdb_history." With remote host testing, dejagnu runs on different machine (build) where GDB itself runs (host), so this assumption that $env(HOME) always matches gdb's $HOME isn't always true. I think we need to either Use "remote_exec host" or gdb's "show environment" to get at the right $HOME. A ChangeLog entry is missing. -- Pedro Alves