From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7833) id 5F6CF38356BE; Thu, 26 May 2022 08:53:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F6CF38356BE Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Lancelot SIX To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/linux-nat: xfer_memory_partial return E_IO on error X-Act-Checkin: binutils-gdb X-Git-Author: Lancelot SIX X-Git-Refname: refs/heads/master X-Git-Oldrev: bfcd7c2160fd145a9d7ff215ff28cdf5e406af5a X-Git-Newrev: 284b6bb5c639735735246c4c60c0e06427e5c449 Message-Id: <20220526085316.5F6CF38356BE@sourceware.org> Date: Thu, 26 May 2022 08:53:16 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2022 08:53:16 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D284b6bb5c639= 735735246c4c60c0e06427e5c449 commit 284b6bb5c639735735246c4c60c0e06427e5c449 Author: Lancelot SIX Date: Wed May 25 09:37:54 2022 +0100 gdb/linux-nat: xfer_memory_partial return E_IO on error =20 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. =20 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. =20 This patch makes this change. =20 Regression tested on x86_64-linux-gnu. =20 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, co= nst 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 =3D=3D 0) {