public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "simark at simark dot ca" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug record/28086] inferior.c:303: internal-error: inferior* find_inferior _pid(process_stratum_target*, int): Assertion `pid != 0' failed. Date: Wed, 14 Jul 2021 14:41:48 +0000 [thread overview] Message-ID: <bug-28086-4717-sTalvtrSfZ@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-28086-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=28086 --- Comment #4 from Simon Marchi <simark at simark dot ca> --- I didn't manage to reproduce: # of expected passes 7 At frame 42, we have the new_thread observable being fired, because a new thread is being added. When the new_thread observable, I don't think there is any guarantee about the global context, value of inferior_ptid and all. btrace_compute_ftrace_bts at frame 32 is the last frame where we know the thread we are working on. It then calls gdb_insn_length which eventually calls target_read. So from gdb_insn_length and on, inferior_ptid and the rest of the global context should be set appropriately. I think that btrace_compute_ftrace_bts should set and restore the current thread (ideally, it should pass down the thread, but that's for another day). Here's an untested patch (well, I tested it, the test still passes for me, but I don't know if it fixes your regression): diff --git a/gdb/btrace.c b/gdb/btrace.c index 5e689c11d4bd..93e7bc438a7e 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -1104,6 +1104,11 @@ btrace_compute_ftrace_bts (struct thread_info *tp, size = 0; try { + /* gdb_insn_length will need to read memory from TP, which may + not be the current thread on entryt. Make sure it is. */ + scoped_restore_current_thread restore_thread; + switch_to_thread (tp); + size = gdb_insn_length (gdbarch, pc); } catch (const gdb_exception_error &error) -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2021-07-14 14:41 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-14 7:12 [Bug record/28086] New: " vries at gcc dot gnu.org 2021-07-14 7:12 ` [Bug record/28086] " vries at gcc dot gnu.org 2021-07-14 7:14 ` vries at gcc dot gnu.org 2021-07-14 7:19 ` vries at gcc dot gnu.org 2021-07-14 9:33 ` vries at gcc dot gnu.org 2021-07-14 14:41 ` simark at simark dot ca [this message] 2021-07-14 15:13 ` vries at gcc dot gnu.org 2021-07-14 15:14 ` simark at simark dot ca 2021-07-14 15:30 ` simark at simark dot ca 2021-07-14 15:34 ` vries at gcc dot gnu.org 2021-07-19 13:45 ` cvs-commit at gcc dot gnu.org 2021-07-19 13:45 ` simark at simark dot ca 2021-10-12 9:41 ` vries at gcc dot gnu.org
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-28086-4717-sTalvtrSfZ@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).