From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id hXaLGtg3EGmjiS4AWB0awg (envelope-from ) for ; Sun, 09 Nov 2025 01:42:32 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=JhR9PQl+; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=nDshghiF; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=JhR9PQl+; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=nDshghiF; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5B2DC1E0BC; Sun, 09 Nov 2025 01:42:32 -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 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 2E39A1E057 for ; Sun, 09 Nov 2025 01:42:31 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AAE923858C2A for ; Sun, 9 Nov 2025 06:42:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AAE923858C2A Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=JhR9PQl+; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=nDshghiF; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=JhR9PQl+; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=nDshghiF Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 34F443858D26 for ; Sun, 9 Nov 2025 06:41:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 34F443858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 34F443858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762670517; cv=none; b=vaGlCjCDvNpPd+Fp9nlXW4wURUVWitRxZeEmDvUxyqy6dB1QnR1+Fe0PVSECfGZe7SpxzK3wko5Gu5SeOpsRpc4rOEo3ks+7v5WbtqNeDnZ9NBEr3qWjxoE37kHT2XeS71BxwUFQDSGk1acBU2/jMyHydpj7/2pAczK/giMTW/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762670517; c=relaxed/simple; bh=Prw/37ivLa6qHdhIX3coaRc88cBuHJltRySk9OfkT8g=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=rEVIVqAtF69JgMFANKYVyvywxtmg/XjtOdBf/SUnZNBIoud7LGpv3A2w/c0TVbgki9Nj8zSqJmLcq21O5DnMFAkv617I7/LAtL6WMZ9v4l0FiQxQBeFuMgvsumfIxqHbDNTF6V4vxg/hx/tqseJx8uca1KFhNSbO9ciXqsjHSpE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34F443858D26 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 38C2D336CA; Sun, 9 Nov 2025 06:41:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1762670516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4TKPT7TkMg+5xsDbf9MgOK0IQgidnVaJt5uVvvoj5+g=; b=JhR9PQl+Jwc3AZJYOX6uS4jzw6TelmvtRmWp2RUFjlFv1XZ092GG3obkDZ1Z24qgz0esAk PRNkT/A7257UZlfZi01TPnbmsgfwxcNaP+RhqY8p6bCLLjaLW8JqIF2JaNN2UFOnpYYq9Q p3IMcqUcfJkHRPyuyHTXa3MgpzmIIWc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1762670516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4TKPT7TkMg+5xsDbf9MgOK0IQgidnVaJt5uVvvoj5+g=; b=nDshghiFIS+NiFg7MUw6GM1etCfoVOF74a4ZUrmEj81mlqK4qjd2rmf4tiiUouH2H1D3fy V9ucraczRPXqAeBw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1762670516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4TKPT7TkMg+5xsDbf9MgOK0IQgidnVaJt5uVvvoj5+g=; b=JhR9PQl+Jwc3AZJYOX6uS4jzw6TelmvtRmWp2RUFjlFv1XZ092GG3obkDZ1Z24qgz0esAk PRNkT/A7257UZlfZi01TPnbmsgfwxcNaP+RhqY8p6bCLLjaLW8JqIF2JaNN2UFOnpYYq9Q p3IMcqUcfJkHRPyuyHTXa3MgpzmIIWc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1762670516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4TKPT7TkMg+5xsDbf9MgOK0IQgidnVaJt5uVvvoj5+g=; b=nDshghiFIS+NiFg7MUw6GM1etCfoVOF74a4ZUrmEj81mlqK4qjd2rmf4tiiUouH2H1D3fy V9ucraczRPXqAeBw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1C0DF13DBB; Sun, 9 Nov 2025 06:41:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Sz0ABbQ3EGkBPAAAD6G6ig (envelope-from ); Sun, 09 Nov 2025 06:41:56 +0000 Message-ID: <8d94fb4e-f335-41de-9939-a8a487fe81bb@suse.de> Date: Sun, 9 Nov 2025 07:41:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] [gdb/symtab] Fix DW_TAG_member regression To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20250915153334.18723-1-tdevries@suse.de> <87ikhee4eh.fsf@tromey.com> Content-Language: en-US From: Tom de Vries In-Reply-To: <87ikhee4eh.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid] 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 9/19/25 7:30 PM, Tom Tromey wrote: > Tom> + else if (cur_abbrev->tag == DW_TAG_member && has_const_value > Tom> + && has_external) > > I'm a little surprised by this test. > > I guess I would assume we'd see this same problem for a static class > variable even if it doesn't have an initializer. For something like this: ... class A { static const int aaa; }; const int A::aaa = 11; ... we get instead: ... <2><28>: Abbrev Number: 3 (DW_TAG_member) <29> DW_AT_name : aaa <34> DW_AT_external : 1 <34> DW_AT_declaration : 1 <1><41>: Abbrev Number: 6 (DW_TAG_variable) <42> DW_AT_specification: <0x28> <48> DW_AT_linkage_name: _ZN1A3aaaE <4c> DW_AT_location : 9 byte block: DW_OP_addr: 0 ... I did add a variant in the dwarf assembly test-case using DW_AT_location instead of DW_AT_const_value, but that doesn't seem to be handled by the rest of gdb. > And I'm not sure > has_external is needed? > I did find an example of this triggering without external: ... <4><27bd192>: Abbrev Number: 279 (DW_TAG_member) <27bd194> DW_AT_name : __stored_locally <27bd19e> DW_AT_accessibility: 2 (protected) <27bd19f> DW_AT_declaration : 1 <27bd19f> DW_AT_const_value : 1 byte block: 1 ... for std::_Function_base::_Base_manager::__stored_locally: from the gdb binary. I also added a variant in the dwarf assembly test-case without DW_AT_external, but again that doesn't seem to be handled by the rest of gdb. > I would have expected something like "has const value or has a location" > instead. Could > > Tom> + { > Tom> + /* For Dwarf v4, GCC generates a DW_TAG_member for a static const > Tom> + member. */ > > ... but OTOH if this is the only case where DW_TAG_member is generated > then it seems fine. Though I still don't understand the "external" bit. > > So if this is correct could you add some explanation for it? > Done, in a v3 ( https://sourceware.org/pipermail/gdb-patches/2025-November/222477.html ). So, I think the current code is correct, in the sense that it fixes the entire regression. We could add support for the DW_AT_location case, but without evidence that a compiler generates this, I'm not sure that's worth it. We could also add support for the no DW_AT_external case, since there is such evidence. But I think that's better done in a separate patch, since it's not part of the regression and requires broader changes, > Tom> --- a/gdb/dwarf2/cooked-index-shard.c > Tom> +++ b/gdb/dwarf2/cooked-index-shard.c > Tom> @@ -65,6 +65,15 @@ cooked_index_shard::create (sect_offset die_offset, > Tom> else if (tag_is_type (tag)) > Tom> flags |= IS_STATIC; > > Tom> + if (tag == DW_TAG_member) > Tom> + { > Tom> + /* A cooked index entry generated for a DW_TAG_member should be treated > Tom> + the same as one generated for a DW_TAG_variable. Normalize to > Tom> + DW_TAG_variable, to simplify code dealing with cooked index > Tom> + entries. */ > Tom> + tag = DW_TAG_variable; > Tom> + } > > I think this should be in the scanner and not here. I've reverted back to handling DW_TAG_member, so this bit of code is gone. Thanks, - Tom