From patchwork Tue May 27 16:45:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 1171 Received: (qmail 25878 invoked by alias); 27 May 2014 16:46:01 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 25865 invoked by uid 89); 27 May 2014 16:45:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-gw3-out.broadcom.com Received: from mail-gw3-out.broadcom.com (HELO mail-gw3-out.broadcom.com) (216.31.210.64) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 May 2014 16:45:58 +0000 Received: from irvexchcas06.broadcom.com (HELO IRVEXCHCAS06.corp.ad.broadcom.com) ([10.9.208.53]) by mail-gw3-out.broadcom.com with ESMTP; 27 May 2014 09:47:26 -0700 Received: from IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 27 May 2014 09:45:42 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) with Microsoft SMTP Server id 14.3.174.1; Tue, 27 May 2014 09:45:42 -0700 Received: from [10.177.72.92] (unknown [10.177.72.92]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 856A59FA00; Tue, 27 May 2014 09:45:33 -0700 (PDT) Message-ID: <5384C12C.2020602@broadcom.com> Date: Tue, 27 May 2014 17:45:32 +0100 From: Andrew Burgess User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: CC: Subject: Re: [PATCH] Add autocompletion for convenience vars in print and set References: <87tx8ks8yv.fsf@fleche.redhat.com> In-Reply-To: X-IsSubscribed: yes On 22/05/2014 4:17 PM, Daniel Gutson wrote: > Second version. > Comments below: > > On Tue, May 20, 2014 at 1:36 PM, Tom Tromey wrote: >>>>>>> "Daniel" == Daniel Gutson writes: >> >> Daniel> I could not find any testsuite where to add tests for this; if >> Daniel> there are, please let me know. >> >> See testsuite/gdb.base/completion.exp > > Thanks, I ran all the tests and passed. I did not add a new test > case though since I didn't check how to add a new convenience var > and undefine it later from the test framework. (Should I try harder?) I'm not a maintainer, but you'll probably be asked for some tests of this (really useful) feature. I don't think you need to worry about removing any convenience variables you create, each .exp test file starts gdb afresh, and sometime (look for clean_restart) gdb is restarted within a single .exp file. For this feature you can probably get away with just adding some new tests to the end of the completion.exp file, I've included an example test in this mail, but you'll probably want some more. thanks, Andrew diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 2608309..c028548 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -747,6 +747,27 @@ gdb_test_multiple "" "$test" { } } +set test "complete '\$cv_'" +gdb_test_no_output "set \$cv_aaa = 4" \ + "Create convenience variable \$cv_aaa" +send_gdb "p \$cv_" +gdb_test_multiple "" "$test" { + -re "^p \\\$cv_" { + send_gdb "\t" + gdb_test_multiple "" "$test" { + -re "aaa $" { + send_gdb "\n" + gdb_test_multiple "" "$test" { + -re "\\\$\[0-9\]+ = 4.*$gdb_prompt $" { + pass "$test" + } + } + } + } + } +} + + # Restore globals modified in this test... set timeout $oldtimeout1