From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ckDVGt0C+WgZFwMAWB0awg (envelope-from ) for ; Wed, 22 Oct 2025 12:14:21 -0400 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=EhUYqlRf; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5CBC11E04C; Wed, 22 Oct 2025 12:14:21 -0400 (EDT) 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 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 A16D11E04C for ; Wed, 22 Oct 2025 12:14:20 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 31EFF3858413 for ; Wed, 22 Oct 2025 16:14:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31EFF3858413 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=EhUYqlRf Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 251343858406 for ; Wed, 22 Oct 2025 16:13:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 251343858406 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 251343858406 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761149604; cv=none; b=hcLiGsLnN9OTOe3o/5OAScMV6GtL9yXh/88nqwLWhWc4ShtawToUeDCtzCTuoCgXyc4LNgWls0Pw+xtmMicl9Cw8bklA8QW1lwirtUNK8fGq1ENkA8T7Sj0PWKyVdl1aeiI/4pc0e43zHSKSlKmFp+4uTrVqglTHJHqIuwfBJhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761149604; c=relaxed/simple; bh=SH3fn4PjjerUuR0B9w60a9H3CkP9l1ElzkQyGJcXCt4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=bM4WKKjTAtAWpiqoT65F/IVqoSUwYQI6ZqVzyBOe2TvKTeA0z9tcrDI712ToSBe011e6ZxzUPnz+jm//4stMKmm1yTkCKH3x5bub9/xBijwzS4tGDSDFoFY2SLjnvmoAC09ZibTiVNsK/z8+EBAFfhtV2r00ug4X0SgelGu6q44= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 251343858406 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761149603; 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: in-reply-to:in-reply-to:references:references; bh=HOGZW0kPPvpxiftfRAo8EMLXczDfj8RlZJmq1cHxNlU=; b=EhUYqlRfsaFm1QmKcNFgqCkhpEZJzYRXc4xJAcmStYhXgyb/r1yR/9K7NpJ+wl4H9c/iqX 2pAOFj7uXnmLsaqGg+ZhxujvhPBhB1qQYBMDqZ2BEH9SghTXhb8bf2pbqu2YKDAcKrM1OD w8p88ItvMPiOaDqJM9Y0WdLVaUurJcA= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-462-Mbs2KWO5ON-bztYl8HNrRA-1; Wed, 22 Oct 2025 12:13:22 -0400 X-MC-Unique: Mbs2KWO5ON-bztYl8HNrRA-1 X-Mimecast-MFC-AGG-ID: Mbs2KWO5ON-bztYl8HNrRA_1761149601 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-471148ad64aso29626645e9.2 for ; Wed, 22 Oct 2025 09:13:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761149601; x=1761754401; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HOGZW0kPPvpxiftfRAo8EMLXczDfj8RlZJmq1cHxNlU=; b=qwUulEO73JiACHtYVPtj2R6r+r3vwI+nQGdPEUfwVRiOd2vMHI+462/sdlvH5o03bA 0VCu+F+10MLbXCQ6SKU8VAjH5eXfVv9nM1QDqHQd3cTuRaZtiBhnp6i7oPKaT8j8i/HU pKpjYxRHnN49EP13AMf60RpcLsEfEHb7PKOADeh6JxI2YLt52EHEJXLOEf0Q+IOrkGZB sa8fSZBEPKotinHYy6emqc35G3RNbldubaM1nusNucVPm8PIUCouqqrWC+AVdxpDDQd+ MEUk1E+F4pGBLTtfVtwsZ+oPMSonPhBFklgLi7GDpZcJ+ePm3rnHmTiac19GQ6aEI+Ju 5MLw== X-Gm-Message-State: AOJu0Ywe5Exxa9DHpsa+pBd0RsX3P7jT9bzJIn/RTW7/sSzQM+mBoV/2 Ge/eQGjzZNcuiNKqfnhUJdKXt8pjpQdEZZsGZad6CmTHBdWvJqOyz45pf9azHAV92A0QJKo8Ezx Fyi8w0uTe+A5EXOKLsu58eQksaVfQJdefKBWyXG8trqgmH5Sechl2iA58/Ag0VoBzkumkn+Y= X-Gm-Gg: ASbGncvUf9iZyLPtG3kFkf9rYqsL0/25gFcUXMW7hDFZ94ysP9IYC0ooGsvbLrRQkLC vEZCxl8VSmrTAXthbfynnCbaK6/OA+rUuXA+vQXoZ9zBMMAMyZ+JF6rNx1KGJQeeGlUgL4pHm2N oX3oXtKyfr/qF8i5iiKGHeVErubRHHylUPys73epZFQ5S09NED8l4TZE5bffJx4IEXdTLsifnuS B07s5sVH5D1VsYD3gYxgv2y5K76JCPr2SzLZobD9nqU5dut1yg2lmoSASkGvU6XXkPVaeO9NDS/ OXxmNp/QNK959uixY4N3D9jK/rJGBAHGYGfZSNuGCBQz2aNNMHkPBwZvLV4Mq6rNg62+Xg== X-Received: by 2002:a05:600c:3b22:b0:471:989:9d85 with SMTP id 5b1f17b1804b1-471179122eemr158448225e9.19.1761149600959; Wed, 22 Oct 2025 09:13:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHoIMJmEZSepWa83J4/5zqMveNpyAvuvMqDyP9l5RArOLmsCADSDmXT3YLF9m8Aoky92jDHpQ== X-Received: by 2002:a05:600c:3b22:b0:471:989:9d85 with SMTP id 5b1f17b1804b1-471179122eemr158447955e9.19.1761149600474; Wed, 22 Oct 2025 09:13:20 -0700 (PDT) Received: from localhost ([31.111.84.207]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-427f00b9f9dsm25886798f8f.39.2025.10.22.09.13.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Oct 2025 09:13:20 -0700 (PDT) From: Andrew Burgess To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCHv3] gdb: remove attempted type de-duplication when building gdb-index In-Reply-To: <87ldl3c4h4.fsf@redhat.com> References: <5fb2ed381ab0f96c5057f1644ca67dceebcdf3b7.1760638029.git.aburgess@redhat.com> <87cy6fkltn.fsf@tromey.com> <87ldl3c4h4.fsf@redhat.com> Date: Wed, 22 Oct 2025 17:13:19 +0100 Message-ID: <87ikg6die8.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: g_-zY600pzjvyyKEagyL8nDeGbDuIDN-1wwiPdeRgEg_1761149601 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Burgess writes: > Tom Tromey writes: > >>>>>>> "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. > > Thank you! That exactly explains what's going on. The test does > specifically put just the destructor into a separate .cc file, which > corresponds to the CU where we get the full type, with size. > >> >> 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? > > I don't know. I'll check, and if not open a new bug report, adding a > 'Bug:' tag to the commit message of this patch before pushing. > OK, related bugs: 1. https://sourceware.org/bugzilla/show_bug.cgi?id=29398 CU expansion is slow. 2. https://sourceware.org/bugzilla/show_bug.cgi?id=15035 Best match, excessive CU expansion. 3. https://sourceware.org/bugzilla/show_bug.cgi?id=25435 Completion is slow due to CU expansion in general. I propose to link to the second of these with a 'Bug:' tag in this commit, but I don't think opening another bug is necessary. Does that sound OK to you? Thanks, Andrew