summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Rytarowski <n54@gmx.com>2020-10-07 15:12:59 +0200
committerKamil Rytarowski <n54@gmx.com>2020-10-07 15:15:54 +0200
commit4641551a7a176f31ebe75bf068b4a6e3fa5a612f (patch)
tree5fd2f69d3a3ba8660a95a039aef24df65ccfc643
parent2be01f639c0983caeafdd36127ac3ef517d7a643 (diff)
downloadbinutils-gdb-4641551a7a176f31ebe75bf068b4a6e3fa5a612f.tar.gz
Correct logical error in NetBSD's read_memory and write_memory
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. gdb/ChangeLog: * nat/netbsd-nat.c (write_memory, read_memory): Update.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/nat/netbsd-nat.c4
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,5 +1,9 @@
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.
* nat/netbsd-nat.h (write_memory, read_memory): Likewise.
* nbsd-nat.c (nbsd_nat_target::xfer_partial): Update.
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;