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/29762] FAIL: gdb.threads/access-mem-running-thread-exit.exp: non-stop: access mem (print global_var after writing again, inf=2, iter=1) Date: Fri, 11 Nov 2022 01:16:07 +0000 [thread overview] Message-ID: <bug-29762-4717-1JPuqnTO05@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-29762-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=29762 --- Comment #1 from Simon Marchi <simark at simark dot ca> --- > I don't really know what kind of racy problem it could be in GDB. It sounds > like a "write memory on one core, get migrated to another CPU, then read the > old value on another core" kind of problem. Of course it's absolutely not that. It turns out that with this change in the test, it reproduces pretty much every time: diff --git a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp index 7932c0a82e6..54080e5e5bc 100644 --- a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp +++ b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp @@ -172,10 +172,13 @@ proc test { non_stop } { my_gdb_test "print global_var = 555" " = 555" \ "write to global_var" + sleep 1 my_gdb_test "print global_var" " = 555" \ "print global_var after writing" + sleep 1 my_gdb_test "print global_var = 333" " = 333" \ "write to global_var again" + sleep 1 my_gdb_test "print global_var" " = 333" \ "print global_var after writing again" } By putting some printfs in gdbserver (and hacking the testsuite so it would connect to the gdbserver I started manually, so I could see its stdout), I found that we would end up writing or reading from the wrong inferior. Sometimes, it happens that prior to a memory access operation (use to implement those prints), GDB tries to set the remote general thread, but it fails because that thread has just exited (and GDB doesn't know about it). The Hg packet fails, but we don't check the response: https://gitlab.com/gnutools/binutils-gdb/-/blob/cde010e1a866e67b7e895cbcb95dedd3de0a1e56/gdb/remote.c#L2914 So GDB proceeds with the memory operation with the previous remote general thread still set, which belongs to the other inferior. -- You are receiving this mail because: You are on the CC list for the bug.
prev parent reply other threads:[~2022-11-11 1:16 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-09 2:15 [Bug gdb/29762] New: " simark at simark dot ca 2022-11-11 1:16 ` simark at simark dot ca [this message]
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-29762-4717-1JPuqnTO05@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).