From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0WJdKdi5pmkKNBIAWB0awg (envelope-from ) for ; Tue, 03 Mar 2026 05:37:12 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=htecgroup.com header.i=@htecgroup.com header.a=rsa-sha256 header.s=selector1 header.b=l5O07rce; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A3F931E0DD; Tue, 03 Mar 2026 05:37:12 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 E56121E08D for ; Tue, 03 Mar 2026 05:37:11 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 1C5F14B9DB7F for ; Tue, 3 Mar 2026 10:37:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C5F14B9DB7F Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=htecgroup.com header.i=@htecgroup.com header.a=rsa-sha256 header.s=selector1 header.b=l5O07rce Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazlp170120005.outbound.protection.outlook.com [IPv6:2a01:111:f403:c200::5]) by sourceware.org (Postfix) with ESMTPS id B82B84B9DB6D for ; Tue, 3 Mar 2026 10:36:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B82B84B9DB6D Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=htecgroup.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=htecgroup.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B82B84B9DB6D Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c200::5 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1772534202; cv=pass; b=XH9TGB1vZhxk1QFttw9hJY/N4rDz5FaPtbgdL4I9AP8opdFwBIUKX2ESXysbMFMyoMUiOiUIhZXzD6Mv7Y/9o9R3DRoSIgF2mNeZY4KPrYPipkX1YdtW+Ehf1AZKPtr/HJ5gdwrqXGDE9CGp5OtayjcZRMF7T8gNjnblrK7O0wo= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1772534202; c=relaxed/simple; bh=ouYzPjQop2jQiqO6mzpmJG3Zv4ygECh/QjxUW/Jl6V0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=E/bwC1z/YQ4WdhFoAzKnEeaGD9eVt2RnyDzLuBUPw/Cvyp13bQtkSgCHoiSO52QefHbVrrLqH7o7MYxj1ebXQUOmoW3u6O8HqyMX+g8gUmQzh2d6vZM/BJF48EgTPP407sSBgPTmE7LLJVey9Npb/ipk2+g0kK8Omv2zDpmSS9Y= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B82B84B9DB6D ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=arTm45knoDyWKxb14KLAnZRjn4kBJdlEwitod11pWsIZBxJsRWX/jMk7orhgYqICHaJjVqEQE3YzO/o7GbQs0BQ8pxmvCVvisKnWu7m/6lP1LGjgo8a8Q5R19CAFA83PVThmd4shrfHrHzMtP6Tia7TGKAQQAjGxGdzdt7bbEPjFSRIcc7g9vPAWcWHrESVL1wx2ShheYNI06PX8OxG0DKxljVSojRt4PQEbF6UwhXBG1w4pCNyIt+pLlRrJcmvH3XNM7YAMRv0U00FWumbFIbkRkKrEX4IvuMeuHobQyVm+NClOGMQ36zaLiGc8/Cqp4OAgGgcktpHHu3ZYIRQS5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=C3MUDe2RjSsJ8nZGxm/j9Y43hxp0it2IHF86fvmx+js=; b=Wik1iJyufHiPgiCSuL2GZMNWM58YEgDKkJhGgVPF0ImRci2olRIKxlBtFWO1VCyhnGIjJ1PswtPkEs65Xu4VtHPu1MvCOrNq/7lEX6YCLxDIA4NoXxgNk7fOb0g9xtLDlya7kZtr61p0YesCHCn/LFuSLTN6mlw75SoPmEUi4bT/JSHIO7nA6MPl7faP73FOKWnUiu70n2FbeCzeYXbRa97HsaM20srP7BfDoENT0pY/Cvj/C0qVmtuYLfcmfAFnlbmlfH2ewmyHqYu+Q1HpEvIMci7phlZzOY38wq8pwQCh9PB15mF3rPo5TkEwFI44XpWLUmJ4cqBDFVdPvriDyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=htecgroup.com; dmarc=pass action=none header.from=htecgroup.com; dkim=pass header.d=htecgroup.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=htecgroup.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C3MUDe2RjSsJ8nZGxm/j9Y43hxp0it2IHF86fvmx+js=; b=l5O07rcedyt5qPDMF1LSseYDAm39x5Se0y+NllYl6vEqHJuHq5u+IohZMss5J8XPgiq4V0/wXmmT5kmfA8C5tgGZBpMuEuLacVRz9CI7BxIzxnIXKg58Z7nEecjrAp6xh39mwlTe8jH7cJg3RK5olg3ViN84IXXFVTbL0F/OTCfMh1azLJdxQbOhuNKq/VfTDU9hLQ3Oqb0tj9laEdiGX3/IsuB9eCeYWBx2TA2dJ7VgOUOnTGq4vVNcosZP5rrq9K6i9kmWlLt7pIlNzxMrS8j5RVbMpr38BzcopYo9EJrC4UaMsFf6Ks5cPa6I01rPxrLUcLpHCVmPB7zBUtGI/A== Received: from DBBPR09MB3477.eurprd09.prod.outlook.com (2603:10a6:10:d7::21) by AS5PR09MB8577.eurprd09.prod.outlook.com (2603:10a6:20b:753::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9678.16; Tue, 3 Mar 2026 10:36:38 +0000 Received: from DBBPR09MB3477.eurprd09.prod.outlook.com ([fe80::a339:e3f8:fe9b:112e]) by DBBPR09MB3477.eurprd09.prod.outlook.com ([fe80::a339:e3f8:fe9b:112e%3]) with mapi id 15.20.9654.007; Tue, 3 Mar 2026 10:36:37 +0000 From: Daniel Knezevic To: "gdb-patches@sourceware.org" CC: Tom Tromey , Pedro Alves , Simon Marchi , Keith Seitz Subject: [PATCH v3] gdb/symtab.c Fix completion of template class members Thread-Topic: [PATCH v3] gdb/symtab.c Fix completion of template class members Thread-Index: AQHcqvmdeGGeqSLC6kirSS6cvWj1YA== Date: Tue, 3 Mar 2026 10:36:37 +0000 Message-ID: <20260303103633.256157-1-daniel.knezevic@htecgroup.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=htecgroup.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DBBPR09MB3477:EE_|AS5PR09MB8577:EE_ x-ms-office365-filtering-correlation-id: 44b8edbc-3741-44f2-2a2b-08de7910bfca x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|1800799024|366016|376014|16082099003|38070700021; x-microsoft-antispam-message-info: O70bB4hPGrHQdXw8EP65dsKj7qVlEwcFq6Z4UR9wdutU9cjmvNnazu3M2mJ4F+tPawK6apnDKqA42FP9n6IBqMCGDHlcy2qPNXtrp/58/tSGvV/mKRrFehlilsP8l5UivJM8XNzQwus7ZmsodmGeq6cKiTepCpgY/vEY1SgxmUz31e6gMK60aKQ1YLuwi92sF1KE0yI0LHqLMpiX5gbwG7iuCT/wcsCAjbaTJsFXKH1mAi7T5FhZ/gdzfmmPw2uAjBNGubX1aAbP5cgjQ/piDxPPJvPFjbHXy65TWbn5LG25uTVMcJ2t/rUg2tgzjUWqlZ1rnE8fahZgXVDnOC7mkBmrxjTE5OUH6TjDj0uu8gkiVgpQlZPxgjXQh7WLmEfwtqqQo4G08oQqillrXz0KZtqVBoktoJsFNaWGdSZxKdLCMdO7dQx2F4UQ4fzI9ssHwB+8d7RqHPjVEd4y7ymKT+Tt3Ky5uCoLcUENifEtyiEW3YnlRxiTDdVmORcJMyOSSqcFBmaZcmr/Kks85CzXpSfJvSuJDYWY+gZcyKXjcysH3j8aO77iDEu7Yf3N1FPxnWlvyrsVH5pJtm9yRoibiPIgQsmqZKKFElIRbTuGY4Xh0nkMPmFpShE1aqaHB0SI/9DAwvk3Tq7D/VIgfx4pnFnVkB6Qfa83pHiA/s4aPVHHaY/byqs6e2/RgWzfMV4x6GGAIc0WHaNDLNuW7pHgBXliEEHQaiYsksC8Cemip1+cj7AGX20Mm+u1oo6nre+t x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR09MB3477.eurprd09.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(16082099003)(38070700021); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-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j6biXUhuH0kH1Ds?= =?iso-8859-1?Q?zuXJqmLyNQGdl6RXiukOVOqJ2ExB5L7rwlZHN6/hfMhpFtXvzdY94E8Ijm?= =?iso-8859-1?Q?+/OmIlsjMSL8HbFup5BsvOV2GIcadSpMDlh82mi7MtHr3ZGJkFUm?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: htecgroup.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DBBPR09MB3477.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44b8edbc-3741-44f2-2a2b-08de7910bfca X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2026 10:36:37.6775 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9f85665b-7efd-4776-9dfe-b6bfda2565ee X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 9OSN9jBAO5bQJtEMAjlCtYM5LUjnNOoIuup5p4juzYKdCMwu+RzS0PLqPEeEivSXm3H0y0GUGOsivD7dH7TI8wK75KIq6wh2N3Xcvkaa6uY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR09MB8577 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 This is v3 of: https://inbox.sourceware.org/gdb-patches/20251113095559.404539-1-daniel.kne= zevic@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 = =20 completion of nested template classes. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30202 --- gdb/symtab.c | 3 ++- gdb/testsuite/gdb.cp/cpcompletion.cc | 26 +++++++++++++++++++ gdb/testsuite/gdb.cp/cpcompletion.exp | 36 +++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index a789b0f7593..5d5d1565a5d 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -5886,7 +5886,8 @@ default_collect_symbol_completion_matches_break_on while (p > text) { if (c_isalnum (p[-1]) || p[-1] =3D=3D '_' || p[-1] =3D=3D '\0' - || p[-1] =3D=3D ':' || strchr (break_on, p[-1]) !=3D NULL) + || p[-1] =3D=3D ':' || p[-1] =3D=3D '<' || p[-1] =3D=3D '>' + || strchr (break_on, p[-1]) !=3D NULL) --p; else break; diff --git a/gdb/testsuite/gdb.cp/cpcompletion.cc b/gdb/testsuite/gdb.cp/cp= completion.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; }; =20 +/* The Outer class is used to test completion of nested template classes*/ +template +struct Outer +{ + T value; + + template + struct Inner + { + U inner_value; + T outer_ref; + }; + + Inner get_int_inner () const + { + Inner i; + i.inner_value =3D 0; + i.outer_ref =3D 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 =3D 4.2; + auto inner =3D outer.get_int_inner(); + Outer::Inner long_inner; return 0; } diff --git a/gdb/testsuite/gdb.cp/cpcompletion.exp b/gdb/testsuite/gdb.cp/c= pcompletion.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" { } =20 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, doub= le)" + +# 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_complet= ion_list + test_gdb_complete_tab_multiple "ptype Outer::" "" $tab_complet= ion_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_completi= on_list + test_gdb_complete_cmd_multiple "ptype " "Outer::" $cmd_complet= ion_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" +} --=20 2.43.0