From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix "set debug parser"
Date: Fri, 2 May 2025 16:30:04 -0400 [thread overview]
Message-ID: <0dfbab20-4262-4dca-b2dd-fece5f93df08@simark.ca> (raw)
In-Reply-To: <20250426231242.926679-1-tom@tromey.com>
On 2025-04-26 19:12, Tom Tromey wrote:
> While debugging my longer series, I discovered that I broken "set
> debug parser" a couple years ago. This patch fixes it and adds a
> minimal test case so that it, hopefully, will not break again.
>
> This patch also adds parser debugging to the C++ name canonicalizer.
I think this introduced some tsan failures, since multiple threads write
yydebug without synchronization:
WARNING: ThreadSanitizer: data race (pid=1311054)
Read of size 4 at 0x58c55ad4a1f0 by thread T5:
#0 scoped_restore_tmpl<int>::scoped_restore_tmpl<bool>(int*, bool) /home/simark/src/binutils-gdb/gdb/../gdbsupport/scoped_restore.h:71 (gdb+0xb7a0fe) (BuildId: 8f118bec5111347e0f2a78a7dc2fed594eb4ef55)
#1 scoped_restore_tmpl<int> make_scoped_restore<int, bool>(int*, bool) /home/simark/src/binutils-gdb/gdb/../gdbsupport/scoped_restore.h:115 (gdb+0xb6bdbd) (BuildId: 8f118bec5111347e0f2a78a7dc2fed594eb4ef55)
#2 cp_demangled_name_to_comp(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) /home/simark/src/binutils-gdb/gdb/cp-name-parser.y:2051 (gdb+0xfaec69) (BuildId: 8f118bec5111347e0f2a78a7dc2fed594eb4ef55)
#3 cp_canonicalize_string(char const*) /home/simark/src/binutils-gdb/gdb/cp-support.c:635 (gdb+0xfbf01d) (BuildId: 8f118bec5111347e0f2a78a7dc2fed594eb4ef55)
#4 c_canonicalize_name(char const*) /home/simark/src/binutils-gdb/gdb/c-lang.c:732 (gdb+0xe70f6f) (BuildId: 8f118bec5111347e0f2a78a7dc2fed594eb4ef55)
#5 cooked_index_shard::finalize(parent_map_map const*) /home/simark/src/binutils-gdb/gdb/dwarf2/cooked-index-shard.c:273 (gdb+0x104cbcf) (BuildId: 8f118bec5111347e0f2a78a7dc2fed594eb4ef55)
Changing yydebug to be an std::atomic would probably fix it, but it's
generated by bison, not sure this is an option. We'll probably need to
do a custom scoped restore type for this.
Simon
next prev parent reply other threads:[~2025-05-02 20:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-26 23:12 Tom Tromey
2025-04-28 10:50 ` Tom de Vries
2025-04-28 22:29 ` Tom Tromey
2025-04-29 7:42 ` Tom de Vries
2025-05-02 20:30 ` Simon Marchi [this message]
2025-05-03 14:26 ` Simon Marchi
2025-05-03 17:26 ` Tom Tromey
2025-05-03 17:25 ` 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=0dfbab20-4262-4dca-b2dd-fece5f93df08@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.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