From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] Capture warnings when writing to the index cache
Date: Tue, 26 Mar 2024 23:08:01 -0400 [thread overview]
Message-ID: <7fd73e54-4e87-4f2f-ab70-a3fb8194e32a@simark.ca> (raw)
In-Reply-To: <87zfulat8g.fsf@tromey.com>
On 2024-03-26 11:49, Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tromey@adacore.com> 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> (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<void (const char *, __va_list_tag *)>::bind<deferred_warnings>' 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<void (const char *, __va_list_tag *)>::function_view<deferred_warnings &, void, void>' requested here
592 | scoped_restore_warning_hook defer (*warn);
| ^
In file included from <built-in>: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> (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
next prev parent reply other threads:[~2024-03-27 3:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-12 14:40 Tom Tromey
2024-03-26 15:49 ` Tom Tromey
2024-03-27 3:08 ` Simon Marchi [this message]
2024-03-27 13:25 ` Tom Tromey
2024-03-27 14:39 ` Simon Marchi
2024-04-08 4:23 ` Simon Marchi
2024-04-08 12:59 ` Tom Tromey
2024-04-09 1:33 ` Simon Marchi
2024-04-09 15:20 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7fd73e54-4e87-4f2f-ab70-a3fb8194e32a@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox