public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_
@ 2023-09-08 14:27 vries at gcc dot gnu.org
2023-11-27 20:15 ` [Bug symtab/30837] " cvs-commit at gcc dot gnu.org
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: vries at gcc dot gnu.org @ 2023-09-08 14:27 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
Bug ID: 30837
Summary: [gdb/symtab, index-cache] data race on
current_inferior_
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: symtab
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
Created attachment 15106
--> https://sourceware.org/bugzilla/attachment.cgi?id=15106&action=edit
gdb.log
When building gdb with -fsanitize=threads and using soon to be submitted target
board cc-with-index-cache, I run into a data race in test-case
gdb.ada/non-ascii-utf-8.exp
...
==================^M
^[[1m^[[31mWARNING: ThreadSanitizer: data race (pid=25220)^M
^[[1m^[[0m^[[1m^[[34m Read of size 8 at 0x000003342928 by thread T12:^M
^[[1m^[[0m #0 gdb::ref_ptr<inferior, refcounted_object_ref_policy>::get()
const /data/vries/gdb/src/gdb/../gdbsupport/gdb_ref_ptr.h:132 (gdb+0xa690b8)^M
#1 current_inferior() /data/vries/gdb/src/gdb/inferior.c:57
(gdb+0xa63b74)^M
#2 target_supports_terminal_ours() /data/vries/gdb/src/gdb/target.c:1121
(gdb+0xfaefd4)^M
#3 vwarning(char const*, __va_list_tag*)
/data/vries/gdb/src/gdb/utils.c:147 (gdb+0x10e54c5)^M
#4 warning(char const*, ...) /data/vries/gdb/src/gdbsupport/errors.cc:34
(gdb+0x1dc04e4)^M
#5 ada_encode_1 /data/vries/gdb/src/gdb/ada-lang.c:1000 (gdb+0x47d348)^M
#6 ada_encode[abi:cxx11](char const*, bool)
/data/vries/gdb/src/gdb/ada-lang.c:1159 (gdb+0x47dd12)^M
#7 write_cooked_index /data/vries/gdb/src/gdb/dwarf2/index-write.c:1142
(gdb+0x832e42)^M
#8 write_gdbindex /data/vries/gdb/src/gdb/dwarf2/index-write.c:1236
(gdb+0x83348b)^M
...
^M
^[[1m^[[34m Previous write of size 8 at 0x000003342928 by main thread:^M
^[[1m^[[0m #0 gdb::ref_ptr<inferior,
refcounted_object_ref_policy>::reset(inferior*)
/data/vries/gdb/src/gdb/../gdbsupport/gdb_ref_ptr.h:125 (gdb+0xa6a2bf)^M
#1 gdb::ref_ptr<inferior,
refcounted_object_ref_policy>::operator=(gdb::ref_ptr<inferior,
refcounted_object_ref_policy>&&)
/data/vries/gdb/src/gdb/../gdbsupport/gdb_ref_ptr.h:113 (gdb+0xa691cc)^M
#2 set_current_inferior(inferior*) /data/vries/gdb/src/gdb/inferior.c:66
(gdb+0xa63bf6)^M
#3 switch_to_inferior_no_thread(inferior*)
/data/vries/gdb/src/gdb/inferior.c:714 (gdb+0xa66df9)^M
#4 scoped_restore_current_thread::restore()
/data/vries/gdb/src/gdb/thread.c:1397 (gdb+0xfe1f9b)^M
#5 scoped_restore_current_thread::~scoped_restore_current_thread()
/data/vries/gdb/src/gdb/thread.c:1415 (gdb+0xfe20c9)^M
#6
scoped_restore_current_pspace_and_thread::~scoped_restore_current_pspace_and_thread()
/data/vries/gdb/src/gdb/progspace-and-thread.h:29 (gdb+0x628ef7)^M
#7 bp_loc_is_permanent /data/vries/gdb/src/gdb/breakpoint.c:8532
(gdb+0x609bed)^M
#8 code_breakpoint::add_location(symtab_and_line const&)
/data/vries/gdb/src/gdb/breakpoint.c:8509 (gdb+0x609acc)^M
#9 internal_breakpoint::internal_breakpoint(gdbarch*, bptype, unsigned
long) /data/vries/gdb/src/gdb/breakpoint.c:350 (gdb+0x6282a3)^M
#10 create_internal_breakpoint /data/vries/gdb/src/gdb/breakpoint.c:3454
(gdb+0x5f71c0)^M
#11 create_internal_breakpoint /data/vries/gdb/src/gdb/breakpoint.c:3485
(gdb+0x5f7346)^M
#12 create_exception_master_breakpoint_hook
/data/vries/gdb/src/gdb/breakpoint.c:3856 (gdb+0x5f86dc)^M
#13 create_exception_master_breakpoint
/data/vries/gdb/src/gdb/breakpoint.c:3882 (gdb+0x5f8899)^M
#14 breakpoint_re_set() /data/vries/gdb/src/gdb/breakpoint.c:13262
(gdb+0x61c3f1)^M
#15 symbol_file_command(char const*, int)
/data/vries/gdb/src/gdb/symfile.c:1686 (gdb+0xf44c8d)^M
#16 file_command /data/vries/gdb/src/gdb/exec.c:554 (gdb+0x94f99f)^M
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
@ 2023-11-27 20:15 ` cvs-commit at gcc dot gnu.org
2023-11-27 23:28 ` tromey at sourceware dot org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-27 20:15 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
--- Comment #1 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f1b8ee6f2b4381bc46a0ad4c233b6eddc1e135b5
commit f1b8ee6f2b4381bc46a0ad4c233b6eddc1e135b5
Author: Tom de Vries <tdevries@suse.de>
Date: Mon Nov 27 21:15:26 2023 +0100
[gdb/testsuite] Add boards/cc-with-index-cache.exp
We have a target board cc-with-gdb-index that uses the gdb-add-index script
to
add a .gdb_index index to an exec.
There is however an alternative way of adding a .gdb_index: the
index-cache.
Add a new target board cc-with-index-cache.
This is not superfluous for two reasons:
- there is functionality that gdb-add-index doesn't support, but the
index-cache does: the index-cache can add an index to an exec with a
.gnu_debugaltlink (note that when using the cc-with-gdb-index board this
case is quietly ignored), and
- using the index-cache is excercised in only a few test-cases, and having
this target board extends the test coverage to the entire test suite.
This
is for instance relevant because the index-cache is written by a worker
thread in the background, so we can check more thoroughly for data races
(see PR symtab/30837).
Tested on x86_64-linux.
Shell script changes checked with shellcheck.
Approved-By: Tom Tromey <tom@tromey.com>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
2023-11-27 20:15 ` [Bug symtab/30837] " cvs-commit at gcc dot gnu.org
@ 2023-11-27 23:28 ` tromey at sourceware dot org
2023-11-30 17:02 ` tromey at sourceware dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2023-11-27 23:28 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
Assignee|unassigned at sourceware dot org |tromey at sourceware dot org
--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Probably need to defer warnings in this code.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
2023-11-27 20:15 ` [Bug symtab/30837] " cvs-commit at gcc dot gnu.org
2023-11-27 23:28 ` tromey at sourceware dot org
@ 2023-11-30 17:02 ` tromey at sourceware dot org
2023-12-02 0:23 ` tromey at sourceware dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2023-11-30 17:02 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |29366
Referenced Bugs:
https://sourceware.org/bugzilla/show_bug.cgi?id=29366
[Bug 29366] [meta] New DWARF indexer meta bug
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
` (2 preceding siblings ...)
2023-11-30 17:02 ` tromey at sourceware dot org
@ 2023-12-02 0:23 ` tromey at sourceware dot org
2023-12-04 15:54 ` tromey at sourceware dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2023-12-02 0:23 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Also worth noting that if/when the .debug_names writer is fixed,
this warning will be impossible, because that will just be
writing out the DW_AT_name values verbatim.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
` (3 preceding siblings ...)
2023-12-02 0:23 ` tromey at sourceware dot org
@ 2023-12-04 15:54 ` tromey at sourceware dot org
2024-01-19 16:35 ` tromey at sourceware dot org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2023-12-04 15:54 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
Actually the debug-names writer shouldn't be invoked from the
background so this must be something else.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
` (4 preceding siblings ...)
2023-12-04 15:54 ` tromey at sourceware dot org
@ 2024-01-19 16:35 ` tromey at sourceware dot org
2024-02-12 19:08 ` tromey at sourceware dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2024-01-19 16:35 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Tom Tromey from comment #4)
> Actually the debug-names writer shouldn't be invoked from the
> background so this must be something else.
It's the call to ada_encode in index-write.c:write_cooked_index.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
` (5 preceding siblings ...)
2024-01-19 16:35 ` tromey at sourceware dot org
@ 2024-02-12 19:08 ` tromey at sourceware dot org
2024-02-13 21:04 ` tromey at sourceware dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2024-02-12 19:08 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |15.1
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
` (6 preceding siblings ...)
2024-02-12 19:08 ` tromey at sourceware dot org
@ 2024-02-13 21:04 ` tromey at sourceware dot org
2024-02-14 12:33 ` tromey at sourceware dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2024-02-13 21:04 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
I have a patch for this that I'll send tomorrow.
It's tempting to unify the ways to intercept warnings
and not have a separate "deferred warning" class, but
in the end I chose not to do this for now.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
` (7 preceding siblings ...)
2024-02-13 21:04 ` tromey at sourceware dot org
@ 2024-02-14 12:33 ` tromey at sourceware dot org
2024-03-12 14:41 ` tromey at sourceware dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2024-02-14 12:33 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
--- Comment #7 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2024-February/206595.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
` (8 preceding siblings ...)
2024-02-14 12:33 ` tromey at sourceware dot org
@ 2024-03-12 14:41 ` tromey at sourceware dot org
2024-03-26 15:55 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2024-03-12 14:41 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
--- Comment #8 from Tom Tromey <tromey at sourceware dot org> ---
v2 (just a rebase):
https://sourceware.org/pipermail/gdb-patches/2024-March/207215.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
` (9 preceding siblings ...)
2024-03-12 14:41 ` tromey at sourceware dot org
@ 2024-03-26 15:55 ` cvs-commit at gcc dot gnu.org
2024-03-26 15:56 ` tromey at sourceware dot org
2024-05-17 14:17 ` tromey at sourceware dot org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-26 15:55 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
--- Comment #9 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=818ef5f4137aaff3afdb52f8bbd3a4c3a9ffa28b
commit 818ef5f4137aaff3afdb52f8bbd3a4c3a9ffa28b
Author: Tom Tromey <tromey@adacore.com>
Date: Tue Feb 13 13:55:34 2024 -0700
Capture warnings when writing to the index cache
PR symtab/30837 points out a race that can occur when writing to the
index cache: a call to ada_encode can cause a warning, which is
forbidden on a worker thread.
This patch fixes the problem by arranging to capture any such
warnings.
This is v2 of the patch. It is rebased on top of some other changes
in the same area. v1 was here:
https://sourceware.org/pipermail/gdb-patches/2024-February/206595.html
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30837
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
` (10 preceding siblings ...)
2024-03-26 15:55 ` cvs-commit at gcc dot gnu.org
@ 2024-03-26 15:56 ` tromey at sourceware dot org
2024-05-17 14:17 ` tromey at sourceware dot org
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2024-03-26 15:56 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug symtab/30837] [gdb/symtab, index-cache] data race on current_inferior_
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
` (11 preceding siblings ...)
2024-03-26 15:56 ` tromey at sourceware dot org
@ 2024-05-17 14:17 ` tromey at sourceware dot org
12 siblings, 0 replies; 14+ messages in thread
From: tromey at sourceware dot org @ 2024-05-17 14:17 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30837
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |31751
Referenced Bugs:
https://sourceware.org/bugzilla/show_bug.cgi?id=31751
[Bug 31751] re-enable background DWARF reading
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-05-17 14:17 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08 14:27 [Bug symtab/30837] New: [gdb/symtab, index-cache] data race on current_inferior_ vries at gcc dot gnu.org
2023-11-27 20:15 ` [Bug symtab/30837] " cvs-commit at gcc dot gnu.org
2023-11-27 23:28 ` tromey at sourceware dot org
2023-11-30 17:02 ` tromey at sourceware dot org
2023-12-02 0:23 ` tromey at sourceware dot org
2023-12-04 15:54 ` tromey at sourceware dot org
2024-01-19 16:35 ` tromey at sourceware dot org
2024-02-12 19:08 ` tromey at sourceware dot org
2024-02-13 21:04 ` tromey at sourceware dot org
2024-02-14 12:33 ` tromey at sourceware dot org
2024-03-12 14:41 ` tromey at sourceware dot org
2024-03-26 15:55 ` cvs-commit at gcc dot gnu.org
2024-03-26 15:56 ` tromey at sourceware dot org
2024-05-17 14:17 ` tromey at sourceware dot org
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).