From: Kamil Rytarowski <n54@gmx.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Correct logical error in NetBSD's read_memory and write_memory
Date: Wed, 7 Oct 2020 15:24:11 +0200 [thread overview]
Message-ID: <20201007132410.5068-1-n54@gmx.com> (raw)
In case of repeated ptrace PT_IO call and returning the value of
transferred bytes equal to 0, do not return without setting
xfered_len.
Merging as obvious and hot fix.
gdb/ChangeLog:
* nat/netbsd-nat.c (write_memory, read_memory): Update.
---
gdb/ChangeLog | 4 ++++
gdb/nat/netbsd-nat.c | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4dc729c69bc..300bf139b7f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2020-10-07 Kamil Rytarowski <n54@gmx.com>
+
+ * nat/netbsd-nat.c (write_memory, read_memory): Update.
+
2020-10-07 Kamil Rytarowski <n54@gmx.com>
* nat/netbsd-nat.c (write_memory, read_memory): Add.
diff --git a/gdb/nat/netbsd-nat.c b/gdb/nat/netbsd-nat.c
index cae9cc2fc2c..e0b61cd4b24 100644
--- a/gdb/nat/netbsd-nat.c
+++ b/gdb/nat/netbsd-nat.c
@@ -238,7 +238,7 @@ write_memory (pid_t pid, unsigned const char *writebuf, CORE_ADDR offset,
return errno;
}
if (io.piod_len == 0)
- return 0;
+ break;
bytes_written += io.piod_len;
io.piod_len = len - bytes_written;
@@ -276,7 +276,7 @@ read_memory (pid_t pid, unsigned char *readbuf, CORE_ADDR offset,
if (rv == -1)
return errno;
if (io.piod_len == 0)
- return 0;
+ break;
bytes_read += io.piod_len;
io.piod_len = len - bytes_read;
--
2.28.0
reply other threads:[~2020-10-07 13:25 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=20201007132410.5068-1-n54@gmx.com \
--to=n54@gmx.com \
--cc=gdb-patches@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).