From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ZzuUGamNA2ZUpxcAWB0awg (envelope-from ) for ; Tue, 26 Mar 2024 23:08:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1711508905; bh=6j2IFBrpzbW5QP37GqAiuxvjZFiJlmYDAl5NgyoZM4Y=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=J6ffDb1GW4r1BcATlkbGdoDHbL4XTgLJ2mp5iBOKzI1VbyYoLvKzcysrlhCmTiIuR TCLu6PPqxJ8Dgnhv1ebn2bRRUMohGOMyNfGspkz5NXQGmTsGEW8uTLpaHS+IAADSUF 0jI/c5TRhQZs4S3aAp59RJDX6IwCP0AixsDNeSHU= Received: by simark.ca (Postfix, from userid 112) id 553241E0C0; Tue, 26 Mar 2024 23:08:25 -0400 (EDT) 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=cqllNw8q; 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 3C5011E08C for ; Tue, 26 Mar 2024 23:08:23 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 892B83858295 for ; Wed, 27 Mar 2024 03:08:22 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 707A43858C36 for ; Wed, 27 Mar 2024 03:08:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 707A43858C36 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 707A43858C36 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=1711508884; cv=none; b=CsB8FAX6GM7avfArNHhJ4SkZN4o/sEoDj0zbF/E03/yHkvMrVCDm6EyFWH/yg41qNPcbEs0ngotwMspk8//Pf/O/g27cyWe/Hme9PZo2Uro5sbit/laL4X38GhvsaYd2bdtc4LIPEJdG8snendkrcRp/CoAuAFrLI/BvPnbXRKQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711508884; c=relaxed/simple; bh=6j2IFBrpzbW5QP37GqAiuxvjZFiJlmYDAl5NgyoZM4Y=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=iBrdikMskjVTusxdC7An6JPGRfISObz0D4FJkD3iVAooJ9GrQ0dZmSuj9tx+mflv39UEHw08hgNPgEj6h7Hx83nDPb+TW1c4ihz6ZfpW2+wzWoyiWbIJv7tazndzaBL+FcUzK432dWplmgCXbQGda1x77L9rf7UMXcRgonpOPYE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1711508881; bh=6j2IFBrpzbW5QP37GqAiuxvjZFiJlmYDAl5NgyoZM4Y=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=cqllNw8qJ36BEedqJyiIMwqRe5r0ccW3zP3WLy+TQZK1XevFeT8rVO2OjslLDUgN8 cCqxfaF3pWFf4QhC3tcMJeUpxY2phBfE6Re1sKz1OxjRJIkl+E1uq/H7XluLXWwL+/ tcPRXRMNY8uwHisuBTmpabGpdhFg+kTlMLk7NHt0= 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 A5CA91E08C; Tue, 26 Mar 2024 23:08:01 -0400 (EDT) Message-ID: <7fd73e54-4e87-4f2f-ab70-a3fb8194e32a@simark.ca> Date: Tue, 26 Mar 2024 23:08:01 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] Capture warnings when writing to the index cache Content-Language: en-US To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20240312144033.77496-1-tromey@adacore.com> <87zfulat8g.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87zfulat8g.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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-03-26 11:49, Tom Tromey wrote: >>>>>> "Tom" == Tom Tromey writes: > > Tom> PR symtab/30837 points out a race that can occur when writing to the > Tom> index cache: a call to ada_encode can cause a warning, which is > Tom> forbidden on a worker thread. > > Tom> This patch fixes the problem by arranging to capture any such > Tom> warnings. > > Tom> This is v2 of the patch. It is rebased on top of some other changes > Tom> in the same area. v1 was here: > > Tom> https://sourceware.org/pipermail/gdb-patches/2024-February/206595.html > > Tom> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30837 > > I'm checking this in now. > > Tom Hi Tom, When building with Clang 17, I see: /home/simark/src/binutils-gdb/gdb/../gdbsupport/function-view.h:300:37: error: format string is not a string literal [-Werror,-Wformat-nonliteral] 300 | noexcept (noexcept (callable (std::forward (args)...))) -> Res | ^~~~~~~~~~~~~~~~~~~~~~~~~ /home/simark/src/binutils-gdb/gdb/../gdbsupport/function-view.h:299:17: note: while substituting into a lambda expression here 299 | m_invoker = [] (fv_detail::erased_callable ecall, Args... args) | ^ /home/simark/src/binutils-gdb/gdb/../gdbsupport/function-view.h:265:5: note: in instantiation of function template specialization 'gdb::function_view::bind' requested here 265 | bind (callable); | ^ /home/simark/src/binutils-gdb/gdb/dwarf2/cooked-index.c:592:42: note: in instantiation of function template specialization 'gdb::function_view::function_view' requested here 592 | scoped_restore_warning_hook defer (*warn); | ^ In file included from :1: In file included from /home/simark/src/binutils-gdb/gdb/defs.h:620: In file included from /home/simark/src/binutils-gdb/gdb/utils.h:24: /home/simark/src/binutils-gdb/gdb/../gdbsupport/function-view.h:305:34: error: format string is not a string literal [-Werror,-Wformat-nonliteral] 305 | return (Res) restored_callable (std::forward (args)...); | ^~~~~~~~~~~~~~~~~~~~~~~~~ My interpretation of this is that we bind a function marked with `ATTRIBUTE_PRINTF (2,0)` (deferred_warnings::operator()) to a function view that doesn't convey the attribute. So I guess the compiler is telling us that whenever the function view is invoked, there won't be a format string check, and that's dangerous. I didn't find a good fix that :(. Simon