From patchwork Fri Nov 24 16:57:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 24500 Received: (qmail 74963 invoked by alias); 24 Nov 2017 16:57:28 -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 74948 invoked by uid 89); 24 Nov 2017 16:57:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KB_WAM_FROM_NAME_SINGLEWORD, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=hey 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; Fri, 24 Nov 2017 16:57:26 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C76A80F9C for ; Fri, 24 Nov 2017 16:57:25 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE34F60A98; Fri, 24 Nov 2017 16:57:24 +0000 (UTC) Subject: Re: [PATCH 32/40] Make "break foo" find "A::foo", A::B::foo", etc. [C++ and wild matching] To: Keith Seitz , gdb-patches@sourceware.org References: <1496406158-12663-1-git-send-email-palves@redhat.com> <1496406158-12663-33-git-send-email-palves@redhat.com> <024edecc-7bfa-08a4-de46-3536297f0654@redhat.com> <943402c5-0bbb-8ff7-66e3-5522256fbc1e@redhat.com> <3692eedd-6f0f-2c6b-535c-2c5682dc938e@redhat.com> From: Pedro Alves Message-ID: <0d9b7894-0ad4-2437-e552-8d75f2a0e4d0@redhat.com> Date: Fri, 24 Nov 2017 16:57:24 +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: <3692eedd-6f0f-2c6b-535c-2c5682dc938e@redhat.com> On 11/24/2017 04:48 PM, Pedro Alves wrote: > Hey Keith, > > So I took your suggestion and ran with it. And in the end > I like it! See more below. > ... > Surprisingly, I didn't have to change much in the tests. But I did > extend them to cover these new possibilities. I'll show the tests > delta as a follow up. Here it is. This covers -qualified with linespecs that have more components than just then function name, and also explicit locations with -qualified in different positions. From c06f24e28a4ae9afbb40b7c4f61db57b3e9c2b7b Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 24 Nov 2017 16:32:04 +0000 Subject: [PATCH] Fix/extend tests --- gdb/testsuite/gdb.linespec/cpcompletion.exp | 64 ++++++++++++++---------- gdb/testsuite/gdb.linespec/explicit.exp | 77 ++++++++++++++++++----------- 2 files changed, 85 insertions(+), 56 deletions(-) diff --git a/gdb/testsuite/gdb.linespec/cpcompletion.exp b/gdb/testsuite/gdb.linespec/cpcompletion.exp index 5522b19..25f7f81 100644 --- a/gdb/testsuite/gdb.linespec/cpcompletion.exp +++ b/gdb/testsuite/gdb.linespec/cpcompletion.exp @@ -190,37 +190,49 @@ proc_with_prefix overload-2 {} { # Test linespecs / locations using fully-qualified names. proc_with_prefix fqn {} { - set cmd_prefix "b -qualified" - test_gdb_complete_unique \ - "$cmd_prefix overload2_func" \ - "$cmd_prefix overload2_function(overload2_arg1)" + # "-qualified" works with both explicit locations and linespecs. + # Also test that combining a source file with a function name + # still results in a full match, with both linespecs and explicit + # locations. + foreach cmd_prefix { + "b -qualified " + "b -qualified -function " + "b -qualified cpls.cc:" + "b -qualified -source cpls.cc -function " + "b -source cpls.cc -qualified -function " + } { + test_gdb_complete_unique \ + "${cmd_prefix}overload2_func" \ + "${cmd_prefix}overload2_function(overload2_arg1)" - # Drill down until we find a unique completion. - test_gdb_complete_multiple "$cmd_prefix " "ns_overload2_test::" "" { - "ns_overload2_test::(anonymous namespace)::ns_overload2_test::overload2_function(overload2_arg9)" - "ns_overload2_test::(anonymous namespace)::ns_overload2_test::struct_overload2_test::overload2_function(overload2_arga)" - "ns_overload2_test::(anonymous namespace)::overload2_function(overload2_arg7)" - "ns_overload2_test::(anonymous namespace)::struct_overload2_test::overload2_function(overload2_arg8)" - "ns_overload2_test::overload2_function(overload2_arg5)" - "ns_overload2_test::struct_overload2_test::overload2_function(overload2_arg6)" - } + # Drill down until we find a unique completion. + test_gdb_complete_multiple "${cmd_prefix}" "ns_overload2_test::" "" { + "ns_overload2_test::(anonymous namespace)::ns_overload2_test::overload2_function(overload2_arg9)" + "ns_overload2_test::(anonymous namespace)::ns_overload2_test::struct_overload2_test::overload2_function(overload2_arga)" + "ns_overload2_test::(anonymous namespace)::overload2_function(overload2_arg7)" + "ns_overload2_test::(anonymous namespace)::struct_overload2_test::overload2_function(overload2_arg8)" + "ns_overload2_test::overload2_function(overload2_arg5)" + "ns_overload2_test::struct_overload2_test::overload2_function(overload2_arg6)" + } - test_gdb_complete_multiple "$cmd_prefix " "ns_overload2_test::(anonymous namespace)::" "" { - "ns_overload2_test::(anonymous namespace)::ns_overload2_test::overload2_function(overload2_arg9)" - "ns_overload2_test::(anonymous namespace)::ns_overload2_test::struct_overload2_test::overload2_function(overload2_arga)" - "ns_overload2_test::(anonymous namespace)::overload2_function(overload2_arg7)" - "ns_overload2_test::(anonymous namespace)::struct_overload2_test::overload2_function(overload2_arg8)" - } + test_gdb_complete_multiple "${cmd_prefix}" "ns_overload2_test::(anonymous namespace)::" "" { + "ns_overload2_test::(anonymous namespace)::ns_overload2_test::overload2_function(overload2_arg9)" + "ns_overload2_test::(anonymous namespace)::ns_overload2_test::struct_overload2_test::overload2_function(overload2_arga)" + "ns_overload2_test::(anonymous namespace)::overload2_function(overload2_arg7)" + "ns_overload2_test::(anonymous namespace)::struct_overload2_test::overload2_function(overload2_arg8)" + } - test_gdb_complete_multiple "$cmd_prefix " "ns_overload2_test::(anonymous namespace)::ns_overload2_test::" "" { - "ns_overload2_test::(anonymous namespace)::ns_overload2_test::overload2_function(overload2_arg9)" - "ns_overload2_test::(anonymous namespace)::ns_overload2_test::struct_overload2_test::overload2_function(overload2_arga)" - } + test_gdb_complete_multiple "${cmd_prefix}" "ns_overload2_test::(anonymous namespace)::ns_overload2_test::" "" { + "ns_overload2_test::(anonymous namespace)::ns_overload2_test::overload2_function(overload2_arg9)" + "ns_overload2_test::(anonymous namespace)::ns_overload2_test::struct_overload2_test::overload2_function(overload2_arga)" + } - test_gdb_complete_unique \ - "$cmd_prefix ns_overload2_test::(anonymous namespace)::ns_overload2_test::overload2_func" \ - "$cmd_prefix ns_overload2_test::(anonymous namespace)::ns_overload2_test::overload2_function(overload2_arg9)" + test_gdb_complete_unique \ + "${cmd_prefix}ns_overload2_test::(anonymous namespace)::ns_overload2_test::overload2_func" \ + "${cmd_prefix}ns_overload2_test::(anonymous namespace)::ns_overload2_test::overload2_function(overload2_arg9)" + + } } # Check that a fully-qualified looked name don't match symbols in diff --git a/gdb/testsuite/gdb.linespec/explicit.exp b/gdb/testsuite/gdb.linespec/explicit.exp index 8fcdf62..1e7f0dc 100644 --- a/gdb/testsuite/gdb.linespec/explicit.exp +++ b/gdb/testsuite/gdb.linespec/explicit.exp @@ -409,40 +409,57 @@ namespace eval $testfile { "task" "thread" } - foreach what { "-function" "-label" "-line" "-qualified" "-source" } { - with_test_prefix "complete after $what" { - if {$what != "-line"} { - test_gdb_complete_multiple \ - "b $what argument " "" "" $completions_list - test_gdb_complete_unique \ - "b $what argument thr" \ - "b $what argument thread" - test_gdb_complete_unique \ - "b $what argument -fun" \ - "b $what argument -function" - } else { - # After -line, we expect a number / offset. - foreach line {"10" "+10" "-10"} { - test_gdb_complete_multiple \ - "b -line $line " "" "" $completions_list - test_gdb_complete_unique \ - "b -line $line thr" \ - "b -line $line thread" - test_gdb_complete_unique \ - "b -line $line -fun" \ - "b -line $line -function" + foreach what { "-function" "-label" "-line" "-source" } { + # Also test with "-qualified" appearing before the + # explicit location. + foreach prefix {"" "-qualified "} { + + # ... and with "-qualified" appearing after the + # explicit location. + foreach suffix {"" " -qualified"} { + with_test_prefix "complete after $prefix$what$suffix" { + if {$what != "-line"} { + set w "$prefix$what argument$suffix " + test_gdb_complete_multiple \ + "b $w" "" "" $completions_list + test_gdb_complete_unique \ + "b $w thr" \ + "b $w thread" + test_gdb_complete_unique \ + "b $w -fun" \ + "b $w -function" + } else { + # After -line, we expect a number / offset. + foreach line {"10" "+10" "-10"} { + set w "$prefix-line $line$suffix" + test_gdb_complete_multiple \ + "b $w " "" "" $completions_list + test_gdb_complete_unique \ + "b $w thr" \ + "b $w thread" + test_gdb_complete_unique \ + "b $w -fun" \ + "b $w -function" + } + + # With an invalid -line argument, we don't get any + # completions. + test_gdb_complete_none "b $prefix-line argument$suffix " + } + } - # With an invalid -line argument, we don't get any - # completions. - test_gdb_complete_none "b -line argument " } - # Don't complete a linespec keyword ("thread") or - # another option name when expecting an option - # argument. - test_gdb_complete_none "b $what thr" - test_gdb_complete_none "b $what -fun" + # These tests don't make sense with "-qualified" after + # the location. + with_test_prefix "complete after $prefix$what" { + # Don't complete a linespec keyword ("thread") or + # another option name when expecting an option + # argument. + test_gdb_complete_none "b $prefix$what thr" + test_gdb_complete_none "b $prefix$what -fun" + } } }