public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/hurd: handle inferiors exiting Date: Sat, 8 Jan 2022 22:13:15 +0000 (GMT) [thread overview] Message-ID: <20220108221315.8DD693857C67@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=038d8b4635eda079a63df176cfa48c47f8c32617 commit 038d8b4635eda079a63df176cfa48c47f8c32617 Author: Andrew Burgess <aburgess@redhat.com> Date: Thu Jan 6 15:32:55 2022 +0000 gdb/hurd: handle inferiors exiting While testing on GNU/Hurd (i386) I noticed that GDB crashes when an inferior exits, with this error: inferior.c:293: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed. The problem appears to be in gnu_nat_target::wait. We always set inferior_ptid to null_ptid before calling target_wait, this has been the case since the multi-target changes were made to GDB in commit: commit 5b6d1e4fa4fc6827c7b3f0e99ff120dfa14d65d2 Date: Fri Jan 10 20:06:08 2020 +0000 Multi-target support With follow up changes in commit: commit 24ed6739b699f329c2c45aedee5f8c7d2f54e493 Date: Thu Jan 30 14:35:40 2020 +0000 gdb/remote: Restore support for 'S' stop reply packet Unfortunately, the GNU/Hurd target is still relying on the value of inferior_ptid in the case where an inferior exits - we return the value of inferior_ptid as the pid of the process that exited. This was fine in the single target world, where inferior_ptid identified the one running inferior, but this is no longer good enough. Instead, we should return a ptid containing the pid of the process that exited, as obtained from the wait event, and this is what this commit does. I've not run the full testsuite on GNU/Hurd as there appear to be lots of other issues with this target that makes running the full testsuite very painful, but I think this looks like a small easy improvement. Diff: --- gdb/gnu-nat.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index 1d3b5f1a357..9c53e3c0c2f 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -1603,7 +1603,10 @@ rewait: available thread. */ else - ptid = inferior_ptid; /* let wait_for_inferior handle exit case */ + { + /* The process exited. */ + ptid = ptid_t (inf->pid); + } } if (thread
reply other threads:[~2022-01-08 22:13 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=20220108221315.8DD693857C67@sourceware.org \ --to=aburgess@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).