public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Lancelot SIX <lsix@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb/linux-nat: xfer_memory_partial return E_IO on error
Date: Thu, 26 May 2022 08:53:16 +0000 (GMT)	[thread overview]
Message-ID: <20220526085316.5F6CF38356BE@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=284b6bb5c639735735246c4c60c0e06427e5c449

commit 284b6bb5c639735735246c4c60c0e06427e5c449
Author: Lancelot SIX <lancelot.six@amd.com>
Date:   Wed May 25 09:37:54 2022 +0100

    gdb/linux-nat: xfer_memory_partial return E_IO on error
    
    When accessing /proc/PID/mem, if pread64/pwrite64/read/write encounters
    an error and return -1, linux_proc_xfer_memory_partial return
    TARGET_XFER_EOF.
    
    I think it should return TARGET_XFER_E_IO in this case.  TARGET_XFER_EOF
    is returned when pread64/pwrite64/read/frite returns 0, which indicates
    that the address space is gone and the whole process has exited or
    execed.
    
    This patch makes this change.
    
    Regression tested on x86_64-linux-gnu.
    
    Change-Id: I6030412459663b8d7933483fdda22a6c2c5d7221

Diff:
---
 gdb/linux-nat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 3b5400896bc..b9164e621db 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -3917,7 +3917,7 @@ linux_proc_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
       linux_nat_debug_printf ("accessing fd %d for pid %d failed: %s (%d)",
 			      fd, inferior_ptid.pid (),
 			      safe_strerror (errno), errno);
-      return TARGET_XFER_EOF;
+      return TARGET_XFER_E_IO;
     }
   else if (ret == 0)
     {


                 reply	other threads:[~2022-05-26  8:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220526085316.5F6CF38356BE@sourceware.org \
    --to=lsix@sourceware.org \
    --cc=gdb-cvs@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).