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 symtab/30672] [gdb/symtab] data race in cooked_index_shard::do_finalize() / cooked_index_entry::write_scope
Date: Mon, 24 Jul 2023 09:56:40 +0000	[thread overview]
Message-ID: <bug-30672-4717-5M4CMPNGth@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30672-4717@http.sourceware.org/bugzilla/>

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index 25635d9b72e..8134f8dbbfc 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -68,6 +68,25 @@ language_requires_canonicalization (enum language lang)

 /* See cooked-index.h.  */

+cooked_index_entry::cooked_index_entry (sect_offset die_offset_,
+                                       enum dwarf_tag tag_,
+                                       cooked_index_flag flags_,
+                                       const char *name_,
+                                       const cooked_index_entry
*parent_entry_,

+                                       dwarf2_per_cu_data *per_cu_)
+  : name (name_),
+    tag (tag_),
+    flags (flags_),
+    die_offset (die_offset_),
+    parent_entry (parent_entry_),
+    per_cu (per_cu_)
+{
+  if (!language_requires_canonicalization (per_cu->lang ()))
+    canonical = name_;
+}
+
+/* See cooked-index.h.  */
+
 int
 cooked_index_entry::compare (const char *stra, const char *strb,
                             comparison_mode mode)
@@ -343,8 +362,9 @@ cooked_index_shard::do_finalize ()

   for (cooked_index_entry *entry : m_entries)
     {
-      /* Note that this code must be kept in sync with
-        language_requires_canonicalization.  */
+      if (!language_requires_canonicalization (entry->per_cu->lang ()))
+       continue;
+
       gdb_assert (entry->canonical == nullptr);
       if ((entry->flags & IS_LINKAGE) != 0)
        entry->canonical = entry->name;
@@ -388,7 +408,7 @@ cooked_index_shard::do_finalize ()
            }
        }
       else
-       entry->canonical = entry->name;
+       gdb_assert_not_reached ("Unhandled canonicalization");
     }--

   m_names.shrink_to_fit ();
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index 0d6f3e5aa0e..10207305109 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -78,15 +78,7 @@ struct cooked_index_entry : public allocate_on_obstack
   cooked_index_entry (sect_offset die_offset_, enum dwarf_tag tag_,
                      cooked_index_flag flags_, const char *name_,
                      const cooked_index_entry *parent_entry_,
-                     dwarf2_per_cu_data *per_cu_)
-    : name (name_),
-      tag (tag_),
-      flags (flags_),
-      die_offset (die_offset_),
-      parent_entry (parent_entry_),
-      per_cu (per_cu_)
-  {
-  }
+                     dwarf2_per_cu_data *per_cu_);

   /* Return true if this entry matches SEARCH_FLAGS.  */
   bool matches (block_search_flags search_flags) const
...

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

  reply	other threads:[~2023-07-24  9:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-24  8:23 [Bug symtab/30672] New: " vries at gcc dot gnu.org
2023-07-24  9:56 ` vries at gcc dot gnu.org [this message]
2023-07-24 13:12 ` [Bug symtab/30672] " vries at gcc dot gnu.org
2023-07-24 14:28 ` tromey at sourceware dot org
2023-07-24 15:58 ` vries at gcc dot gnu.org
2023-07-24 16:00 ` vries at gcc dot gnu.org
2023-07-24 23:18 ` vries at gcc dot gnu.org
2023-07-25  7:06 ` vries at gcc dot gnu.org
2023-07-25  7:16 ` vries at gcc dot gnu.org
2023-07-25  7:22 ` vries at gcc dot gnu.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-30672-4717-5M4CMPNGth@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).