+2012-08-02 Ulrich Weigand <ulrich.weigand@linaro.org>
+
+ * inf-child.c (inf_child_fileio_pwrite): If pwrite fails, fall back
+ to attempting lseek/write.
+ (inf_child_fileio_pread): Likewise for pread.
+
2012-08-02 Yao Qi <yao@codesourcery.com>
* dwarf2loc.c (entry_values_debug): Add 'unsigned'.
+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
#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)
{
#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)
{
#ifdef HAVE_PWRITE
ret = pwrite (fd, write_buf, len, (long) offset);
#else
- ret = lseek (fd, (long) offset, SEEK_SET);
- if (ret != -1)
- ret = write (fd, write_buf, len);
+ ret = -1;
#endif
+ /* If we have no pwrite or it failed for this file, use lseek/write. */
+ if (ret == -1)
+ {
+ ret = lseek (fd, (long) offset, SEEK_SET);
+ if (ret != -1)
+ ret = write (fd, write_buf, len);
+ }
if (ret == -1)
*target_errno = inf_child_errno_to_fileio_error (errno);
#ifdef HAVE_PREAD
ret = pread (fd, read_buf, len, (long) offset);
#else
- ret = lseek (fd, (long) offset, SEEK_SET);
- if (ret != -1)
- ret = read (fd, read_buf, len);
+ ret = -1;
#endif
+ /* If we have no pread or it failed for this file, use lseek/read. */
+ if (ret == -1)
+ {
+ ret = lseek (fd, (long) offset, SEEK_SET);
+ if (ret != -1)
+ ret = read (fd, read_buf, len);
+ }
if (ret == -1)
*target_errno = inf_child_errno_to_fileio_error (errno);