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.
This commit is contained in:
Kamil Rytarowski
2020-10-07 15:12:59 +02:00
parent 2be01f639c
commit 4641551a7a
2 changed files with 6 additions and 2 deletions

View File

@ -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> 2020-10-07 Kamil Rytarowski <n54@gmx.com>
* nat/netbsd-nat.c (write_memory, read_memory): Add. * nat/netbsd-nat.c (write_memory, read_memory): Add.

View File

@ -238,7 +238,7 @@ write_memory (pid_t pid, unsigned const char *writebuf, CORE_ADDR offset,
return errno; return errno;
} }
if (io.piod_len == 0) if (io.piod_len == 0)
return 0; break;
bytes_written += io.piod_len; bytes_written += io.piod_len;
io.piod_len = len - bytes_written; io.piod_len = len - bytes_written;
@ -276,7 +276,7 @@ read_memory (pid_t pid, unsigned char *readbuf, CORE_ADDR offset,
if (rv == -1) if (rv == -1)
return errno; return errno;
if (io.piod_len == 0) if (io.piod_len == 0)
return 0; break;
bytes_read += io.piod_len; bytes_read += io.piod_len;
io.piod_len = len - bytes_read; io.piod_len = len - bytes_read;