From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id dID4FJqW4mnjOSAAWB0awg (envelope-from ) for ; Fri, 17 Apr 2026 16:22:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1776457370; bh=ocM/nPbFfLyt8XzgXRJJWfgei9wus5BjBQS9cN+FJPQ=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=VoZEZRG79QgQ9T432iekCUIoRt9LdkDou7AnC+NAp9YxIe/Bjh9/uZomqA3GHpSCD Kg0wUcNDzDvVrq513MU+EkSNpi89EH82THypA0u9D9yUVQ9jGpzceYPxA34sZ9WdPT hLYO/L6M/JLT2G+4ziymk/3asBSX5OvbCJoJhzdM= Received: by simark.ca (Postfix, from userid 112) id 2971F1E0B1; Fri, 17 Apr 2026 16:22:50 -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.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 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=dB3niJ//; dkim-atps=neutral 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 5E13E1E04F for ; Fri, 17 Apr 2026 16:22:49 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 633764CCCA30 for ; Fri, 17 Apr 2026 20:22:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 633764CCCA30 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=dB3niJ// Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 5E9914BA2E21 for ; Fri, 17 Apr 2026 20:22:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E9914BA2E21 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5E9914BA2E21 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776457344; cv=none; b=LGYX+TC9Pg+x6Jiu0UlT/LGTKP1kIgZA69d1MtvALTOLvod4B1l+q1R1jVbdWMe/83xoePIP28Abreg3VCVZXJ2VXgcoLWn62DpkoYBhbeH9bmyreVBIHZKocycfFLnWnJJNPF+u65mS9wJzxjPApUQVGbrHY5LMlxPwvmkMsPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776457344; c=relaxed/simple; bh=ocM/nPbFfLyt8XzgXRJJWfgei9wus5BjBQS9cN+FJPQ=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=xreEI3TRBHH7CXps6d/YCKquuc8sVRa1T37Gbfpu8pk+wnYotOUCPeF2z3U3uVGpxJoKClgbUm4GblILu6KuxAYqYxznCGuj1QleMmreJKAHrmUdWT6/72vPW56wDa5HECLH2xref4doPNrKRVKLjDZ34S20WJ7koNLtePFHI88= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E9914BA2E21 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1776457343; bh=ocM/nPbFfLyt8XzgXRJJWfgei9wus5BjBQS9cN+FJPQ=; h=Date:Subject:To:References:From:In-Reply-To:From; b=dB3niJ//52+MYv40k/m3xx484OqpaGj7NlfbL2qLK8dHqPbxgVfwLz5l1kKfzlwgQ wZOojAuKlRWfCv4TCD6Ot4LMs4tTIQ7upH18hNFMlbCSNvVEjFP8L7iZthjok2Qptk D+mz6Jy1rHhrWv62j5NK6A8JtwClX1BMf/E3YwEM= Received: by simark.ca (Postfix) id A3F851E04F; Fri, 17 Apr 2026 16:22:23 -0400 (EDT) Message-ID: Date: Fri, 17 Apr 2026 16:22:22 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 5/6] Return void from buildsym_compunit::push_context To: Tom Tromey , gdb-patches@sourceware.org References: <20260417-list-in-scope-v1-0-0deb050fc03d@adacore.com> <20260417-list-in-scope-v1-5-0deb050fc03d@adacore.com> Content-Language: fr From: Simon Marchi In-Reply-To: <20260417-list-in-scope-v1-5-0deb050fc03d@adacore.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 4/17/26 2:24 PM, Tom Tromey wrote: > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c > index 4447923ae3e..2a330655c48 100644 > --- a/gdb/dwarf2/read.c > +++ b/gdb/dwarf2/read.c > @@ -7799,10 +7799,11 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) > } > } > > - gdb_assert (cu->get_builder () != nullptr); > - context_stack &ctx = cu->get_builder ()->push_context (lowpc); > + buildsym_compunit *builder = cu->get_builder (); > + gdb_assert (builder != nullptr); > + builder->push_context (lowpc); > symbol *func_sym = new_symbol (die, read_type_die (die, cu), cu, templ_func); > - ctx.name = func_sym; > + builder->set_current_context_function (func_sym); It might be tricky depending on how new_symbol uses the current context when reading a DW_TAG_subprogram, but I wonder if we could call new_symbol first, then pass the resulting symbol to push_context. Then we wouldn't need to have a setter. If that's possible, I think it would be slightly better, because it would show that the symbol is initialized when the context is pushed and can't change. Other callers of push_context would pass a nullptr symbol. Simon