GDB (xrefs)
Macros | Functions | Variables
/tmp/gdb-7.10/gdb/remote-fileio.c File Reference
#include "defs.h"
#include "gdbcmd.h"
#include "remote.h"
#include "gdb_wait.h"
#include <sys/stat.h>
#include "remote-fileio.h"
#include "event-loop.h"
#include "target.h"
#include "filenames.h"
#include "filestuff.h"
#include <fcntl.h>
#include <sys/time.h>
#include <signal.h>

Go to the source code of this file.

Macros

#define FIO_FD_INVALID   -1
 
#define FIO_FD_CONSOLE_IN   -2
 
#define FIO_FD_CONSOLE_OUT   -3
 

Functions

static int remote_fileio_init_fd_map (void)
 
static int remote_fileio_resize_fd_map (void)
 
static int remote_fileio_next_free_fd (void)
 
static int remote_fileio_fd_to_targetfd (int fd)
 
static int remote_fileio_map_fd (int target_fd)
 
static void remote_fileio_close_target_fd (int target_fd)
 
static int remote_fileio_oflags_to_host (long flags)
 
static mode_t remote_fileio_mode_to_host (long mode, int open_call)
 
static int remote_fileio_seek_flag_to_host (long num, int *flag)
 
static int remote_fileio_extract_long (char **buf, LONGEST *retlong)
 
static int remote_fileio_extract_int (char **buf, long *retint)
 
static int 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)
 
static void remote_fileio_to_fio_timeval (struct timeval *tv, struct fio_timeval *ftv)
 
static void remote_fileio_sig_init (void)
 
static void remote_fileio_sig_set (void(*sigint_func)(int))
 
static void remote_fileio_sig_exit (void)
 
static void async_remote_fileio_interrupt (gdb_client_data arg)
 
static void remote_fileio_ctrl_c_signal_handler (int signo)
 
static void remote_fileio_reply (int retcode, int error)
 
static void remote_fileio_ioerror (void)
 
static void remote_fileio_badfd (void)
 
static void remote_fileio_return_errno (int retcode)
 
static void remote_fileio_return_success (int retcode)
 
static void remote_fileio_func_open (char *buf)
 
static void remote_fileio_func_close (char *buf)
 
static void remote_fileio_func_read (char *buf)
 
static void remote_fileio_func_write (char *buf)
 
static void remote_fileio_func_lseek (char *buf)
 
static void remote_fileio_func_rename (char *buf)
 
static void remote_fileio_func_unlink (char *buf)
 
static void remote_fileio_func_stat (char *buf)
 
static void remote_fileio_func_fstat (char *buf)
 
static void remote_fileio_func_gettimeofday (char *buf)
 
static void remote_fileio_func_isatty (char *buf)
 
static void remote_fileio_func_system (char *buf)
 
static int do_remote_fileio_request (struct ui_out *uiout, void *buf_arg)
 
void remote_fileio_reset (void)
 
void remote_fileio_request (char *buf, int ctrlc_pending_p)
 
static unsigned int remote_fileio_to_host_uint (fio_uint_t fnum)
 
static ULONGEST remote_fileio_to_host_ulong (fio_ulong_t fnum)
 
static mode_t remote_fileio_to_host_mode (fio_mode_t fnum)
 
static time_t remote_fileio_to_host_time (fio_time_t fnum)
 
void remote_fileio_to_host_stat (struct fio_stat *fst, struct stat *st)
 
static void set_system_call_allowed (char *args, int from_tty)
 
static void show_system_call_allowed (char *args, int from_tty)
 
void initialize_remote_fileio (struct cmd_list_element *remote_set_cmdlist, struct cmd_list_element *remote_show_cmdlist)
 

Variables

struct {
   int *   fd_map
 
   int   fd_map_size
 
remote_fio_data
 
static int remote_fio_system_call_allowed = 0
 
static struct async_signal_handlersigint_fileio_token
 
static int remote_fio_ctrl_c_flag = 0
 
static int remote_fio_no_longjmp = 0
 
static void(* remote_fio_ofunc )(int)
 
struct {
   char *   name
 
   void(*   func )(char *)
 
remote_fio_func_map []
 

Macro Definition Documentation

#define FIO_FD_CONSOLE_IN   -2
#define FIO_FD_CONSOLE_OUT   -3
#define FIO_FD_INVALID   -1

Function Documentation

static void async_remote_fileio_interrupt ( gdb_client_data  arg)
static

Definition at line 350 of file remote-fileio.c.

References quit().

Referenced by initialize_remote_fileio().

static int do_remote_fileio_request ( struct ui_out uiout,
void *  buf_arg 
)
static
void initialize_remote_fileio ( struct cmd_list_element remote_set_cmdlist,
struct cmd_list_element remote_show_cmdlist 
)
static void remote_fileio_badfd ( void  )
static
static void remote_fileio_close_target_fd ( int  target_fd)
static

Definition at line 117 of file remote-fileio.c.

References FIO_FD_INVALID, remote_fileio_init_fd_map(), and remote_fio_data.

Referenced by remote_fileio_func_close().

static void remote_fileio_ctrl_c_signal_handler ( int  signo)
static
static int remote_fileio_extract_int ( char **  buf,
long *  retint 
)
static
static int remote_fileio_extract_long ( char **  buf,
LONGEST retlong 
)
static
static int remote_fileio_extract_ptr_w_len ( char **  buf,
CORE_ADDR ptrval,
int length 
)
static
static int remote_fileio_fd_to_targetfd ( int  fd)
static

Definition at line 99 of file remote-fileio.c.

References remote_fileio_next_free_fd(), and remote_fio_data.

Referenced by remote_fileio_func_open().

static void remote_fileio_func_close ( char *  buf)
static
static void remote_fileio_func_fstat ( char *  buf)
static
static void remote_fileio_func_gettimeofday ( char *  buf)
static
static void remote_fileio_func_isatty ( char *  buf)
static
static void remote_fileio_func_lseek ( char *  buf)
static
static void remote_fileio_func_open ( char *  buf)
static
static void remote_fileio_func_read ( char *  buf)
static
static void remote_fileio_func_rename ( char *  buf)
static
static void remote_fileio_func_stat ( char *  buf)
static
static void remote_fileio_func_system ( char *  buf)
static
static void remote_fileio_func_unlink ( char *  buf)
static
static void remote_fileio_func_write ( char *  buf)
static
static int remote_fileio_init_fd_map ( void  )
static
static void remote_fileio_ioerror ( void  )
static
static int remote_fileio_map_fd ( int  target_fd)
static
static mode_t remote_fileio_mode_to_host ( long  mode,
int  open_call 
)
static

Definition at line 152 of file remote-fileio.c.

Referenced by remote_fileio_func_open(), and remote_fileio_to_host_mode().

static int remote_fileio_next_free_fd ( void  )
static
static int remote_fileio_oflags_to_host ( long  flags)
static

Definition at line 125 of file remote-fileio.c.

References O_BINARY.

Referenced by remote_fileio_func_open().

static void remote_fileio_reply ( int  retcode,
int  error 
)
static
void remote_fileio_request ( char *  buf,
int  ctrlc_pending_p 
)
void remote_fileio_reset ( void  )

Definition at line 1211 of file remote-fileio.c.

References remote_fio_data, and xfree().

Referenced by extended_remote_restart(), and remote_open_1().

static int remote_fileio_resize_fd_map ( void  )
static
static void remote_fileio_return_errno ( int  retcode)
static
static void remote_fileio_return_success ( int  retcode)
static
static int remote_fileio_seek_flag_to_host ( long  num,
int flag 
)
static

Definition at line 197 of file remote-fileio.c.

References SEEK_CUR, and SEEK_SET.

Referenced by remote_fileio_func_lseek().

static void remote_fileio_sig_exit ( void  )
static

Definition at line 340 of file remote-fileio.c.

References remote_fio_ofunc.

Referenced by remote_fileio_request().

static void remote_fileio_sig_init ( void  )
static

Definition at line 314 of file remote-fileio.c.

References remote_fio_ofunc.

Referenced by remote_fileio_request().

static void remote_fileio_sig_set ( void(*)(int sigint_func)
static
static void remote_fileio_to_fio_long ( LONGEST  num,
fio_long_t  fnum 
)
static

Definition at line 291 of file remote-fileio.c.

References host_to_bigendian().

Referenced by remote_fileio_to_fio_timeval().

static void remote_fileio_to_fio_timeval ( struct timeval *  tv,
struct fio_timeval *  ftv 
)
static

Definition at line 297 of file remote-fileio.c.

References host_to_fileio_time(), and remote_fileio_to_fio_long().

Referenced by remote_fileio_func_gettimeofday().

static mode_t remote_fileio_to_host_mode ( fio_mode_t  fnum)
static
void remote_fileio_to_host_stat ( struct fio_stat *  fst,
struct stat *  st 
)
static time_t remote_fileio_to_host_time ( fio_time_t  fnum)
static

Definition at line 1305 of file remote-fileio.c.

References remote_fileio_to_host_uint().

Referenced by remote_fileio_to_host_stat().

static unsigned int remote_fileio_to_host_uint ( fio_uint_t  fnum)
static
static ULONGEST remote_fileio_to_host_ulong ( fio_ulong_t  fnum)
static

Definition at line 1287 of file remote-fileio.c.

References extract_unsigned_integer().

Referenced by remote_fileio_to_host_stat().

static void set_system_call_allowed ( char *  args,
int  from_tty 
)
static

Definition at line 1339 of file remote-fileio.c.

References _, error(), and remote_fio_system_call_allowed.

Referenced by initialize_remote_fileio().

static void show_system_call_allowed ( char *  args,
int  from_tty 
)
static

Definition at line 1356 of file remote-fileio.c.

References _, error(), printf_unfiltered(), and remote_fio_system_call_allowed.

Referenced by initialize_remote_fileio().

Variable Documentation

int* fd_map

Definition at line 41 of file remote-fileio.c.

int fd_map_size

Definition at line 42 of file remote-fileio.c.

void(* func) (char *)
char* name

Definition at line 1167 of file remote-fileio.c.

Referenced by do_remote_fileio_request().

int remote_fio_ctrl_c_flag = 0
static
struct { ... } remote_fio_data
struct { ... } remote_fio_func_map[]
Initial value:
= {
{ "gettimeofday", remote_fileio_func_gettimeofday },
{ NULL, NULL }
}
static void remote_fileio_func_unlink(char *buf)
static void remote_fileio_func_close(char *buf)
static void remote_fileio_func_gettimeofday(char *buf)
static void remote_fileio_func_rename(char *buf)
static void remote_fileio_func_system(char *buf)
static void remote_fileio_func_write(char *buf)
static void remote_fileio_func_lseek(char *buf)
static void remote_fileio_func_open(char *buf)
static void remote_fileio_func_read(char *buf)
static void remote_fileio_func_fstat(char *buf)
static void remote_fileio_func_stat(char *buf)
static void remote_fileio_func_isatty(char *buf)

Referenced by do_remote_fileio_request().

int remote_fio_no_longjmp = 0
static
void(* remote_fio_ofunc) (int)
static

Definition at line 310 of file remote-fileio.c.

Referenced by remote_fileio_sig_exit(), and remote_fileio_sig_init().

int remote_fio_system_call_allowed = 0
static
struct async_signal_handler* sigint_fileio_token
static

Definition at line 51 of file remote-fileio.c.