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 gdb/24694] FAIL: gdb.multi/multi-arch-exec.exp: first_arch=1: selected_thread=1: follow_exec_mode=same: continue across exec that changes architecture (Couldn't get registers: No such process)
Date: Tue, 01 Dec 2020 02:57:25 +0000	[thread overview]
Message-ID: <bug-24694-4717-E7O3cUjsId@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-24694-4717@http.sourceware.org/bugzilla/>

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

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #8 from Simon Marchi <simark at simark dot ca> ---
This is due to an exec race.  We have two threads

- leader thread, doing the exec
- other thread, minding its own business

Things to remember are:

- GDB resumes threads one by one, one after the other
- When a multi-threaded program execs, regardless of which thread did the exec,
all non-leader threads disappear and it looks like the leader is now executing
the new executable.

When we do a "continue" after stopping at the all_started function, GDB tries
to resume leader first, then other.  In the failing case, leader has the time
to run its exec before GDB tries to resume the other thread.  So the ptrace
resume on the other thread fails with

  Couldn't get registers: No such process.

That aborts the resumption command and causes unexpected output, making the
test fail.

Since this particular test is not about testing this particular corner case, I
think we can avoid it by adding a synchronization point after the continue, so
the exec only happens after both threads were resumed.

But I also think we should handle the situation better.  When resuming multiple
threads and one of them fails with "no such process", we should probably print
a warning but carry on, not abort the continue.  There would be a separate test
for that (or whatever behavior we decide to have).

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

  parent reply	other threads:[~2020-12-01  2:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-24694-4717@http.sourceware.org/bugzilla/>
2020-05-17  9:10 ` vries at gcc dot gnu.org
2020-07-21 14:41 ` vries at gcc dot gnu.org
2020-12-01  2:57 ` simark at simark dot ca [this message]
2020-12-01  3:03 ` simark at simark dot ca
2020-12-01  3:42 ` simark at simark dot ca
2020-12-04 13:18 ` palves at redhat dot com
2020-12-04 17:59 ` simark at simark dot ca
2020-12-11  0:56 ` cvs-commit at gcc dot gnu.org
2020-12-11  0:57 ` simark at simark dot ca

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