public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/26861] internal-error: void target_mourn_inferior(ptid_t): Assertion `ptid == inferior_ptid' failed. OS: Mac OSX Catalina; Compiler: GCC; Language: C Date: Thu, 25 Feb 2021 20:53:10 +0000 [thread overview] Message-ID: <bug-26861-4717-XFzJv3dIIu@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-26861-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=26861 --- Comment #16 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Simon Marchi <simark@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dffdd8b51f3fb086faf750592709baa8faa66fd1 commit dffdd8b51f3fb086faf750592709baa8faa66fd1 Author: Simon Marchi <simon.marchi@polymtl.ca> Date: Thu Feb 25 15:52:29 2021 -0500 gdb: relax assertion in target_mourn_inferior As reported in PR 26861, when killing an inferior on macOS, we hit the assert: ../../gdb-10.1/gdb/target.c:2149: internal-error: void target_mourn_inferior(ptid_t): Assertion `ptid == inferior_ptid' failed. This is because darwin_nat_target::kill passes a pid-only ptid to target_mourn_inferior, with the pid of the current inferior: target_mourn_inferior (ptid_t (inf->pid)); ... which doesn't satisfy the assert in target_mourn_inferior: gdb_assert (ptid == inferior_ptid); The reason for this assertion is that target_mourn_inferior is a prototype shared between GDB and GDBserver, so that shared code in gdb/nat (used in both GDB and GDBserver) can call target_mourn_inferior. In GDB's implementation, it is likely that some targets still rely on inferior_ptid being set to "the current thread we are working on". So until targets are completely decoupled from inferior_ptid (at least their mourn_inferior implementations), we need to ensure the passed in ptid matches inferior_ptid, to ensure the calling code called target_mourn_inferior with the right global context. However, I think the assert is a bit too restrictive. The mourn_inferior operation works on an inferior, not a specific thread. And by the time we call mourn_inferior, the threads of the inferior don't exist anymore, the process is gone, so it doesn't really make sense to require inferior_ptid to point a specific thread. I looked at all the target_ops::mourn_inferior implementations, those that read inferior_ptid only care about the pid field, which supports the idea that only the inferior matters. Other implementations look at the current inferior (call `current_inferior ()`). I think it would make sense to change target_mourn_inferior to accept only a pid rather than a ptid. It would then assert that the pid is the same as the current inferior's pid. However, this would be a quite involved change, so I'll keep it for later. To fix the macOS issue immediately, I propose to relax the assert to only compare the pids, as is done in this patch. Another solution would obviously be to make darwin_nat_target::kill pass inferior_ptid to target_mourn_inferior. However, the solution I propose is more in line with where I think we want to go (passing a pid to target_mourn_inferior). gdb/ChangeLog: PR gdb/26861 * target.c (target_mourn_inferior): Only compare pids in target_mourn_inferior. Change-Id: If2439ccc5aa67272ea16148a43c5362ef23fb2b8 -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2021-02-25 20:53 UTC|newest] Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-10 9:46 [Bug gdb/26861] New: " ntvallone at ucdavis dot edu 2020-11-10 9:47 ` [Bug gdb/26861] " ntvallone at ucdavis dot edu 2020-11-29 19:25 ` ethanrob122 at gmail dot com 2020-11-29 19:37 ` ethanrob122 at gmail dot com 2021-01-20 1:15 ` fishinfuglers at gmail dot com 2021-01-31 7:42 ` frankshe175 at gmail dot com 2021-02-01 19:07 ` simark at simark dot ca 2021-02-01 19:10 ` simark at simark dot ca 2021-02-10 15:05 ` rostyslav.skrypnyk at gmail dot com 2021-02-23 3:27 ` levraiphilippeblain at gmail dot com 2021-02-23 3:53 ` levraiphilippeblain at gmail dot com 2021-02-24 4:19 ` levraiphilippeblain at gmail dot com 2021-02-24 16:41 ` simark at simark dot ca 2021-02-24 17:11 ` simark at simark dot ca 2021-02-24 20:07 ` levraiphilippeblain at gmail dot com 2021-02-24 20:16 ` levraiphilippeblain at gmail dot com 2021-02-24 22:04 ` simark at simark dot ca 2021-02-25 20:53 ` cvs-commit at gcc dot gnu.org [this message] 2021-02-25 20:55 ` cvs-commit at gcc dot gnu.org 2021-02-25 20:57 ` simark at simark dot ca 2021-02-28 11:41 ` brobecker at gnat dot com 2021-06-27 17:47 ` ahmedsayeed1982 at yahoo dot com 2021-08-18 13:52 ` jamesrogan59 at gmail dot com 2021-08-25 5:16 ` marlenesanchez231+wilmar at gmail dot com 2021-09-02 11:03 ` donipah907 at mtlcz dot com 2021-09-02 11:05 ` donipah907 at mtlcz dot com 2021-09-02 11:17 ` mark at klomp dot org 2021-09-05 7:36 ` kimolsun2020 at yahoo dot com 2021-09-06 9:06 ` focixujo at livinginsurance dot co.uk 2021-09-06 9:12 ` focixujo at livinginsurance dot co.uk 2021-09-06 13:09 ` ntvallone at ucdavis dot edu 2021-09-10 19:37 ` mehmetgelisin at aol dot com 2021-09-13 8:40 ` nicholasgrove641 at gmail dot com 2021-09-13 8:41 ` nicholasgrove641 at gmail dot com 2021-09-13 8:41 ` nicholasgrove641 at gmail dot com 2021-09-13 8:41 ` nicholasgrove641 at gmail dot com 2021-09-28 1:40 ` marlenesanchez231+jaime at gmail dot com 2021-10-08 19:40 ` vficaj at gmail dot com 2021-10-09 11:00 ` gulsenenginar at aol dot com 2021-10-18 19:58 ` ahmedsayeed1982 at hotmail dot com 2021-10-19 7:14 ` progonsaytu at gmail dot com 2021-10-24 10:02 ` glassmtech at ukr dot net 2021-11-10 1:57 ` wallremovalsperth at gmail dot com 2021-11-10 1:59 ` wallremovalsperth at gmail dot com 2021-11-22 6:48 ` gexed96894 at keagenan dot com
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-26861-4717-XFzJv3dIIu@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: 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).