public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "exclusion at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug threads/29944] New: Assertion 'filter_target != nullptr' failed when switching inferior inside the exited event handler
Date: Tue, 27 Dec 2022 15:40:01 +0000	[thread overview]
Message-ID: <bug-29944-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 29944
           Summary: Assertion 'filter_target != nullptr' failed when
                    switching inferior inside the exited event handler
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: threads
          Assignee: unassigned at sourceware dot org
          Reporter: exclusion at gmail dot com
  Target Milestone: ---

Created attachment 14539
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14539&action=edit
The crash backtrace

When trying to run PostgreSQL (e.g., postgresql-13 on Debian 11, installed with
"sudo apt install postgresql-13") under GDB using the following script:
###
PGDB=/tmp/tmpdb
rm -rf "$PGDB" || true; /usr/lib/postgresql/13/bin/initdb -D "$PGDB" 
gdb --command=~/postgres-gdb.py --args /usr/lib/postgresql/13/bin/postgres -D
"$PGDB" -k /tmp/ -p 15432
###

and ~/postgres-gdb.py:
###
# Disable pagination to prevent interactive prompts
gdb.execute("set pagination off")
# Attach to both parent and child on fork
gdb.execute("set detach-on-fork off")
# Stop/resume all processes
gdb.execute("set schedule-multiple on")
# Don't stop child processes
gdb.execute("set non-stop on")

# Don't care about these signals
gdb.execute("handle SIGUSR1 noprint nostop pass")
gdb.execute("handle SIGUSR2 noprint nostop pass")
gdb.execute("handle SIGHUP print nostop pass")
gdb.execute("handle SIGTERM print nostop pass")
gdb.execute("handle SIGPIPE print nostop pass")
gdb.execute("handle SIGQUIT print nostop pass")


def exit_handler (event):
    gdb.execute("inferior 1")

gdb.events.exited.connect(exit_handler)

gdb.execute("run")
###

I get gdb crash with the following diagnostics:
2022-12-27 13:52:27.081 UTC [234091] LOG:  listening on Unix socket
"/tmp/.s.PGSQL.15432"
[New inferior 2 (process 234094)]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
2022-12-27 13:52:27.091 UTC [234094] LOG:  database system was shut down at
2022-12-27 13:52:26 UTC
[Inferior 2 (process 234094) exited normally]
[Switching to inferior 1 [process 234091]
(/usr/lib/postgresql/13/bin/postgres)]
[Switching to thread 1.1 (Thread 0x7ffff4994a40 (LWP 234091))](running)
thread-iter.c:109: internal-error: all_matching_threads_iterator: Assertion
`filter_target != nullptr' failed.
A problem internal to GDB has been detected,
...
Full backtrace is attached.

Initially observed with gdb 12.1 but then reproduced with gdb built from HEAD
(b19d96d1).

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

                 reply	other threads:[~2022-12-27 15:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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-29944-4717@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).