From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ExREKQpYT2cu4wIAWB0awg (envelope-from ) for ; Tue, 03 Dec 2024 14:12:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1733253130; bh=tKtTFX+2fesPlo3srBSQcCOxJpU1plFMcpjs7YdRknA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lNzlBtRB01Zv4XzxEAeULsJve1I/oU+c/0PnwpctE2rxMfttsTY2UNmHuUZaV5i1P 9KtyP9pAzPo0RTJneUHlvZoxNZgkvRr3QWRTqIRsNFKnQjt44yG4zySPHKmXK/iJk2 aM8n9/akRWwXHqa7m1dJ5XStUb2lyTOP2erhQeTM= Received: by simark.ca (Postfix, from userid 112) id 9C11C1E0BB; Tue, 3 Dec 2024 14:12:10 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.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 autolearn=unavailable autolearn_force=no version=4.0.0 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=CaTaFLco; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=eaPjyBLl; dkim-atps=neutral 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 3A2BF1E05C for ; Tue, 3 Dec 2024 14:12:10 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C51263858CDA for ; Tue, 3 Dec 2024 19:12:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C51263858CDA 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=CaTaFLco; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=eaPjyBLl Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 94EA43858D26 for ; Tue, 3 Dec 2024 19:11:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 94EA43858D26 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 94EA43858D26 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=1733253085; cv=none; b=I5lHKciAF5zOq4p/PTfZRLGtyTmXZLcEj2RPbkWNDsSWZx+Sq2VyTqP7VkCVfpUBuxeWu4oHfdqYzxEeKYppXYBaWUZ/EZn4spkkldHjE2VUgPIKBg/JQP5Cm0581h1r/AcZ9kkezX6XwrKPCFhg53+w9L3dxZAq73rwOc/+XVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733253085; c=relaxed/simple; bh=tKtTFX+2fesPlo3srBSQcCOxJpU1plFMcpjs7YdRknA=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=voOOu7uV+a+U3BmYd2469BvYeQxioQ8XDf8wC99UFBdLfBHcI19XS2COKIzOtJnJ7JpPrn0wMU8j+kEMgqfSrePDmmH3hYn3Crp/TiIgCElvj06kfxk3q0+MfeXco7tSC8L3Oot2LnIcKU0lieszKYUZa7SjVqzZAg4F9IoSkek= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94EA43858D26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1733253084; bh=tKtTFX+2fesPlo3srBSQcCOxJpU1plFMcpjs7YdRknA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=CaTaFLco3ga/ixOv8Jyd0G6yDIvvvTTD651ZaM+2RJyeE4eAyUBGvaDbbGJaNFWoU /ad5fWVEzq8Fn39iHhVCsxSZbyNYczciW5+6/k2M7OEGUNBZLHRiJ5IoA7ICIN40kH 6ubWc62SvN1gh0KpM2VCN/2OboVBWrlZTseDsfjc= Received: by simark.ca (Postfix, from userid 112) id D06061E0BB; Tue, 3 Dec 2024 14:11:24 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1733253083; bh=tKtTFX+2fesPlo3srBSQcCOxJpU1plFMcpjs7YdRknA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=eaPjyBLlCBeQLE2uU5gdg4VX+/xxyRgQWQE+2J7JrXQTdiHkI7wJgOw4v3GDWv4n8 fG4gX03mRPF51DP048l5J+toWyZ3s3Y9Ec5EcS5wvizv/Mx2BRj5hcweVLYhNUPaOD Hm4XhJbeSYbmfrHcvij9+rtk5HV76Lvy6O/DDzoU= Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 73C3C1E05C; Tue, 3 Dec 2024 14:11:23 -0500 (EST) Message-ID: <8cf13692-d876-43d1-bdf1-08cf4429d177@simark.ca> Date: Tue, 3 Dec 2024 14:11:23 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb: restore nullptr check in compunit_symtab::find_call_site To: Tom Tromey , Simon Marchi Cc: gdb-patches@sourceware.org References: <20241203155223.10203-1-simon.marchi@efficios.com> <87ser4mzbr.fsf@tromey.com> Content-Language: en-US From: Simon Marchi In-Reply-To: <87ser4mzbr.fsf@tromey.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 2024-12-03 12:49, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> Commit de2b4ab50de ("Convert dwarf2_cu::call_site_htab to new hash > Simon> table") removed this nullptr check for no good reason. This causes a > Simon> crash if `m_call_site_htab` is not set, as shown in PR 32410. My guess > Simon> is that when doing this change, I tried to make `m_call_site_htab` not a > Simon> pointer, removed this check, then realized it wasn't so obvious, and > Simon> forgot to re-add the check. > > Yeah, someday maybe symtabs should be allocated the ordinary way. > > On the one hand, obstacks are nice since they reduce free overhead. > But on the other hand, they mean we can't use destructors... and for > this case, I think there normally aren't "too many" symtabs, so it's > probably fine to make the change. We can still use destructors, we might just need to call it manually. In fact, I was wondering if `compunit_symtab::finalize()` couldn't just become `compunit_symtab::~compunit_symtab()` (it would still be called manually at the same place. In fact, can't `allocate_on_obstack` help us with that? What if you have: struct compunit_symtab : allocate_on_obstack { ... }; and then use: std::unique_ptr uptr; My understanding (although I haven't tried) is: when `uptr` gets destroyed, it will call compunit_symtab's destructor, but won't free any memory because the delete operator of allocate_on_obstack is a noop. Do I understand it correctly? If I find some time, I would still like to try to make compunit_symtab / symtab allocated normally and measure how expensive it is to free a few thousands of those. If the difference isn't significant, I would be happy to get rid of that complexity. Simon