aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/target.c31
-rw-r--r--gdb/target.h16
2 files changed, 47 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c
index d237437..a80b133 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3199,6 +3199,14 @@ target_ops::fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno)
}
int
+target_ops::fileio_stat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno)
+{
+ *target_errno = FILEIO_ENOSYS;
+ return -1;
+}
+
+int
target_ops::fileio_close (int fd, fileio_error *target_errno)
{
*target_errno = FILEIO_ENOSYS;
@@ -3318,6 +3326,29 @@ target_fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno)
/* See target.h. */
int
+target_fileio_stat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno)
+{
+ for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
+ {
+ int ret = t->fileio_stat (inf, filename, sb, target_errno);
+
+ if (ret == -1 && *target_errno == FILEIO_ENOSYS)
+ continue;
+
+ target_debug_printf_nofunc ("target_fileio_stat (%s) = %d (%d)",
+ filename, ret,
+ ret != -1 ? 0 : *target_errno);
+ return ret;
+ }
+
+ *target_errno = FILEIO_ENOSYS;
+ return -1;
+}
+
+/* See target.h. */
+
+int
target_fileio_close (int fd, fileio_error *target_errno)
{
fileio_fh_t *fh = fileio_fd_to_fh (fd);
diff --git a/gdb/target.h b/gdb/target.h
index f1b97cf..dcf68a6 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1011,6 +1011,14 @@ struct target_ops
*TARGET_ERRNO). */
virtual int fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno);
+ /* Get information about the file FILENAME and put it in SB. Look for
+ FILENAME in the filesystem as seen by INF. If INF is NULL, use the
+ filesystem seen by the debugger (GDB or, for remote targets, the
+ remote stub). Return 0 on success, or -1 if an error occurs (and
+ set *TARGET_ERRNO). */
+ virtual int fileio_stat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno);
+
/* Close FD on the target. Return 0, or -1 if an error occurs
(and set *TARGET_ERRNO). */
virtual int fileio_close (int fd, fileio_error *target_errno);
@@ -2220,6 +2228,14 @@ extern int target_fileio_pread (int fd, gdb_byte *read_buf, int len,
extern int target_fileio_fstat (int fd, struct stat *sb,
fileio_error *target_errno);
+/* Get information about the file at FILENAME on the target and put it in
+ SB. Look in the filesystem as seen by INF. If INF is NULL, use the
+ filesystem seen by the debugger (GDB or, for remote targets, the remote
+ stub). Return 0 on success, or -1 if an error occurs (and set
+ *TARGET_ERRNO). */
+extern int target_fileio_stat (struct inferior *inf, const char *filename,
+ struct stat *sb, fileio_error *target_errno);
+
/* Close FD on the target. Return 0, or -1 if an error occurs
(and set *TARGET_ERRNO). */
extern int target_fileio_close (int fd, fileio_error *target_errno);