From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +WVGC/31+GhYCgMAWB0awg (envelope-from ) for ; Wed, 22 Oct 2025 11:19:25 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=eNV0uLB3; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 29C401E0BC; Wed, 22 Oct 2025 11:19:25 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,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 server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 5E8461E04C for ; Wed, 22 Oct 2025 11:19:24 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F01343858406 for ; Wed, 22 Oct 2025 15:19:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F01343858406 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=eNV0uLB3 Received: from omta040.useast.a.cloudfilter.net (omta040.useast.a.cloudfilter.net [44.202.169.39]) by sourceware.org (Postfix) with ESMTPS id BA693385841E for ; Wed, 22 Oct 2025 15:17:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA693385841E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BA693385841E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761146255; cv=none; b=WVAQmSp6Co5z4hdXZfyzj1aRWNd6ProR0TdsZnYy9+40i6jc4Wb4aHFaHUdQnCihIc+hpWzcO8BlgtbgtFUEdDw0YVNU+UQoJj/nTF4Y1rjUxTbVdOqY+NxsCTjWlRGuS/bPo42zqA7XnvmzF+vcEm1Nz24LDbmBgy4fhDQGJuI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761146255; c=relaxed/simple; bh=EvdKIMbfU2xDlRsOYwIdir/gUeW5XmWcQiIU4X3EZHw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Pu0hLaMgbHe4bMJb29JmA+QXP312fX6LiCCeKtJbqUY4P/M2FEFOuQMD+Kit3bT+94IIY7p1Jak6lHiAUFJv/G+c/8YAw2LKp5wOSYGnITq49wvC+8EtC8d3RQhMB40BykwPlxVtl03qPqOG5/JcWtuJYysn0SpzYzWTKWMz4CY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA693385841E Received: from eig-obgw-5007b.ext.cloudfilter.net ([10.0.29.167]) by cmsmtp with ESMTPS id Ba8ovncbWv724BaalvjlDv; Wed, 22 Oct 2025 15:17:35 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id BaacvioOSFPddBaacvWzBf; Wed, 22 Oct 2025 15:17:26 +0000 X-Authority-Analysis: v=2.4 cv=OphPyz/t c=1 sm=1 tr=0 ts=68f8f58f a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=x6icFKpwvdMA:10 a=ItBw4LHWJt0A:10 a=20KFwNOVAAAA:8 a=zstS-IiYAAAA:8 a=vKFM3m8HguFmGpymvy0A:9 a=4G6NA9xxw8l3yy4pmD5M:22 a=VS4QxaUSPT0UtbFnIvSC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=lDet0AaYFhZClCWNGaU/wvG5tWfqYZG2VLSru9VC7BM=; b=eNV0uLB3z0Igizd5Ki6B474cbJ DtH+vj9o/20Vs5IyJpX7hIVvmOnGLc1XUD8L6aSCcXLvWpN92UGjsT2O4C6sXN8jV8csIR5x+OfJv jV+b7zRUY2sj+FdCMDKVLdB6i; Received: from 97-122-110-68.hlrn.qwest.net ([97.122.110.68]:53594 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vBaac-00000002voG-0EkY; Wed, 22 Oct 2025 09:17:26 -0600 From: Tom Tromey To: Andrew Burgess Cc: gdb-patches@sourceware.org Subject: Re: [PATCHv3] gdb: remove attempted type de-duplication when building gdb-index In-Reply-To: (Andrew Burgess's message of "Tue, 21 Oct 2025 14:45:16 +0100") References: <5fb2ed381ab0f96c5057f1644ca67dceebcdf3b7.1760638029.git.aburgess@redhat.com> X-Attribution: Tom Date: Wed, 22 Oct 2025 09:17:24 -0600 Message-ID: <87cy6fkltn.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.110.68 X-Source-L: No X-Exim-ID: 1vBaac-00000002voG-0EkY X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-110-68.hlrn.qwest.net (bapiya) [97.122.110.68]:53594 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDdu///LK8xxVpdmt7Yelq5QinC+Im3u37GUlIHF3eAP43uXSdxf/D5nj/T2+UNEw1mQC+c0yk0E/5IeLl8piB6BUzgwPMeGexcCvmG/7SdYeCEcdFSi nIQCrH4nYevzl5CDgRO9WQ3atC46E2pcEFHM54tWXn5UqIxFKVFoOSYwkTYnaM2dVyQBnUsvkjpCduOlAzck+5c3HYhjrTHstpM= 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 >>>>> "Andrew" == Andrew Burgess writes: Andrew> In v3: Andrew> - Fixed test failure in gdb.cp/stub-array-size.exp when using Andrew> cc-with-gdb-index, using more recent versions of gcc. This did Andrew> require additional changes in dwarf2/read-gdb-index.c, and removal Andrew> of a test that is now out of date. The commit message has been Andrew> updated with a full description. Thanks. I think this is ok. See below for commentary but there's nothing you need to change. Approved-By: Tom Tromey Andrew> NOTE: Obviously a program doing this (defining a type differently in Andrew> different CUs) would need to be mindful of the One Definition Rule, Andrew> but so long as the type doesn't escape outside of a single CU then Andrew> reusing a type name isn't, as I understand it, wrong. And even if Andrew> it is, the fact that it compiles, and could be a source of bugs, Andrew> means (in my opinion) that GDB should handle this case to enable Andrew> debugging of it. Also ODR only applies to C++ and in C it's ok to have different definitions of an opaque type in different CUs. gdb itself used to use this technique. Andrew> This test has two CUs, and a type 'A'. The test description says: Andrew> Test size of arrays of stubbed types (structures where the full Andrew> definition is not immediately available). Andrew> Which I don't really understand given the test's source code. I think the relevant difference in the DWARF is: Andrew> <1><4a>: Abbrev Number: 8 (DW_TAG_structure_type) Andrew> <4b> DW_AT_name : A Andrew> <4d> DW_AT_declaration : 1 Andrew> <4d> DW_AT_sibling : <0x6d> Andrew> while in the second CU, the type looks like this: Andrew> <1><178>: Abbrev Number: 4 (DW_TAG_structure_type) Andrew> <179> DW_AT_name : A Andrew> <17b> DW_AT_byte_size : 8 ... that the second one has the size. Andrew> So, for reasons that I don't understand, the type, despite (as far as Andrew> I can see) having its full definition available, is recorded only as Andrew> declared in one CU. I think this is something the C++ compilers do, which is only emit the full definition when the "key method" (in this case the destructor) is also being emitted. I don't really recall the details. Basically it's a workaround / optimization to avoid exploding the debuginfo due to the separate compilation/header file model. Andrew> To be clear; the performance issue mentioned in PR gold/15646 is now Andrew> back again. But my claim is that gold was right all along to include Andrew> the duplicate index entries, and any performance hit we see as a Andrew> result, though unfortunate, is just a consequence of doing it right. Yes. To some extent I think this was a workaround for the broken C parser and best_symbol behavior. I.e., addressing a symptom of excessive CU expansion rather than the (admittedly much more difficult) cause. For the completion issue you pointed out: Andrew> The problem specifically called out in the bug report is that Andrew> namespaces can appear in multiple CUs, and that trying to complete Andrew> 'ns::misspelled' would expand every CU containing namespace 'ns' due Andrew> to the duplicate 'ns' type symbols. ... do we have a bug for this? This also seems like something that could be fixed. For instance completion could be done from the index as first pass. Tom