aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog28
-rw-r--r--gdb/Makefile.in10
-rw-r--r--gdb/common/fileio.c (renamed from gdb/common/common-remote-fileio.c)55
-rw-r--r--gdb/common/fileio.h (renamed from gdb/common/common-remote-fileio.h)32
-rw-r--r--gdb/gdbserver/Makefile.in6
-rw-r--r--gdb/gdbserver/hostio-errno.c4
-rw-r--r--gdb/gdbserver/hostio.c4
-rw-r--r--gdb/inf-child.c16
-rw-r--r--gdb/remote-fileio.c14
-rw-r--r--gdb/remote-fileio.h2
10 files changed, 98 insertions, 73 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8519fea..777dfa5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,31 @@
+2015-04-09 Gary Benson <gbenson@redhat.com>
+
+ * common/common-remote-fileio.h: Rename to...
+ * common/fileio.h: ...this. Update all references.
+ (remote_fileio_to_fio_error): Rename to...
+ (host_to_fileio_error): ...this.
+ (remote_fileio_to_be): Rename to...
+ (host_to_bigendian): ...this. Update all callers.
+ (remote_fileio_to_fio_uint): Rename to...
+ (host_to_fileio_uint): ...this. Update all callers.
+ (remote_fileio_to_fio_time): Rename to...
+ (host_to_fileio_time): ...this. Update all callers.
+ (remote_fileio_to_fio_stat): Rename to...
+ (host_to_fileio_stat): ...this.
+ Update all references.
+ * common/common-remote-fileio.c: Rename to...
+ * common/fileio.c: ...this. Update all references.
+ (remote_fileio_to_fio_error): Rename to...
+ (host_to_fileio_error): ...this. Update all callers.
+ (remote_fileio_mode_to_target): Rename to...
+ (fileio_mode_pack): ...this. Update all callers.
+ (remote_fileio_to_fio_mode): Rename to...
+ (host_to_fileio_mode): ...this. Update all callers.
+ (remote_fileio_to_fio_ulong): Rename to...
+ (host_to_fileio_ulong): ...this. Update all callers.
+ (remote_fileio_to_fio_stat): Rename to...
+ (host_to_fileio_stat): ...this. Update all callers.
+
2015-04-09 Andy Wingo <wingo@igalia.com>
* guile/scm-frame.c (gdbscm_frame_read_register): New function.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 87645cd..95104ef 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -888,7 +888,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
common/format.c common/filestuff.c btrace.c record-btrace.c ctf.c \
target/waitstatus.c common/print-utils.c common/rsp-low.c \
common/errors.c common/common-debug.c common/common-exceptions.c \
- common/btrace-common.c common/common-remote-fileio.c \
+ common/btrace-common.c common/fileio.c \
$(SUBDIR_GCC_COMPILE_SRCS)
LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c
@@ -979,7 +979,7 @@ i386-linux-nat.h common/common-defs.h common/errors.h common/common-types.h \
common/common-debug.h common/cleanups.h common/gdb_setjmp.h \
common/common-exceptions.h target/target.h common/symbol.h \
common/common-regcache.h fbsd-tdep.h nat/linux-personality.h \
-common/common-remote-fileio.h nat/x86-linux.h nat/x86-linux-dregs.h
+common/fileio.h nat/x86-linux.h nat/x86-linux-dregs.h
# Header files that already have srcdir in them, or which are in objdir.
@@ -1079,7 +1079,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
common-utils.o buffer.o ptid.o gdb-dlfcn.o common-agent.o \
format.o registry.o btrace.o record-btrace.o waitstatus.o \
print-utils.o rsp-low.o errors.o common-debug.o debug.o \
- common-exceptions.o btrace-common.o common-remote-fileio.o \
+ common-exceptions.o btrace-common.o fileio.o \
$(SUBDIR_GCC_COMPILE_OBS)
TSOBS = inflow.o
@@ -2257,8 +2257,8 @@ btrace-common.o: ${srcdir}/common/btrace-common.c
$(COMPILE) $(srcdir)/common/btrace-common.c
$(POSTCOMPILE)
-common-remote-fileio.o: ${srcdir}/common/common-remote-fileio.c
- $(COMPILE) $(srcdir)/common/common-remote-fileio.c
+fileio.o: ${srcdir}/common/fileio.c
+ $(COMPILE) $(srcdir)/common/fileio.c
$(POSTCOMPILE)
#
# gdb/target/ dependencies
diff --git a/gdb/common/common-remote-fileio.c b/gdb/common/fileio.c
index 30c2c6b..5d3e6ae 100644
--- a/gdb/common/common-remote-fileio.c
+++ b/gdb/common/fileio.c
@@ -1,4 +1,4 @@
-/* Remote File-I/O communications
+/* File-I/O functions for GDB, the GNU debugger.
Copyright (C) 2003-2015 Free Software Foundation, Inc.
@@ -18,13 +18,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "common-defs.h"
-#include "common-remote-fileio.h"
+#include "fileio.h"
#include <sys/stat.h>
-/* See common-remote-fileio.h. */
+/* See fileio.h. */
int
-remote_fileio_to_fio_error (int error)
+host_to_fileio_error (int error)
{
switch (error)
{
@@ -77,7 +77,7 @@ remote_fileio_to_fio_error (int error)
/* Convert a host-format mode_t into a bitmask of File-I/O flags. */
static LONGEST
-remote_fileio_mode_to_target (mode_t mode)
+fileio_mode_pack (mode_t mode)
{
mode_t tmode = 0;
@@ -121,52 +121,51 @@ remote_fileio_mode_to_target (mode_t mode)
/* Pack a host-format mode_t into an fio_mode_t. */
static void
-remote_fileio_to_fio_mode (mode_t num, fio_mode_t fnum)
+host_to_fileio_mode (mode_t num, fio_mode_t fnum)
{
- remote_fileio_to_be (remote_fileio_mode_to_target (num),
- (char *) fnum, 4);
+ host_to_bigendian (fileio_mode_pack (num), (char *) fnum, 4);
}
/* Pack a host-format integer into an fio_ulong_t. */
static void
-remote_fileio_to_fio_ulong (LONGEST num, fio_ulong_t fnum)
+host_to_fileio_ulong (LONGEST num, fio_ulong_t fnum)
{
- remote_fileio_to_be (num, (char *) fnum, 8);
+ host_to_bigendian (num, (char *) fnum, 8);
}
-/* See common-remote-fileio.h. */
+/* See fileio.h. */
void
-remote_fileio_to_fio_stat (struct stat *st, struct fio_stat *fst)
+host_to_fileio_stat (struct stat *st, struct fio_stat *fst)
{
LONGEST blksize;
- remote_fileio_to_fio_uint ((long) st->st_dev, fst->fst_dev);
- remote_fileio_to_fio_uint ((long) st->st_ino, fst->fst_ino);
- remote_fileio_to_fio_mode (st->st_mode, fst->fst_mode);
- remote_fileio_to_fio_uint ((long) st->st_nlink, fst->fst_nlink);
- remote_fileio_to_fio_uint ((long) st->st_uid, fst->fst_uid);
- remote_fileio_to_fio_uint ((long) st->st_gid, fst->fst_gid);
- remote_fileio_to_fio_uint ((long) st->st_rdev, fst->fst_rdev);
- remote_fileio_to_fio_ulong ((LONGEST) st->st_size, fst->fst_size);
+ host_to_fileio_uint ((long) st->st_dev, fst->fst_dev);
+ host_to_fileio_uint ((long) st->st_ino, fst->fst_ino);
+ host_to_fileio_mode (st->st_mode, fst->fst_mode);
+ host_to_fileio_uint ((long) st->st_nlink, fst->fst_nlink);
+ host_to_fileio_uint ((long) st->st_uid, fst->fst_uid);
+ host_to_fileio_uint ((long) st->st_gid, fst->fst_gid);
+ host_to_fileio_uint ((long) st->st_rdev, fst->fst_rdev);
+ host_to_fileio_ulong ((LONGEST) st->st_size, fst->fst_size);
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
blksize = st->st_blksize;
#else
blksize = 512;
#endif
- remote_fileio_to_fio_ulong (blksize, fst->fst_blksize);
+ host_to_fileio_ulong (blksize, fst->fst_blksize);
#if HAVE_STRUCT_STAT_ST_BLOCKS
- remote_fileio_to_fio_ulong ((LONGEST) st->st_blocks, fst->fst_blocks);
+ host_to_fileio_ulong ((LONGEST) st->st_blocks, fst->fst_blocks);
#else
/* FIXME: This is correct for DJGPP, but other systems that don't
have st_blocks, if any, might prefer 512 instead of st_blksize.
(eliz, 30-12-2003) */
- remote_fileio_to_fio_ulong (((LONGEST) st->st_size + blksize - 1)
- / blksize,
- fst->fst_blocks);
+ host_to_fileio_ulong (((LONGEST) st->st_size + blksize - 1)
+ / blksize,
+ fst->fst_blocks);
#endif
- remote_fileio_to_fio_time (st->st_atime, fst->fst_atime);
- remote_fileio_to_fio_time (st->st_mtime, fst->fst_mtime);
- remote_fileio_to_fio_time (st->st_ctime, fst->fst_ctime);
+ host_to_fileio_time (st->st_atime, fst->fst_atime);
+ host_to_fileio_time (st->st_mtime, fst->fst_mtime);
+ host_to_fileio_time (st->st_ctime, fst->fst_ctime);
}
diff --git a/gdb/common/common-remote-fileio.h b/gdb/common/fileio.h
index 96e4aa5..69a735f 100644
--- a/gdb/common/common-remote-fileio.h
+++ b/gdb/common/fileio.h
@@ -1,4 +1,4 @@
-/* Remote File-I/O communications
+/* File-I/O functions for GDB, the GNU debugger.
Copyright (C) 2003-2015 Free Software Foundation, Inc.
@@ -17,23 +17,22 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef COMMON_REMOTE_FILEIO_H
-#define COMMON_REMOTE_FILEIO_H
+#ifndef FILEIO_H
+#define FILEIO_H
#include "gdb/fileio.h"
#include <sys/stat.h>
-/* Convert a errno error number to a File-I/O error number for
- transmission over the remote protocol. */
+/* Convert a host-format errno value to a File-I/O error number. */
-extern int remote_fileio_to_fio_error (int error);
+extern int host_to_fileio_error (int error);
-/* Pack a host-format integer into a byte buffer in big-endian format
- ready for transmission over the remote protocol. BYTES specifies
- the size of the integer to pack in bytes. */
+/* Pack a host-format integer into a byte buffer in big-endian
+ format. BYTES specifies the size of the integer to pack in
+ bytes. */
static inline void
-remote_fileio_to_be (LONGEST num, char *buf, int bytes)
+host_to_bigendian (LONGEST num, char *buf, int bytes)
{
int i;
@@ -44,22 +43,21 @@ remote_fileio_to_be (LONGEST num, char *buf, int bytes)
/* Pack a host-format integer into an fio_uint_t. */
static inline void
-remote_fileio_to_fio_uint (long num, fio_uint_t fnum)
+host_to_fileio_uint (long num, fio_uint_t fnum)
{
- remote_fileio_to_be ((LONGEST) num, (char *) fnum, 4);
+ host_to_bigendian ((LONGEST) num, (char *) fnum, 4);
}
/* Pack a host-format time_t into an fio_time_t. */
static inline void
-remote_fileio_to_fio_time (time_t num, fio_time_t fnum)
+host_to_fileio_time (time_t num, fio_time_t fnum)
{
- remote_fileio_to_be ((LONGEST) num, (char *) fnum, 4);
+ host_to_bigendian ((LONGEST) num, (char *) fnum, 4);
}
/* Pack a host-format struct stat into a struct fio_stat. */
-extern void remote_fileio_to_fio_stat (struct stat *st,
- struct fio_stat *fst);
+extern void host_to_fileio_stat (struct stat *st, struct fio_stat *fst);
-#endif /* COMMON_REMOTE_FILEIO_H */
+#endif /* FILEIO_H */
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 9d698c6..a981ee8 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -180,7 +180,7 @@ SFILES= $(srcdir)/gdbreplay.c $(srcdir)/inferiors.c $(srcdir)/dll.c \
$(srcdir)/common/common-debug.c $(srcdir)/common/cleanups.c \
$(srcdir)/common/common-exceptions.c $(srcdir)/symbol.c \
$(srcdir)/common/btrace-common.c \
- $(srcdir)/common/common-remote-fileio.c
+ $(srcdir)/common/fileio.c
DEPFILES = @GDBSERVER_DEPFILES@
@@ -194,7 +194,7 @@ OBS = agent.o ax.o inferiors.o regcache.o remote-utils.o server.o signals.o \
mem-break.o hostio.o event-loop.o tracepoint.o xml-utils.o \
common-utils.o ptid.o buffer.o format.o filestuff.o dll.o notif.o \
tdesc.o print-utils.o rsp-low.o errors.o common-debug.o cleanups.o \
- common-exceptions.o symbol.o btrace-common.o common-remote-fileio.o \
+ common-exceptions.o symbol.o btrace-common.o fileio.o \
$(XML_BUILTIN) $(DEPFILES) $(LIBOBJS)
GDBREPLAY_OBS = gdbreplay.o version.o
GDBSERVER_LIBS = @GDBSERVER_LIBS@
@@ -573,7 +573,7 @@ common-exceptions.o: ../common/common-exceptions.c
waitstatus.o: ../target/waitstatus.c
$(COMPILE) $<
$(POSTCOMPILE)
-common-remote-fileio.o: ../common/common-remote-fileio.c
+fileio.o: ../common/fileio.c
$(COMPILE) $<
$(POSTCOMPILE)
diff --git a/gdb/gdbserver/hostio-errno.c b/gdb/gdbserver/hostio-errno.c
index 01d4b32..452ec9f 100644
--- a/gdb/gdbserver/hostio-errno.c
+++ b/gdb/gdbserver/hostio-errno.c
@@ -22,12 +22,12 @@
on top of errno. */
#include "server.h"
-#include "common-remote-fileio.h"
+#include "fileio.h"
void
hostio_last_error_from_errno (char *buf)
{
int error = errno;
- int fileio_error = remote_fileio_to_fio_error (error);
+ int fileio_error = host_to_fileio_error (error);
sprintf (buf, "F-1,%x", fileio_error);
}
diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c
index aa659e2..b03b5ad 100644
--- a/gdb/gdbserver/hostio.c
+++ b/gdb/gdbserver/hostio.c
@@ -27,7 +27,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include "common-remote-fileio.h"
+#include "fileio.h"
extern int remote_debug;
@@ -438,7 +438,7 @@ handle_fstat (char *own_buf, int *new_packet_len)
return;
}
- remote_fileio_to_fio_stat (&st, &fst);
+ host_to_fileio_stat (&st, &fst);
bytes_sent = hostio_reply_with_data (own_buf,
(char *) &fst, sizeof (fst),
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index 5e5763b..713c9d4 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -30,7 +30,7 @@
#include "inferior.h"
#include <sys/stat.h>
#include "inf-child.h"
-#include "common-remote-fileio.h"
+#include "fileio.h"
#include "agent.h"
#include "gdb_wait.h"
#include "filestuff.h"
@@ -260,7 +260,7 @@ inf_child_fileio_open (struct target_ops *self,
the standard values. */
fd = gdb_open_cloexec (filename, nat_flags, mode);
if (fd == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return fd;
}
@@ -289,7 +289,7 @@ inf_child_fileio_pwrite (struct target_ops *self,
}
if (ret == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return ret;
}
@@ -318,7 +318,7 @@ inf_child_fileio_pread (struct target_ops *self,
}
if (ret == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return ret;
}
@@ -332,7 +332,7 @@ inf_child_fileio_fstat (struct target_ops *self, int fd,
ret = fstat (fd, sb);
if (ret == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return ret;
}
@@ -346,7 +346,7 @@ inf_child_fileio_close (struct target_ops *self, int fd, int *target_errno)
ret = close (fd);
if (ret == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return ret;
}
@@ -361,7 +361,7 @@ inf_child_fileio_unlink (struct target_ops *self,
ret = unlink (filename);
if (ret == -1)
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return ret;
}
@@ -383,7 +383,7 @@ inf_child_fileio_readlink (struct target_ops *self,
len = readlink (filename, buf, sizeof buf);
if (len < 0)
{
- *target_errno = remote_fileio_to_fio_error (errno);
+ *target_errno = host_to_fileio_error (errno);
return NULL;
}
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index 36c3849..a33acf9 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -290,13 +290,13 @@ remote_fileio_extract_ptr_w_len (char **buf, CORE_ADDR *ptrval, int *length)
static void
remote_fileio_to_fio_long (LONGEST num, fio_long_t fnum)
{
- remote_fileio_to_be (num, (char *) fnum, 8);
+ host_to_bigendian (num, (char *) fnum, 8);
}
static void
remote_fileio_to_fio_timeval (struct timeval *tv, struct fio_timeval *ftv)
{
- remote_fileio_to_fio_time (tv->tv_sec, ftv->ftv_sec);
+ host_to_fileio_time (tv->tv_sec, ftv->ftv_sec);
remote_fileio_to_fio_long (tv->tv_usec, ftv->ftv_usec);
}
@@ -408,7 +408,7 @@ static void
remote_fileio_return_errno (int retcode)
{
remote_fileio_reply (retcode, retcode < 0
- ? remote_fileio_to_fio_error (errno) : 0);
+ ? host_to_fileio_error (errno) : 0);
}
static void
@@ -953,8 +953,8 @@ remote_fileio_func_stat (char *buf)
}
if (statptr)
{
- remote_fileio_to_fio_stat (&st, &fst);
- remote_fileio_to_fio_uint (0, fst.fst_dev);
+ host_to_fileio_stat (&st, &fst);
+ host_to_fileio_uint (0, fst.fst_dev);
errno = target_write_memory (statptr, (gdb_byte *) &fst, sizeof fst);
if (errno != 0)
@@ -1000,7 +1000,7 @@ remote_fileio_func_fstat (char *buf)
remote_fio_no_longjmp = 1;
if (fd == FIO_FD_CONSOLE_IN || fd == FIO_FD_CONSOLE_OUT)
{
- remote_fileio_to_fio_uint (1, fst.fst_dev);
+ host_to_fileio_uint (1, fst.fst_dev);
memset (&st, 0, sizeof (st));
st.st_mode = S_IFCHR | (fd == FIO_FD_CONSOLE_IN ? S_IRUSR : S_IWUSR);
st.st_nlink = 1;
@@ -1032,7 +1032,7 @@ remote_fileio_func_fstat (char *buf)
}
if (ptrval)
{
- remote_fileio_to_fio_stat (&st, &fst);
+ host_to_fileio_stat (&st, &fst);
errno = target_write_memory (ptrval, (gdb_byte *) &fst, sizeof fst);
if (errno != 0)
diff --git a/gdb/remote-fileio.h b/gdb/remote-fileio.h
index d30ae6a..21096a0 100644
--- a/gdb/remote-fileio.h
+++ b/gdb/remote-fileio.h
@@ -22,7 +22,7 @@
#ifndef REMOTE_FILEIO_H
#define REMOTE_FILEIO_H
-#include "common-remote-fileio.h"
+#include "fileio.h"
struct cmd_list_element;