public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp
@ 2023-03-22 12:21 vries at gcc dot gnu.org
  2023-03-22 12:29 ` [Bug gdb/30261] " vries at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-22 12:21 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30261
           Summary: [gdb] segfaults in gdb.base/index-cache.exp
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

With test-case gdb.base/index-cache.exp and target board
native-extended-gdbserver I run into:
...
Reading symbols from
/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.base/index-cache/index-cache...^M
^M
^M
Fatal signal: Segmentation fault^M
  ...
0x479798 _ZN4type10set_fieldsEP5field^M
        /data/vries/gdb/src/gdb/gdbtypes.h:975^M
...

Not 100% reproducible, also can happen at a different location.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
@ 2023-03-22 12:29 ` vries at gcc dot gnu.org
  2023-03-22 12:35 ` vries at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-22 12:29 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
After clean rebuild, reproduces as a hang instead.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
  2023-03-22 12:29 ` [Bug gdb/30261] " vries at gcc dot gnu.org
@ 2023-03-22 12:35 ` vries at gcc dot gnu.org
  2023-03-22 12:52 ` vries at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-22 12:35 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Now, again as a segfault, but different location:
...
(gdb) maintenance wait-for-index-cache^M
0x595ac6 gdb_internal_backtrace_1^M
        /data/vries/gdb/src/gdb/bt-utils.c:122^M
  ...
0x41feea _ZNK4type4codeEv^M
        /data/vries/gdb/src/gdb/gdbtypes.h:912^M
...

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
  2023-03-22 12:29 ` [Bug gdb/30261] " vries at gcc dot gnu.org
  2023-03-22 12:35 ` vries at gcc dot gnu.org
@ 2023-03-22 12:52 ` vries at gcc dot gnu.org
  2023-03-22 13:54 ` vries at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-22 12:52 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Hmm, the test already doesn't work with "maint set worker-threads 0" on native.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-03-22 12:52 ` vries at gcc dot gnu.org
@ 2023-03-22 13:54 ` vries at gcc dot gnu.org
  2023-03-23 15:19 ` vries at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-22 13:54 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #3)
> Hmm, the test already doesn't work with "maint set worker-threads 0" on
> native.

Likewise in test-case gdb.dwarf2/per-bfd-sharing.exp, there we run into:
...
FAIL: gdb.dwarf2/per-bfd-sharing.exp: couldn't remove files in temporary cache
dir
...

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug gdb/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-03-22 13:54 ` vries at gcc dot gnu.org
@ 2023-03-23 15:19 ` vries at gcc dot gnu.org
  2023-03-23 15:20 ` [Bug symtab/30261] " vries at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-23 15:19 UTC (permalink / raw)
  To: gdb-prs

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

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

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
At commit f0c3dcc1ca7 ("Ensure index cache entry written in test"):
...
$ for n in $(seq 1 10); do ./test.sh -native-extended-gdbserver | grep '^#' |
sort -u; done
# of expected passes            23
# of unresolved testcases       1
# of expected passes            24
# of expected passes            24
# of expected passes            24
# of expected passes            24
# of expected passes            22
# of unexpected core files      1
# of unresolved testcases       2
# of expected passes            24
# of expected passes            24
# of expected passes            24
# of expected passes            24
...

At commit 52e5e48e533 ("Write the DWARF index in the background"):
...
$ for n in $(seq 1 10); do ./test.sh -native-extended-gdbserver | grep '^#' |
sort -u; done
# of expected passes            19
# of expected passes            19
# of expected passes            19
# of expected passes            17
# of unexpected core files      1
# of unexpected failures        3
# of expected passes            17
# of unexpected core files      1
# of unexpected failures        2
# of unresolved testcases       1
# of expected passes            16
# of unexpected core files      1
# of unexpected failures        4
# of expected passes            19
# of expected passes            17
# of unexpected core files      1
# of unresolved testcases       2
# of expected passes            17
# of unexpected core files      1
# of unexpected failures        3
# of expected passes            19
...

At commit 52e5e48e533^:
...
$ for n in $(seq 1 10); do ./test.sh -native-extended-gdbserver | grep '^#' |
sort -u; done
# of expected passes            19
# of expected passes            19
# of expected passes            19
# of expected passes            19
# of expected passes            19
# of expected passes            19
# of expected passes            19
# of expected passes            19
# of expected passes            19
# of expected passes            19
...

So, this looks like a regression by commit 52e5e48e533 ("Write the DWARF index
in the background") that hasn't been fixed by commit f0c3dcc1ca7 ("Ensure index
cache entry written in test").

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug symtab/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-03-23 15:19 ` vries at gcc dot gnu.org
@ 2023-03-23 15:20 ` vries at gcc dot gnu.org
  2023-03-23 15:35 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-23 15:20 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|gdb                         |symtab

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug symtab/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-03-23 15:20 ` [Bug symtab/30261] " vries at gcc dot gnu.org
@ 2023-03-23 15:35 ` vries at gcc dot gnu.org
  2023-03-23 19:22 ` tromey at sourceware dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-23 15:35 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 14775
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14775&action=edit
gdb.log with thread sanitizer

$ grep ThreadS gdb.log 
WARNING: ThreadSanitizer: data race (pid=22270)
SUMMARY: ThreadSanitizer: data race
/data/vries/gdb/src/gdb/dwarf2/index-cache.c:76 in index_cache::enable()
WARNING: ThreadSanitizer: data race (pid=22359)
SUMMARY: ThreadSanitizer: data race /usr/include/c++/7/bits/unique_ptr.h:147 in
std::__uniq_ptr_impl<dwarf_scanner_base,
std::default_delete<dwarf_scanner_base> >::_M_ptr() const
WARNING: ThreadSanitizer: data race (pid=22359)
SUMMARY: ThreadSanitizer: data race
/data/vries/gdb/src/gdb/dwarf2/index-write.c:1229 in write_gdbindex
WARNING: ThreadSanitizer: data race (pid=22404)
SUMMARY: ThreadSanitizer: data race /data/vries/gdb/src/bfd/cache.c:585 in
bfd_open_file
WARNING: ThreadSanitizer: data race (pid=22404)
SUMMARY: ThreadSanitizer: data race /usr/include/c++/7/bits/unique_ptr.h:147 in
std::__uniq_ptr_impl<dwarf_scanner_base,
std::default_delete<dwarf_scanner_base> >::_M_ptr() const
WARNING: ThreadSanitizer: data race (pid=22404)
SUMMARY: ThreadSanitizer: data race
/data/vries/gdb/src/gdb/dwarf2/index-write.c:1229 in write_gdbindex
...

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug symtab/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-03-23 15:35 ` vries at gcc dot gnu.org
@ 2023-03-23 19:22 ` tromey at sourceware dot org
  2023-03-24 20:57 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: tromey at sourceware dot org @ 2023-03-23 19:22 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |tromey at sourceware dot org

--- Comment #7 from Tom Tromey <tromey at sourceware dot org> ---
I'll investigate.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug symtab/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2023-03-23 19:22 ` tromey at sourceware dot org
@ 2023-03-24 20:57 ` tromey at sourceware dot org
  2023-03-24 21:55 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: tromey at sourceware dot org @ 2023-03-24 20:57 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #8 from Tom Tromey <tromey at sourceware dot org> ---
Ok, I found the problem.
This would also be fixed by my WIP to move more reading to the background,
but unfortunately that series isn't quite ready yet.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug symtab/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2023-03-24 20:57 ` tromey at sourceware dot org
@ 2023-03-24 21:55 ` tromey at sourceware dot org
  2023-03-31 14:54 ` cvs-commit at gcc dot gnu.org
  2023-03-31 14:55 ` tromey at sourceware dot org
  11 siblings, 0 replies; 13+ messages in thread
From: tromey at sourceware dot org @ 2023-03-24 21:55 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #9 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2023-March/198290.html

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug symtab/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2023-03-24 21:55 ` tromey at sourceware dot org
@ 2023-03-31 14:54 ` cvs-commit at gcc dot gnu.org
  2023-03-31 14:55 ` tromey at sourceware dot org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-31 14:54 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #10 from cvs-commit at gcc dot gnu.org <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=6f214d0f399847b13f979651c3b46befcbb42140

commit 6f214d0f399847b13f979651c3b46befcbb42140
Author: Tom Tromey <tom@tromey.com>
Date:   Fri Mar 24 15:53:22 2023 -0600

    Fix race in background index-cache writing

    Tom de Vries pointed out a bug in the index-cache background writer --
    sometimes it will fail.  He also noted that it fails when the number
    of worker threads is set to zero.  These turn out to be the same
    problem -- the cache can't be written to until the per-BFD's
    "index_table" member is set.

    This patch avoids the race by rearranging the code slightly, to ensure
    the cache cannot possibly be written before the member is set.

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

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug symtab/30261] [gdb] segfaults in gdb.base/index-cache.exp
  2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2023-03-31 14:54 ` cvs-commit at gcc dot gnu.org
@ 2023-03-31 14:55 ` tromey at sourceware dot org
  11 siblings, 0 replies; 13+ messages in thread
From: tromey at sourceware dot org @ 2023-03-31 14:55 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |14.1
             Status|NEW                         |RESOLVED

--- Comment #11 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] 13+ messages in thread

end of thread, other threads:[~2023-03-31 14:55 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 12:21 [Bug gdb/30261] New: [gdb] segfaults in gdb.base/index-cache.exp vries at gcc dot gnu.org
2023-03-22 12:29 ` [Bug gdb/30261] " vries at gcc dot gnu.org
2023-03-22 12:35 ` vries at gcc dot gnu.org
2023-03-22 12:52 ` vries at gcc dot gnu.org
2023-03-22 13:54 ` vries at gcc dot gnu.org
2023-03-23 15:19 ` vries at gcc dot gnu.org
2023-03-23 15:20 ` [Bug symtab/30261] " vries at gcc dot gnu.org
2023-03-23 15:35 ` vries at gcc dot gnu.org
2023-03-23 19:22 ` tromey at sourceware dot org
2023-03-24 20:57 ` tromey at sourceware dot org
2023-03-24 21:55 ` tromey at sourceware dot org
2023-03-31 14:54 ` cvs-commit at gcc dot gnu.org
2023-03-31 14:55 ` 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).