From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ceIuC9CzAWuDrCgAWB0awg (envelope-from ) for ; Sat, 21 Nov 2026 10:08:00 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=P0A+2yiI; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2964D1E167; Sat, 21 Nov 2026 10:08:00 -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,FREEMAIL_FROM,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 686531E023 for ; Sat, 21 Nov 2026 10:07:59 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DB23162DAF7D for ; Sat, 21 Nov 2026 15:07:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB23162DAF7D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=P0A+2yiI Received: from m16.mail.126.com (m16.mail.126.com [117.135.210.6]) by sourceware.org (Postfix) with ESMTPS id 479BC4007E5D for ; Sat, 21 Nov 2026 15:07:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 479BC4007E5D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=126.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=126.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 479BC4007E5D Authentication-Results: sourceware.org; arc=none smtp.remote-ip=117.135.210.6 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795273654; cv=none; b=tHHSHCipFqNtJNvx3oD5gwGi5zVbuVDEb59RFJ37biz0vY3VaN6rV12Dh1FRjs57TJuoLDFNkmJ9EROpsEPnC5NLc6AZI+Cal/ShXLqrMDMRlmzg1BZIxdFuWnvBW7fUq9oiZwRrXnAmNEX2E7uF470vNJ1pvVBZx0YvfEixkr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795273654; c=relaxed/simple; bh=euWwD0aYrdSqcQovpjv/Ej+B5BxUwBS+3Om3VdEIcvM=; h=DKIM-Signature:From:To:Subject:MIME-Version:Message-Id:Date; b=x5XGuIxNi3LxPL3GLddYJcZDeZxarYiaRNPL1JYIOzrqWSLjXbfv3aEpeI9HF9BEXJcOT9IfMVg/QKGJaT6QSFRJEieKQu08tovQDVDclk5AlxjSMkAxtXdx/5PnP53RC8UzGJCPNceHEWephVQI+2rtXTkiLOLT0i6NlvNbQgk= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=P0A+2yiI DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 479BC4007E5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:To:Subject:Content-Type:MIME-Version: Message-Id:Date; bh=EdFvYEXahGCjT525Sti1q2jmgvHv4pCkj0UbYVDyn3Y=; b=P0A+2yiIoa5cfl+ngGFanp9zCFAqSbVKOmH5DnuAUSsanX7JI+ZAL/ol+FJ1Gc a/udh1jFyMK9F3quDHn+jxx/TksPb4JHXDpeakGSRdPlS0qJz06E4sTAMQSjOrjX DrhRUBv7PrMDGPqRsuLtS8MLqjlABNvL0KuaA1MBaZKfY= From: Sendao Yan To: gdb-patches@sourceware.org Cc: tom@tromey.com, aburgess@redhat.com, keiths@redhat.com, simark@simark.ca, yansendao@126.com Subject: Re: [PATCH v2] [gdb/symtab] Add canonical-name aliases for C++ template static members In-Reply-To: <20261121145930.1048662-1-yansendao@126.com> References: <20261121145930.1048662-1-yansendao@126.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-CM-TRANSID: PikvCgD3H_qYswFr80xyDw--.27081S2 Message-Id: <6B01B399.0DFCF8.05874@m16.mail.126.com> X-Coremail-Antispam: 1Uf129KBjvJXoW7CFW3XF45Ww47uF4rAF48Crg_yoW5Jr1rpF ySg3Z8Grs7AFyfZr1Iya1xXry5Cw1fJF45AF4kJrWDA3s5Wa4xGF12grW5t3W7uw4Fg3yY qayYqryqkw4DtaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRRyx_UUUUU= Date: Sat, 21 Nov 2026 23:07:06 +0800 (CST) X-CM-SenderInfo: 51dq2vpqgd0qqrswhudrp/xtbBrBkuQGsBs5mwhQAA3u 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 Simon, Andrew, Tom, Keith, Sorry for the delayed reply -- v2 was sent before I saw Simon's message, and the cover text did not make it into the v2 email (git send-email sent the patch file as the body). Andrew asked why this cannot be fixed in the quick lookup path, and whether a fallback bakes in a known limitation. v2 answers that: the quick lookup path can be fixed, and v2 does fix it there. v1's symtab fallback was not needed. The root cause is that the cooked index only contained the DWARF spelling (S<1>::v), while the lookup uses the canonical spelling from the demangled linkage name (S<1l>::v). The lookup algorithm itself is fine; it misses because the index does not contain the spelling being looked up. v2 adds that spelling as a synthesized cooked-index entry, so there is no reliance on expanded symtabs and no known limitation to document. Simon: you are right that S<1> and S<1L> are different types, and that a plain alias would be wrong if both types exist. v2 only adds the alias for the DWARF spelling that lacks the integer suffix; I agree it needs to be disambiguated. Some options: 1. Only add the alias when no exact canonical entry for S<1L> exists in the index. A real S<1L> entry then always wins; the alias is only a fallback for compilers that omit the suffix. This is a small change, but not a general fuzzy match. 2. Reconstruct the type name from the DW_TAG_template_value_parameter DIEs using the parameter type's spelling, as you suggested. The existing dwarf2_compute_name path does something similar for functions, but it prints the value without the integer suffix; we would need to print it using the C++ type spelling (S<1L>) and use that name for the class type. 3. Implement fuzzy matching with ranking in the index lookup. I think (2) is the most robust. Before I rework the patch: would you prefer (2), or is a guarded (1) acceptable as a first step? I can test both with GCC- and clang-built binaries (including a program that instantiates both S<1> and S<1L>). For the other comments: - Tom: v2 no longer touches lookup_symbol_in_objfile; the symtab fallback is gone. - Andrew: `return -1` removed; no new NULL; `print s.v` is the actual regression test, and the alias lives in the cooked index, so it does not depend on symtab expansion. - Keith: the canonical spelling comes from the demangled linkage name; GCC's DW_AT_name omits the integer suffix. Thanks, Sendao