From patchwork Tue Feb 7 11:59:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 19140 Received: (qmail 124854 invoked by alias); 7 Feb 2017 12:00:00 -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 124826 invoked by uid 89); 7 Feb 2017 12:00:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.1 required=5.0 tests=BAYES_00, KAM_TK, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 spammy=fragment, eval, Hx-languages-length:2905, H*M:4e1a 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 ESMTP; Tue, 07 Feb 2017 11:59:50 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A0BA7FB63; Tue, 7 Feb 2017 11:59:50 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v17BxlGL020212; Tue, 7 Feb 2017 06:59:48 -0500 Subject: Re: [PATCH,v2] Fix gdb.linespec/explicit.exp To: Luis Machado , gdb-patches@sourceware.org, keiths@redhat.com References: <1485552639-18470-1-git-send-email-lgustavo@codesourcery.com> <1485870899-12563-1-git-send-email-lgustavo@codesourcery.com> From: Pedro Alves Message-ID: Date: Tue, 7 Feb 2017 11:59:46 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1485870899-12563-1-git-send-email-lgustavo@codesourcery.com> On 01/31/2017 01:54 PM, Luis Machado wrote: > The first one is that i couldn't see the hex character x07 being ouput in both > of the above systems for this particular test. There is really only one > possible completion result for the main function. Maybe this character is > output in other systems? Yes. Readline outputs the bell character (x07) when there's more than one possible completion. I actually tripped on this a couple months back, while working on my palves/cp-linespec branch (on my github, it reworks completion support and adds a real linespec completer). I have a fix there that says: ~~~ On the explicit.exp change: The test currently expects a bell because: (gdb) complete b -function main b -function main b -function main_arena "main_arena" is a data global part of glibc's malloc implementation. I.e., the test must be failing on target whose malloc implementation doesn't share an ancestry with glibc's... ~~~ So if you're on a glibc system with debug info for glibc, you'll see the bell. Elsewhere, you won't. The real problem is that the completer for linespecs should not be finding "main_arena", because that's a data symbol, not a function. The change to the test itself in the branch is: > > So i started playing around with the regular expression to make x07 optional, > but no matter what pattern i used, it just didn't match. > > It was then that i noticed we're missing a leading "-re" before the > gdb_test_multiple pattern to be matched, the second problem. I checked the > documentation for the command and did not find anything about the use > without "-re". So i assumed it is an oversight. gdb_test_multiple is just a wrapper around expect. Not writing "-re" just means you're matching a pattern literally, instead of with a regex. So without the -re, regexp things like ? or * have no special meaning, they are matched literally. See the manual at , after "For example, the following fragment looks". > Make the x07 character optional in the unique function name completion > test. This test is exercising completion of a _unique_ function name, so expecting a bell never really made sense... A better fix would be to try completion of a symbol name that is more likely to not conflict with some other system symbol, like Keith was suggesting. Meanwhile, this is OK (with the commit log adjusted / clarified). Thanks, Pedro Alves --- a/gdb/testsuite/gdb.linespec/explicit.exp +++ b/gdb/testsuite/gdb.linespec/explicit.exp @@ -187,7 +187,7 @@ namespace eval $testfile { set tst "complete unique function name" send_gdb "break -function mai\t" gdb_test_multiple "" $tst { - "break -function mai\\\x07n" { + "break -function main" { send_gdb "\n" gdb_test "" ".*Breakpoint \[0-9\]+.*" $tst gdb_test_no_output "delete \$bpnum" "delete $tst breakpoint"