public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/31262] [gdb] ThreadSanitizer: data raceindex-cache.c:76 in index_cache::enable()
Date: Thu, 18 Jan 2024 12:37:45 +0000	[thread overview]
Message-ID: <bug-31262-4717-ZLVzBm4JaU@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31262-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31262

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
I guess the problem is that we're capturing index_cache_store_context in a
worker thread (T5) while the capturing is supposed to happen in the main
thread:
...
/* Information to be captured in the main thread, and to be used by worker      
   threads during store ().  */

struct index_cache_store_context
{
  friend class index_cache;

  index_cache_store_context (const index_cache &ic, dwarf2_per_bfd *per_bfd);
...

In other words, this should trigger:
...
diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
index 7ddd7b3f974..50db5f92b40 100644
--- a/gdb/dwarf2/index-cache.c
+++ b/gdb/dwarf2/index-cache.c
@@ -92,6 +92,7 @@ index_cache_store_context::index_cache_store_context (const
index_cache &ic,
                                                      dwarf2_per_bfd *per_bfd)
   :  m_enabled (ic.enabled ())
 {
+  gdb_assert (is_main_thread ());
   if (!m_enabled)
     return;

...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2024-01-18 12:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18  9:32 [Bug gdb/31262] New: " vries at gcc dot gnu.org
2024-01-18 12:37 ` vries at gcc dot gnu.org [this message]
2024-01-22 14:17 ` [Bug gdb/31262] " vries at gcc dot gnu.org
2024-01-22 20:33 ` tromey at sourceware dot org
2024-01-27 16:09 ` tromey at sourceware dot org
2024-01-28 16:33 ` tromey at sourceware dot org
2024-02-12 19:07 ` tromey at sourceware dot org
2024-03-09  0:27 ` cvs-commit at gcc dot gnu.org
2024-03-09  0:28 ` tromey at sourceware dot org
2024-05-17 14:17 ` tromey at sourceware dot org

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=bug-31262-4717-ZLVzBm4JaU@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).