From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uYFdCZkp7mqB+ikAWB0awg (envelope-from ) for ; Fri, 06 Nov 2026 14:25:13 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=selector1 header.b=FenAzijA; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 194AE378002; Fri, 06 Nov 2026 14:25:13 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.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 autolearn=unavailable autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 2618A1E043 for ; Fri, 06 Nov 2026 14:25:12 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 117854BA2E2E for ; Fri, 6 Nov 2026 19:25:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 117854BA2E2E Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=selector1 header.b=FenAzijA Received: from YT3PR01CU008.outbound.protection.outlook.com (mail-canadacentralazlp170100000.outbound.protection.outlook.com [IPv6:2a01:111:f403:c103::]) by sourceware.org (Postfix) with ESMTPS id 072444BA5433 for ; Fri, 6 Nov 2026 19:24:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 072444BA5433 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 072444BA5433 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c103:: ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1793993076; cv=pass; b=lY20DpNBOkeN49cp+q+Lzxqmvaz9YeNf/7GIMiGmL0zeIeco8gZIFPMc/gGsltu01FtAlNh2zffV1434Id5TfJTdNkCPMp8XVroibJ2aGVgwnvG4SMcMvBiWnbpJfWOCEXsmK2VttPmDC7A2pL5MCPiiFTnGxgDG1y/wTWQ24aQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1793993076; c=relaxed/simple; bh=im/h2cKxJflpvoQE3FMHGEZvkrAWVPafLG4R2QA0qdw=; h=DKIM-Signature:Message-ID:Date:Subject:To:From:MIME-Version; b=RMtscyFO6ZEOZCf4F6mKnW1nRFPTj4ryrbUggZ46t4GllQ2+qwmt3LYFGLXiKWzUfO2C9pccugHP0qgO+lDDuVzrb/NT8BIURDhqikQY2v8Yn3yBZp9N/TC9c+qwB7oKRXKXT90Wy+lCj0H9R4jnWBiMEZR16/Ta37XW8I/QC+I= ARC-Authentication-Results: i=2; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=selector1 header.b=FenAzijA DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 072444BA5433 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=E2bHxQXAwqPlaIFyNbPSxyh5AK+9xcQ9iWlLOt9gWGAn1j/32ZmVr/me2HMfOR8tvtLCBUc/WSScR77Dan2s53cU7c3ynLE9aqzXbJID3Id88x3IFEehnsPyqje2xUuTQSfH1vEoyM1FT+qdcII79Ybo9CNtT1MK9mlLg9zcjxv0eNFNhdx4Il3u9ZxRyVgqS3C9R7GWAAMqSmg7p5geAIkc07Pr940nGh5Jqihrx4AiguIW2Pf7aeKc+tU0zw+jsA8Tu3rfUiKO7ScNQTUhSJN4FUGIOJwARs8Vrp8pklvps6H+mimHOkM+j29GXZd67ObULtB1ZbpjH4du6pjxxA== 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=qCPCl5clH7+NE/urSnkyfkG35OkxBdu1JjzKW39Igyk=; b=wBCsSnvNNtRPqub4SdgbehONwvma8qcHca87BPhOg7xiGacNo63dHzZonYj2eIiK4hxAeNMV0QnS/xIixKnoa8NvXTfFRu3jgZ0KVHwClrBlx9IHixiQsyIzf8IBuBiJhUaD8b5WtozoaeXwbMsMv3etrlGcKD056Fq987usvIFXKJits+7EjsTWpZ7kjXKCWMItm6Gq4JIEMc3Mx9cE+NaAtX2vbLv0uwqDSPbDqMaw/w0dcoiHSuWTZ9Y/vbIXRsHMZ5u+BbGMJLVPMBSOnf96a0CXZENKSLIEfmi9NvMD1e7vjCPLKOE8OUyWAHUQz7RCSdB091iB1P7p/fd0sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=efficios.com; dmarc=pass action=none header.from=efficios.com; dkim=pass header.d=efficios.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qCPCl5clH7+NE/urSnkyfkG35OkxBdu1JjzKW39Igyk=; b=FenAzijAWAU5CWMda6SPZZ1L85kvBi/K0GYKONhtGsATVECoF15zgt6ahm/qXB8CS8wH/DqlJMiY/ElYQhgY8zNbTh1op8xWq+YyAhxADDquYNuVzUz5Loc1a1Y99awjS1QPM9wXrDEJUHzoxNQs4LaXbWAe1gXKL/A6/+FgMXtHefSfeQIgZ9+eks3BpXZauHzlpNJJgq7YXzRYyGDc1NBdRCleiGpLvIOUGcKJRvIB8bYHX3OWOzojXa3vt+xmrHOuWxzY5zDY8fx9TUvWORx4MvM7bp+rhlK/JbGClhcYonmzfk50vJ45WbSKXSeogNRh59fG2cpF4uwylyfUYA== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=efficios.com; Received: from YQ1PR01MB204627.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:105::14) by YQBPR0101MB5928.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:37::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.592.11; Fri, 6 Nov 2026 19:24:31 +0000 Received: from YQ1PR01MB204627.CANPRD01.PROD.OUTLOOK.COM ([fe80::5b0:de57:97f:7b80]) by YQ1PR01MB204627.CANPRD01.PROD.OUTLOOK.COM ([fe80::5b0:de57:97f:7b80%5]) with mapi id 15.21.0592.010; Fri, 6 Nov 2026 19:24:31 +0000 Message-ID: <391abdd3-8bba-4702-9a84-0c4086ea6b85@efficios.com> Date: Fri, 6 Nov 2026 14:24:29 -0500 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 06/13] gdb: check exact results in the canonicalize selftest To: Tom Tromey , Simon Marchi Cc: gdb-patches@sourceware.org References: <20261020162054.2140671-1-simon.marchi@efficios.com> <20261020162054.2140671-7-simon.marchi@efficios.com> <87wlrbyt86.fsf@tromey.com> <874iefyou5.fsf@tromey.com> <901d45a4-7942-4258-ae4a-9daa2b5e5a6e@simark.ca> <87qzhjx7uq.fsf@tromey.com> <87y0b7xfv0.fsf@tromey.com> Content-Language: fr From: Simon Marchi In-Reply-To: <87y0b7xfv0.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: YQZPR01CA0082.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:84::18) To YQ1PR01MB204627.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:105::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: YQ1PR01MB204627:EE_|YQBPR0101MB5928:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a5d9a4c-156b-4f82-12be-08df3c3b9503 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|23010399003|376014|1800799024|22082099003|18002099003|6133799003|10067099003|4143699003|5023799004|261102123227099003|261026140227099003|261026121527099003|261028144727099003|261022105027099003|261022113327099003|261021135927099003|261021121427099003|56012099006|261022075727099003; X-Microsoft-Antispam-Message-Info: alPg0oTPdQ74JVRySvveDAAuTa5ERofF+kUGENZ2QgHopDkFOh6ZL4GKC3I1rHTwuvEkpESne/2Hs0QhHkhnLcxQcy9wtz+uyqbGep68c3gaPd3MTRduaX7TPmem/4bHwY9gMv5mxyzBMum74sre8GfFgq08amNr9xGEYlo0QG2DwgwIrHuOwG6qk07Fa7MLYIzINo2w309U3VpROcy3EJSyDtWPfHjAjbL7/Y4gF6oJEUvm/4hT+lNkks05uuuxiv1Ghy2yUHBo98YQm/NKVTo/qfAd16elvaKmhQo9gWsoTJA0fC/a9Rm6VfHhbTgHwc1Z5kHUFi7uKaA+BQC0qVZyca5+gyJTUrz0Cb8m/i+nJ+HmKzKU97EpA+q5U6UdiIOgSRfPr3WGPpC+kwbUWF2ZjfBtdQqRxi4R54W4TusEKoYyIW+vi+/scmow/9laMeJIpkg/2VJ/ATzz/3s1JQBQ7li1oUQmbVTGzRxfmKiTe83JplsfVf/z4+nHxh3IZapCHVbS/3Jsb/5MnFD8kAmARzLuVdi5Sk4zppHdP2IboUK8Ajm6ERfwYe5d+FjdXUImbnTBTUOm01KCOChJZqvqYxrRdmCnmobZxDhN8yglohc4yH7SBNCgScvyAHNIsCWBoXeytgH+dIYxTRZObsGm8OUjCGhUxERhFX0rjns= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YQ1PR01MB204627.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(366016)(23010399003)(376014)(1800799024)(22082099003)(18002099003)(6133799003)(10067099003)(4143699003)(5023799004)(261102123227099003)(261026140227099003)(261026121527099003)(261028144727099003)(261022105027099003)(261022113327099003)(261021135927099003)(261021121427099003)(56012099006)(261022075727099003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?T1FOeDdDVGdoQzFUbmV6MG1KempUMlBFQkwvdEV0WnhHOUdrLzN4U1RGU0s2?= =?utf-8?B?a2VBU3hkbGtSQzN4bWYwTzF3cHdLTWZkZGFNMUtBblpMeUY0Y3Vsd0tpSnRr?= =?utf-8?B?YmN5KzBPTFZIVTNVSzY5WmdybUpGWnlDWEdFN1RDcG9zOUt4MGJsU3RxN3c1?= =?utf-8?B?RXNneUZndzFmbHpFV0luSDZ2RENnTWdoVUVZTy9rb292MDZJb0kyL3B2RlNh?= =?utf-8?B?dzBtVU5vRzErUnRpdmFvckVXV0puTkVWMEtGL2JzN0tpWkFPQ3dUNVZsbkpw?= =?utf-8?B?S3dQUkhOSDFUb0RQU0wvbVFJQ28yWWN4UnZUdkhCd2NrTlZnUlFyaXcwS2xK?= =?utf-8?B?L1dNTEdCTVZoVTlyM010aVlNSml4N0Z2dGhxODFobURKbGZUOE1rbU0vbGZC?= =?utf-8?B?U040OC9ZUkhXaGRjYzdGKzBVaFRtN3JuU2hueVF1aXRkazB5UkUrSjhXbUt6?= =?utf-8?B?TWJNSTlvTkhMMEV6NFoybXphMXVRZzV2dEt1MW9RbEF0a1NxY2hIeE9rWUlZ?= =?utf-8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N1WVpsVTBsQWtFeEZVVzQzK2FGSTE4Zz09?= X-OriginatorOrg: efficios.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a5d9a4c-156b-4f82-12be-08df3c3b9503 X-MS-Exchange-CrossTenant-AuthSource: YQ1PR01MB204627.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2026 19:24:31.2050 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4f278736-4ab6-415c-957e-1f55336bd31e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bfsyt33VjA77CIlTlu7nwgdFh6BGJ8d2MR2969cyZZ0itbMNaZ+EIDc8VAC5pvOJkXtgauOzs/R8KmwPhVpplg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQBPR0101MB5928 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 On 11/5/26 2:01 PM, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > >>> What I mean is that my wish is that gdb internals shouldn't care about >>> the precise spelling that the canonicalizer spits out. > > Simon> template > Simon> struct C {}; > Simon> C<0> c; > ... > Simon> C<(unsigned char)'\x00'> > ... > Simon> C<(unsigned char)0> > > Simon> If the user does: > Simon> (gdb) ptype C<0> > Simon> GDB does does not find the type. They would have to do: > > Simon> To implement this, strncmp_iw_with_mode will need to have some form of > Simon> integer literal parsing, but it will be limited to just what can > Simon> possibly be found in a canonical name. > > Ok, thanks for the explanation. > > Let me start by saying I kind of hate making the strcmp*iw* functions > more intelligent. I'd rather they not exist at all, though TBH I don't > know how achievable that is. I guess my main reason is that they seem > fairly hairy and fragile for a task that seems like it could be done > more straightforwardly (and maybe, to some degree, this is shown to be > true in the cooked indexer). I agree that the strcmp*iw* functions are not fun to work with, but I don't see any way out of this since the index keys are just plain strings. > So I'm not exactly neutral. That said, in this particular case it seems > to me that the underlying problem is something that can be solved > directly in the name canonicalizer. > > That is, if we want C<(unsigned char) 0> to be equivalent to various > other spellings, including C<0>, then a good solution is to use C<0> as > the canonical form. > > This is pretty much the reason canonicalization is done at all: to iron > over the differences between the various possible spellings. This makes > gdb indifferent to the spelling, but more importantly means that the > user doesn't need to know exactly what the compiler decided to emit in > the debuginfo. > > Did you consider this approach and reject it for some reason? I don't recall trying this, no. Perhaps this would help fix the most obvious cases of GDB not finding what the user wants, but I don't know if it would introduce any ambiguities or false positive matches. > I guess a counter to this would be if there is a case where it's > important to distinguish C<0> from C<(unsigned char) 0>. But if there > is, then maybe the proposed strcmp*iw* patch would be a problem here too? I think there is a case for distinguishing them, but I don't know if it's the index's job to do that. The program could legitimately have C<0> (where the parameter is an int) and C<(unsigned char) 0> (where the parameter is an unsigned char). If the user asks for: (gdb) ptype C<(unsigned char) 0> versus (gdb) ptype C<(int) 0> then it would be better to find the more specific match. But maybe the index's job is to return all potential matches, and it is the caller's job to do some more thorough checks, filtering and sorting, once the CU is expanded. > FWIW I also have a dream of making the canonicalizer less intelligent as > well. Like I wonder if the parser can be replaced with something closer > to a tokenizer. The reason to do this is that C++ keeps growing and the > canonicalizer isn't really keeping up. I don't really understand the difference between the two. That being said: - Even if the exact canonical form is not necessarily important and could change over time, I am still of the opinion that it helps to see what it currently is in the tests, which is why I prefer if the tests check for the exact result of the canonicalizer. There is nothing preventing us updating these tests should the canonical form change. - Some patches if this series are still probably relevant in any, for instance to teach cp-name-parser about some integer forms (e.g. hex escapes), so that cp-name-parser is able to ingest what clang produces. Simon