]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Do not set yydebug in cp-name-parser.y
authorTom Tromey <tom@tromey.com>
Sat, 3 May 2025 17:28:22 +0000 (11:28 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 6 May 2025 20:58:56 +0000 (14:58 -0600)
This reverts the change to cp-name-parser.y, avoiding a TSan report.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/cp-name-parser.y

index e7317b732cca012eb61f85945e1c26315806df00..d4ab98c7a108b996f6874df326f188136ff14c86 100644 (file)
@@ -2047,9 +2047,11 @@ cp_demangled_name_to_comp (const char *demangled_name,
   auto result = std::make_unique<demangle_parse_info> ();
   cpname_state state (demangled_name, result.get ());
 
-  scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
-                                                       parser_debug);
-
+  /* Note that we can't set yydebug here, as is done in the other
+     parsers.  Bison implements yydebug as a global, even with a pure
+     parser, and this parser is run from worker threads.  So, changing
+     yydebug causes TSan reports.  If you need to debug this parser,
+     debug gdb and set the global from the outer gdb.  */
   if (yyparse (&state))
     {
       if (state.global_errmsg && errmsg)