From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2QhRFGkmp2mNwRIAWB0awg (envelope-from ) for ; Tue, 03 Mar 2026 13:20:25 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=K/3etNI2; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4D0331E0DD; Tue, 03 Mar 2026 13:20:25 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 86BA71E089 for ; Tue, 03 Mar 2026 13:20:24 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id EFCE14BA2E3D for ; Tue, 3 Mar 2026 18:20:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EFCE14BA2E3D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=K/3etNI2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 2F0DE4BA2E09 for ; Tue, 3 Mar 2026 18:19:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F0DE4BA2E09 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2F0DE4BA2E09 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772561997; cv=none; b=oFTDnJP3MFlKJcq3wfks3zHyrilJceK58dWeSpZ14fGzF/rokgFllckdxoBSnG2VZU1W0lk+Ng8nKhx5tsQtvJTZseQ/gi+RssEZpR9SldTXfBmJZ2z4YgexSM4P3IKaDABPRUomrD3lyTHGTCysYFSr40JrBPTHpezPeKKLq98= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772561997; c=relaxed/simple; bh=AvH4x2/niK4r/9Y8an4G0LIlerhz3/C/ZGBseugu9R0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=ap33Cm/hZyDQorgTsWdycoznQm6VUjSGby9j4ynS1SsLplbezViVLa2OS6mbyPNU2FGf22P5iSnYbMGjTK/X8yi2UfDnR6PhIKXiuWsqg2o2cBt2xsNuJqYeWnCpy+OZUzJ4i3tfhq2pljoGnuuKzA1RWpppVXw3xCyR9lkd/s8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F0DE4BA2E09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772561996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KNtYpZqNorE278fm1iqRfzUw0YFUB2vQxh2Sg9LdE4o=; b=K/3etNI282I8MfKPK7LaiFTBKCVPg0gx//IPM7Trx/MDHYHdfcDtQi7BCA7sR9Lxecjold peTXjFpd6WTqaOksmA3kuYiWKmUyw6zSA9vp7oLnUo86oADbb1E7WMEaqL7GfGjIrzeBgv SGeseqUCb2k92Dbyr7DXa13BDZE+sJw= Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-159-yrxu7RfWOguwGUQf28xSMg-1; Tue, 03 Mar 2026 13:19:55 -0500 X-MC-Unique: yrxu7RfWOguwGUQf28xSMg-1 X-Mimecast-MFC-AGG-ID: yrxu7RfWOguwGUQf28xSMg_1772561995 Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-8274bb61b6dso2100709b3a.0 for ; Tue, 03 Mar 2026 10:19:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772561994; x=1773166794; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KNtYpZqNorE278fm1iqRfzUw0YFUB2vQxh2Sg9LdE4o=; b=o9Y1EirQYMuBXOStKg9RFsLmNIQKZ4u+LakpUx10AkxOJVoz7GQuWWNsf8iGaQaHmT qUiwR+uOL/HjglIHX6yP8PBOECV2WkcMhPKidHtCBrhWkLWeliMvjoDrlGHKKt7xJ5+9 075+I2oppyKANkVxStcesfhmO19nitbCrRJfqw2Gk6cmrwo+rSx8RDrRKTrG/qC0O7I7 wocZZ6jGupRLZ1JWBa8w0aITIstc72F42DdXdnw8Zokdb+ntgtJ1xnjhsAZNfjxUQBKA pYBQXG9/OX5YDBhlAOBz8uVQ9wOAPOXqgbfGPN/ZNDiMVJXP8ExLvH8PinVUKw2Q9F2U pwKg== X-Forwarded-Encrypted: i=1; AJvYcCWs8UtHaL6TuuxhECZNKl3UbgOtv7pDTuJWWNj6NhrVQeY0uPqVZtqhm16aCX3W4hH3z9GWcVpX5kKLZg==@sourceware.org X-Gm-Message-State: AOJu0Yzsg+SLveN1t3wJQRwVkeVGMnPzRPv3v3IVluVPWXDeKFrn6eOr nHLzOvPL6zdP4fxXlPuDsSvVHBgMsXZTQ9nXOJ7CenRMg5nSQTpFzVwriwMAqhRBz+ImaPhSdAd E7cP+/xd0NJz3pju0Wp+V0aF6WICVBGnpi4AFjTmSTtgKZUV9wipetvxz1BTt1PFI++zBwEaycg == X-Gm-Gg: ATEYQzx1SNhqT/rkau1O/Lo63ULewKKZkavYZCz/W+REJtOlcrFhYt7R879jKNA17oZ 83fHWEea33hblGVX+OZMbfWwd/ko99CzwQhcVX2b4aM6BX/ytNb/FYa0H6k0ih525vXrYN4DPTF usnexDb2hmu8BZzYl52WYB7iJ00HrYkA97P7RZ2L+8V1Cco2uhZ3RRigINe6+Ld8wGsyMjOHWgO EtMabmBlFAXjC8/3H8pPh1AOw3UM35e4pCM+PKJ8H9ElD1bnhAY1rErD2YP9jcdFqAQaGqmC9OY 6fkyRSCi+eRFswCksR8OWEri2rjwsqQ9bCknYsEIG+S/VKofBYuHNdZKZlzbSKLsaINV2QShf1d Jtc+jav+Zc8ba3y4cR8CnFMIoAExZ X-Received: by 2002:a05:6a00:1742:b0:81e:8e66:38d7 with SMTP id d2e1a72fcca58-8274d94e6afmr17748620b3a.17.1772561994015; Tue, 03 Mar 2026 10:19:54 -0800 (PST) X-Received: by 2002:a05:6a00:1742:b0:81e:8e66:38d7 with SMTP id d2e1a72fcca58-8274d94e6afmr17748596b3a.17.1772561993436; Tue, 03 Mar 2026 10:19:53 -0800 (PST) Received: from [150.1.200.157] ([172.56.105.212]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8273a05cbe6sm16815882b3a.59.2026.03.03.10.19.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Mar 2026 10:19:52 -0800 (PST) Message-ID: <44171ae9-cd60-4c6d-950d-30276cd489eb@redhat.com> Date: Tue, 3 Mar 2026 10:19:51 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] gdb/symtab.c Fix completion of template class members To: Daniel Knezevic , "gdb-patches@sourceware.org" Cc: Tom Tromey , Pedro Alves , Simon Marchi References: <20260303103633.256157-1-daniel.knezevic@htecgroup.com> From: Keith Seitz In-Reply-To: <20260303103633.256157-1-daniel.knezevic@htecgroup.com> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: D3fUmpb7ODN7a6kiCtsdWoZqeoV63eQcFGOkHNLVtkM_1772561995 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Hi, On 3/3/26 2:36 AM, Daniel Knezevic wrote: > This is v3 of: > https://inbox.sourceware.org/gdb-patches/20251113095559.404539-1-daniel.knezevic@htecgroup.com/raw > > Do not break the symbol if it contains '<' or '>' characters. > > This patch fixes formatting of the code and adds more tests for testing > completion of nested template classes. Thank you for the quick update. I just have a few trivial nits. There is no need to submit a v4 solely for these. > diff --git a/gdb/testsuite/gdb.cp/cpcompletion.cc b/gdb/testsuite/gdb.cp/cpcompletion.cc > index b85f168928c..defbd75ad34 100644 > --- a/gdb/testsuite/gdb.cp/cpcompletion.cc > +++ b/gdb/testsuite/gdb.cp/cpcompletion.cc > @@ -74,6 +74,28 @@ struct baz > S s; > }; > > +/* The Outer class is used to test completion of nested template classes*/ Please end the comment with a period and two spaces. [That follows our coding style guidelines.] > +template > +struct Outer > +{ > + T value; > + > + template > + struct Inner > + { > + U inner_value; > + T outer_ref; > + }; > + > + Inner get_int_inner () const > + {> + Inner i; > + i.inner_value = 0; > + i.outer_ref = value; > + return i; > + } > +}; > + > int main () > { > baz obj (2.3, 0.1); > @@ -84,5 +106,9 @@ int main () > Foo foo1; > foo1.set_foo (42); // Set breakpoint here. > a.get(); // Prevent compiler from throwing 'a' away. > + Outer outer; > + outer.value = 4.2; > + auto inner = outer.get_int_inner(); Need a space between function/method name and parentheses. > + Outer::Inner long_inner; > return 0; > } > diff --git a/gdb/testsuite/gdb.cp/cpcompletion.exp b/gdb/testsuite/gdb.cp/cpcompletion.exp > index 1fb9a6bf01d..9ae17026f7d 100644 > --- a/gdb/testsuite/gdb.cp/cpcompletion.exp > +++ b/gdb/testsuite/gdb.cp/cpcompletion.exp > @@ -137,3 +137,39 @@ with_test_prefix "expression with namespace" { > } > > test_gdb_complete_unique "break baz(int" "break baz(int, double)" > + > +# Test completion with a template class. > +test_gdb_complete_unique "p baz::" "p baz::baz(int, double)" > + > +# Test completion of nested template classes > +with_test_prefix "nested template classes" { > + # Unlike in linespecs, tab- and complete-command completion work a > + # bit differently when completing around the scope operator. The > + # matches in the tab-completion case only show the part of the > + # symbol after the scope, since ':' is a word break character. > + > + set tab_completion_list { > + "Inner" > + "Inner" > + "get_int_inner() const" > + } > + test_gdb_complete_tab_multiple "ptype Outer:" ":" $tab_completion_list > + test_gdb_complete_tab_multiple "ptype Outer::" "" $tab_completion_list > + > + # OTOH, the complete command must show the whole command, with > + # qualified symbol displayed as entered by the user. > + set cmd_completion_list { > + "Outer::Inner" > + "Outer::Inner" > + "Outer::get_int_inner() const" > + } > + test_gdb_complete_cmd_multiple "ptype " "Outer:" $cmd_completion_list > + test_gdb_complete_cmd_multiple "ptype " "Outer::" $cmd_completion_list > + test_gdb_complete_cmd_multiple "ptype " "Outer::Inn" { > + "Outer::Inner" > + "Outer::Inner" > + } > + > + # Add a disambiguating character and we get a unique completion. > + test_gdb_complete_unique "ptype Outer::g" "ptype Outer::get_int_inner() const" This last line looks a bit long. Suggest adding '\' between the two arguments, moving the second argument to the next line. > +} Otherwise, this LGTM. Reviewed-By: Keith Seitz Thank you! Keith