public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug threads/28065] FAIL: gdb.threads/access-mem-running-thread-exit.exp: all-stop: access mem (print global_var after writing again, inf=1, iter=354)
Date: Fri, 09 Jul 2021 13:33:30 +0000	[thread overview]
Message-ID: <bug-28065-4717-w3ZHCTTmdd@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28065-4717@http.sourceware.org/bugzilla/>

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

--- Comment #12 from Tom de Vries <vries at gcc dot gnu.org> ---
I updated the test-case to remove "set print thread-events off".

Also I moved the debug statements related to the /mem fp to a separate debug
category: lin-lwp-mem, enabled it in the test-case, and verified that the
problem still reproduced.

Changes available at
https://github.com/vries/gdb/commits/access-mem-running-thread-exit-v2 .

I got the following log:
...
[linux-nat] linux_proc_xfer_memory_partial_pid: opening
/proc/14678/task/19075/mem failed: No such file or directory (2)^M
^M
[linux-nat] linux_proc_xfer_memory_partial_pid: opened fd 13 for
/proc/14678/task/19285/mem^M
^M
[linux-nat] linux_proc_xfer_memory_partial_pid: accessing fd 13 for pid 19285
got EOF^M
^M
[linux-nat] linux_proc_xfer_memory_partial_pid: fd 13 for
/proc/14678/task/19285/mem^M
^M
[linux-nat] linux_proc_xfer_memory_partial_pid: accessing fd 13 for pid 19075
got EOF^M
^M
[linux-nat] linux_proc_xfer_memory_partial_pid: fd 13 for
/proc/14678/task/19285/mem^M
^M
Cannot access memory at address 0x601070^M
(gdb) [LWP 19287 exited]^M
...

I noticed that we get EOF twice, and the second time try for the same file.

This led me to the following:
...
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index f206b874929..14892a4ee2a 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -3907,6 +3907,7 @@ linux_proc_xfer_memory_partial_pid (ptid_t ptid,
     {
       linux_nat_debug_printf ("accessing fd %d for pid %ld got EOF\n",
                              fd, ptid.lwp ());
+      last_proc_mem_file.close ();
     }

   return ret;
...

And this fixed the failure: I managed to run the test-case for half an hour
without triggering the FAIL.

I don't understand things well enough to say whether this is a proper fix.

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

  parent reply	other threads:[~2021-07-09 13:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08  9:57 [Bug threads/28065] New: " vries at gcc dot gnu.org
2021-07-08 10:01 ` [Bug threads/28065] " vries at gcc dot gnu.org
2021-07-08 10:01 ` vries at gcc dot gnu.org
2021-07-08 10:06 ` vries at gcc dot gnu.org
2021-07-08 10:41 ` vries at gcc dot gnu.org
2021-07-08 10:41 ` vries at gcc dot gnu.org
2021-07-08 10:45 ` pedro at palves dot net
2021-07-08 11:03 ` vries at gcc dot gnu.org
2021-07-08 11:23 ` vries at gcc dot gnu.org
2021-07-08 12:06 ` pedro at palves dot net
2021-07-08 13:20 ` vries at gcc dot gnu.org
2021-07-08 13:34 ` pedro at palves dot net
2021-07-09  9:41 ` vries at gcc dot gnu.org
2021-07-09  9:44 ` vries at gcc dot gnu.org
2021-07-09 13:33 ` vries at gcc dot gnu.org [this message]
2021-07-09 16:19 ` vries at gcc dot gnu.org
2021-07-09 16:40 ` pedro at palves dot net
2021-07-09 17:11 ` pedro at palves dot net
2021-07-09 18:57 ` vries at gcc dot gnu.org
2021-07-09 19:06 ` pedro at palves dot net
2021-07-09 19:10 ` pedro at palves dot net
2021-07-09 20:32 ` pedro at palves dot net
2021-07-09 21:53 ` vries at gcc dot gnu.org
2021-07-09 22:55 ` pedro at palves dot net
2021-07-10 12:24 ` simark at simark dot ca
2021-10-05 11:27 ` vries at gcc dot gnu.org
2021-11-05 17:58 ` cvs-commit at gcc dot gnu.org
2021-11-05 18:02 ` pedro at palves dot net

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-28065-4717-w3ZHCTTmdd@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).