aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-12-16 21:50:05 +0000
committerDaniel Jacobowitz <drow@false.org>2007-12-16 21:50:05 +0000
commit4e799345942e3d777a2639a00892b67d084204c5 (patch)
treeb6014f5c354d47a513c01b20881b92c31490e414 /gdb/gdbserver
parentc244f7a6ffdc6e369f271b3a2284a6e364a1cb0b (diff)
downloadgdb-4e799345942e3d777a2639a00892b67d084204c5.zip
gdb-4e799345942e3d777a2639a00892b67d084204c5.tar.gz
gdb-4e799345942e3d777a2639a00892b67d084204c5.tar.bz2
* configure.ac: Check for pread and pwrite.
* hostio.c (handle_pread): Fall back to lseek and read. (handle_pwrite): Fall back to lseek and write. * config.in, configure: Regenerated.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog7
-rw-r--r--gdb/gdbserver/config.in6
-rwxr-xr-xgdb/gdbserver/configure4
-rw-r--r--gdb/gdbserver/configure.ac2
-rw-r--r--gdb/gdbserver/hostio.c12
5 files changed, 29 insertions, 2 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 50d8f1a..10bf1d0 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,10 @@
+2007-12-16 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * configure.ac: Check for pread and pwrite.
+ * hostio.c (handle_pread): Fall back to lseek and read.
+ (handle_pwrite): Fall back to lseek and write.
+ * config.in, configure: Regenerated.
+
2007-12-07 Daniel Jacobowitz <dan@codesourcery.com>
* server.c (myresume): Add own_buf argument.
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index 017a1ed..c666ab2 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -53,6 +53,9 @@
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H
+/* Define to 1 if you have the `pread' function. */
+#undef HAVE_PREAD
+
/* Define to 1 if you have the `pread64' function. */
#undef HAVE_PREAD64
@@ -72,6 +75,9 @@
/* Define if the target supports PTRACE_GETREGS for register access. */
#undef HAVE_PTRACE_GETREGS
+/* Define to 1 if you have the `pwrite' function. */
+#undef HAVE_PWRITE
+
/* Define to 1 if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 0b5ed9d..b8b2879 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -3099,7 +3099,9 @@ fi
done
-for ac_func in pread64
+
+
+for ac_func in pread pwrite pread64
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 4e94f31..819fead 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -41,7 +41,7 @@ AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
errno.h fcntl.h signal.h sys/file.h malloc.h dnl
sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
netinet/tcp.h arpa/inet.h sys/wait.h)
-AC_CHECK_FUNCS(pread64)
+AC_CHECK_FUNCS(pread pwrite pread64)
have_errno=no
AC_MSG_CHECKING(for errno)
diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c
index f646e85..757a229 100644
--- a/gdb/gdbserver/hostio.c
+++ b/gdb/gdbserver/hostio.c
@@ -377,7 +377,13 @@ handle_pread (char *own_buf, int *new_packet_len)
}
data = malloc (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);
+#endif
if (ret == -1)
{
@@ -419,7 +425,13 @@ handle_pwrite (char *own_buf, int packet_len)
return;
}
+#ifdef HAVE_PWRITE
ret = pwrite (fd, data, len, offset);
+#else
+ ret = lseek (fd, offset, SEEK_SET);
+ if (ret != -1)
+ ret = write (fd, data, len);
+#endif
if (ret == -1)
{