From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80915 invoked by alias); 26 Jun 2015 14:18:19 -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 80899 invoked by uid 89); 26 Jun 2015 14:18:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 26 Jun 2015 14:18:17 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 6350A3650A4; Fri, 26 Jun 2015 14:18:16 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5QEIE1e026578; Fri, 26 Jun 2015 10:18:15 -0400 Message-ID: <558D5F26.4040401@redhat.com> Date: Fri, 26 Jun 2015 14:18:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Patrick Palka , gdb-patches@sourceware.org Subject: Re: [PATCH] Add option to remove duplicate command history entries References: <5578539E.1020806@redhat.com> <1434756821-7423-1-git-send-email-patrick@parcs.ath.cx> In-Reply-To: <1434756821-7423-1-git-send-email-patrick@parcs.ath.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-06/txt/msg00574.txt.bz2 On 06/20/2015 12:33 AM, Patrick Palka wrote: > index c9a532a..c5885eb 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -22644,6 +22644,21 @@ to 256 if this variable is not set. Non-numeric values of @env{GDBHISTSIZE} > are ignored. If @var{size} is @code{unlimited} or if @env{GDBHISTSIZE} is > either a negative number or the empty string, then the number of commands > @value{GDBN} keeps in the history list is unlimited. > + > +@cindex remove duplicate history > +@kindex set history remove-duplicates > +@item set history remove-duplicates @var{size} > +@itemx set history remove-duplicates unlimited > +Control the removal of duplicate history entries in the command history list. > +If @var{size} is non-zero, @value{GDBN} will look back at the last @var{size} Somehow, "size" here sounds a bit confusing to me. This not about that size of the duplicates. :-) And it's not about when the history gets to a certain size either. I'd suggest s/size/count/, or s/size/lookbehind/ or some such. > +history entries and remove the first entry that is a duplicate of the current > +entry being added to the command history list. If @var{size} is > +@code{unlimited} then this lookbehind is unbounded. If @var{size} is 0, then > +removal of duplicate history entries is disabled. > + > +Only history entries added during the current session are considered for > +removal. This option is set to 0 by default. > + > +proc check_prev_history_entry { entry { test_suffix "" } } { > + set test "history entry is $entry" > + if { $test_suffix != "" } { > + append test " $test_suffix" > + } > + > + # Send ^P followed by ^L. > + send_gdb "\x10\x0c" I have a feeling this may cause problems, but we'll see. > + > + gdb_expect { > + -re $entry { > + pass $test > + } > + timeout { > + fail $test > + } > + } > +} > + > +# By default the option is set to 0. > +gdb_exit > +gdb_start > +gdb_test "show history remove-duplicates" "is 0\\." > + > +# Test the "unlimited" setting. > +with_test_prefix "remove-duplicates=unlimited" { > + gdb_exit > + gdb_start > + gdb_test "set history remove-duplicates unlimited" > + > + gdb_test "print 0" > + gdb_test "print 1" > + gdb_test "print 2" > + gdb_test "print 1" > + gdb_test "print 1" > + gdb_test "print 2" > + gdb_test "print 3" > + gdb_test "print 3" > + gdb_test "print 4" > + gdb_test "print 1" > + gdb_test "print 2" > + gdb_test "print 3" > + gdb_test "print 4" Duplicate test names here. This should catch all: $ make check RUNTESTFLAGS="history-duplicates.exp" $ grep "PASS" testsuite/gdb.sum | sort | uniq -c | sort -n Otherwise this looks good to me. Thanks, Pedro Alves