aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2012-08-02 15:52:27 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2012-08-02 15:52:27 +0000
commit7c3270aec11d401689c9b9cbd6b1c9d574385526 (patch)
treea87ae8ed68bfb99d6b7931941ec021e4fe7d3e40 /gdb/gdbserver
parent399c99f739767af94870e8fde027f9f0473fad16 (diff)
downloadgdb-7c3270aec11d401689c9b9cbd6b1c9d574385526.zip
gdb-7c3270aec11d401689c9b9cbd6b1c9d574385526.tar.gz
gdb-7c3270aec11d401689c9b9cbd6b1c9d574385526.tar.bz2
ChangeLog:
* inf-child.c (inf_child_fileio_pwrite): If pwrite fails, fall back to attempting lseek/write. (inf_child_fileio_pread): Likewise for pread. gdbserver/ChangeLog: * hostio.c (handle_pread): If pread fails, fall back to attempting lseek/read. (handle_pwrite): Likewise for pwrite.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog6
-rw-r--r--gdb/gdbserver/hostio.c22
2 files changed, 22 insertions, 6 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 6a1259b..d446361 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-02 Ulrich Weigand <ulrich.weigand@linaro.org>
+
+ * hostio.c (handle_pread): If pread fails, fall back to attempting
+ lseek/read.
+ (handle_pwrite): Likewise for pwrite.
+
2012-08-01 Ulrich Weigand <ulrich.weigand@linaro.org>
* linux-arm-low.c (arm_linux_hw_point_initialize): Distinguish
diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c
index 03aab58..72e334c 100644
--- a/gdb/gdbserver/hostio.c
+++ b/gdb/gdbserver/hostio.c
@@ -328,10 +328,15 @@ handle_pread (char *own_buf, int *new_packet_len)
#ifdef HAVE_PREAD
ret = pread (fd, data, len, offset);
#else
- ret = lseek (fd, offset, SEEK_SET);
- if (ret != -1)
- ret = read (fd, data, len);
+ ret = -1;
#endif
+ /* If we have no pread or it failed for this file, use lseek/read. */
+ if (ret == -1)
+ {
+ ret = lseek (fd, offset, SEEK_SET);
+ if (ret != -1)
+ ret = read (fd, data, len);
+ }
if (ret == -1)
{
@@ -376,10 +381,15 @@ handle_pwrite (char *own_buf, int packet_len)
#ifdef HAVE_PWRITE
ret = pwrite (fd, data, len, offset);
#else
- ret = lseek (fd, offset, SEEK_SET);
- if (ret != -1)
- ret = write (fd, data, len);
+ ret = -1;
#endif
+ /* If we have no pwrite or it failed for this file, use lseek/write. */
+ if (ret == -1)
+ {
+ ret = lseek (fd, offset, SEEK_SET);
+ if (ret != -1)
+ ret = write (fd, data, len);
+ }
if (ret == -1)
{