GDB (xrefs)
Loading...
Searching...
No Matches
Macros | Functions | Variables
remote-fileio.c File Reference
#include "defs.h"
#include "gdbcmd.h"
#include "remote.h"
#include "gdbsupport/gdb_wait.h"
#include <sys/stat.h>
#include "remote-fileio.h"
#include "gdbsupport/event-loop.h"
#include "target.h"
#include "filenames.h"
#include "gdbsupport/filestuff.h"
#include <fcntl.h>
#include "gdbsupport/gdb_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_quit_handler (void)
 
static void remote_fileio_reply (remote_target *remote, int retcode, int error)
 
static void remote_fileio_ioerror (remote_target *remote)
 
static void remote_fileio_badfd (remote_target *remote)
 
static void remote_fileio_return_errno (remote_target *remote, int retcode)
 
static void remote_fileio_return_success (remote_target *remote, int retcode)
 
static void remote_fileio_func_open (remote_target *remote, char *buf)
 
static void remote_fileio_func_close (remote_target *remote, char *buf)
 
static void remote_fileio_func_read (remote_target *remote, char *buf)
 
static void remote_fileio_func_write (remote_target *remote, char *buf)
 
static void remote_fileio_func_lseek (remote_target *remote, char *buf)
 
static void remote_fileio_func_rename (remote_target *remote, char *buf)
 
static void remote_fileio_func_unlink (remote_target *remote, char *buf)
 
static void remote_fileio_func_stat (remote_target *remote, char *buf)
 
static void remote_fileio_func_fstat (remote_target *remote, char *buf)
 
static void remote_fileio_func_gettimeofday (remote_target *remote, char *buf)
 
static void remote_fileio_func_isatty (remote_target *remote, char *buf)
 
static void remote_fileio_func_system (remote_target *remote, char *buf)
 
static void do_remote_fileio_request (remote_target *remote, char *buf)
 
void remote_fileio_reset (void)
 
void remote_fileio_request (remote_target *remote, 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 (const char *args, int from_tty)
 
static void show_system_call_allowed (const 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 quit_handler_ftyperemote_fileio_o_quit_handler
 
struct { 
 
   const char *   name 
 
   void(*   func )(remote_target *remote, char *) 
 
remote_fio_func_map [] 
 

Macro Definition Documentation

◆ FIO_FD_CONSOLE_IN

#define FIO_FD_CONSOLE_IN   -2

◆ FIO_FD_CONSOLE_OUT

#define FIO_FD_CONSOLE_OUT   -3

◆ FIO_FD_INVALID

#define FIO_FD_INVALID   -1

Function Documentation

◆ do_remote_fileio_request()

static void do_remote_fileio_request ( remote_target * remote,
char * buf )
static

◆ initialize_remote_fileio()

void initialize_remote_fileio ( struct cmd_list_element ** remote_set_cmdlist,
struct cmd_list_element ** remote_show_cmdlist )

◆ remote_fileio_badfd()

static void remote_fileio_badfd ( remote_target * remote)
static

◆ remote_fileio_close_target_fd()

static void remote_fileio_close_target_fd ( int target_fd)
static

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

References FIO_FD_INVALID, remote_fileio_init_fd_map(), and remote_fio_data.

Referenced by remote_fileio_func_close().

◆ remote_fileio_extract_int()

static int remote_fileio_extract_int ( char ** buf,
long * retint )
static

◆ remote_fileio_extract_long()

static int remote_fileio_extract_long ( char ** buf,
LONGEST * retlong )
static

◆ remote_fileio_extract_ptr_w_len()

static int remote_fileio_extract_ptr_w_len ( char ** buf,
CORE_ADDR * ptrval,
int * length )
static

◆ remote_fileio_fd_to_targetfd()

static int remote_fileio_fd_to_targetfd ( int fd)
static

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

References remote_fileio_next_free_fd(), and remote_fio_data.

Referenced by remote_fileio_func_open().

◆ remote_fileio_func_close()

static void remote_fileio_func_close ( remote_target * remote,
char * buf )
static

◆ remote_fileio_func_fstat()

static void remote_fileio_func_fstat ( remote_target * remote,
char * buf )
static

◆ remote_fileio_func_gettimeofday()

static void remote_fileio_func_gettimeofday ( remote_target * remote,
char * buf )
static

◆ remote_fileio_func_isatty()

static void remote_fileio_func_isatty ( remote_target * remote,
char * buf )
static

◆ remote_fileio_func_lseek()

static void remote_fileio_func_lseek ( remote_target * remote,
char * buf )
static

◆ remote_fileio_func_open()

static void remote_fileio_func_open ( remote_target * remote,
char * buf )
static

◆ remote_fileio_func_read()

static void remote_fileio_func_read ( remote_target * remote,
char * buf )
static

◆ remote_fileio_func_rename()

static void remote_fileio_func_rename ( remote_target * remote,
char * buf )
static

◆ remote_fileio_func_stat()

static void remote_fileio_func_stat ( remote_target * remote,
char * buf )
static

◆ remote_fileio_func_system()

static void remote_fileio_func_system ( remote_target * remote,
char * buf )
static

◆ remote_fileio_func_unlink()

static void remote_fileio_func_unlink ( remote_target * remote,
char * buf )
static

◆ remote_fileio_func_write()

static void remote_fileio_func_write ( remote_target * remote,
char * buf )
static

◆ remote_fileio_init_fd_map()

static int remote_fileio_init_fd_map ( void )
static

◆ remote_fileio_ioerror()

static void remote_fileio_ioerror ( remote_target * remote)
static

◆ remote_fileio_map_fd()

static int remote_fileio_map_fd ( int target_fd)
static

◆ remote_fileio_mode_to_host()

static mode_t remote_fileio_mode_to_host ( long mode,
int open_call )
static

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

Referenced by remote_fileio_func_open(), and remote_fileio_to_host_mode().

◆ remote_fileio_next_free_fd()

static int remote_fileio_next_free_fd ( void )
static

◆ remote_fileio_oflags_to_host()

static int remote_fileio_oflags_to_host ( long flags)
static

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

References flags, and O_BINARY.

Referenced by remote_fileio_func_open().

◆ remote_fileio_quit_handler()

static void remote_fileio_quit_handler ( void )
static

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

References check_quit_flag(), and quit().

Referenced by do_remote_fileio_request().

◆ remote_fileio_reply()

static void remote_fileio_reply ( remote_target * remote,
int retcode,
int error )
static

◆ remote_fileio_request()

void remote_fileio_request ( remote_target * remote,
char * buf,
int ctrlc_pending_p )

◆ remote_fileio_reset()

void remote_fileio_reset ( void )

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

References remote_fio_data, and xfree().

Referenced by remote_target::extended_remote_restart(), and remote_target::open_1().

◆ remote_fileio_resize_fd_map()

static int remote_fileio_resize_fd_map ( void )
static

◆ remote_fileio_return_errno()

static void remote_fileio_return_errno ( remote_target * remote,
int retcode )
static

◆ remote_fileio_return_success()

static void remote_fileio_return_success ( remote_target * remote,
int retcode )
static

◆ remote_fileio_seek_flag_to_host()

static int remote_fileio_seek_flag_to_host ( long num,
int * flag )
static

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

References SEEK_CUR, and SEEK_SET.

Referenced by remote_fileio_func_lseek().

◆ remote_fileio_to_fio_long()

static void remote_fileio_to_fio_long ( LONGEST num,
fio_long_t fnum )
static

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

Referenced by remote_fileio_to_fio_timeval().

◆ remote_fileio_to_fio_timeval()

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

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

References remote_fileio_to_fio_long().

Referenced by remote_fileio_func_gettimeofday().

◆ remote_fileio_to_host_mode()

static mode_t remote_fileio_to_host_mode ( fio_mode_t fnum)
static

◆ remote_fileio_to_host_stat()

void remote_fileio_to_host_stat ( struct fio_stat * fst,
struct stat * st )

◆ remote_fileio_to_host_time()

static time_t remote_fileio_to_host_time ( fio_time_t fnum)
static

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

References remote_fileio_to_host_uint().

Referenced by remote_fileio_to_host_stat().

◆ remote_fileio_to_host_uint()

static unsigned int remote_fileio_to_host_uint ( fio_uint_t fnum)
static

◆ remote_fileio_to_host_ulong()

static ULONGEST remote_fileio_to_host_ulong ( fio_ulong_t fnum)
static

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

References extract_unsigned_integer().

Referenced by remote_fileio_to_host_stat().

◆ set_system_call_allowed()

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

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

References remote_fio_system_call_allowed.

Referenced by initialize_remote_fileio().

◆ show_system_call_allowed()

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

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

References gdb_printf(), and remote_fio_system_call_allowed.

Referenced by initialize_remote_fileio().

Variable Documentation

◆ fd_map

int* fd_map

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

◆ fd_map_size

int fd_map_size

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

◆ func

void(* func) (remote_target *remote, char *) ( remote_target * remote,
char *  )

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

Referenced by gdb.dap.server::_check_not_running(), gdb.prompt::_prompt_object_attr(), aarch64_fbsd_sigframe_init(), aarch64_linux_sigframe_init(), aarch64_show_debug_reg_state(), ada_args_match(), add_catch_command(), add_dump_command(), add_target(), aix_sighandle_frame_cache(), all_root_varobjs(), alpha_heuristic_proc_start(), am33_linux_sigframe_cache_init(), amd64_fbsd_sigframe_init(), amd64obsd_trapframe_cache(), arm_epilogue_frame_this_id(), arm_fbsd_sigframe_init(), arm_linux_restart_syscall_init(), arm_linux_rt_sigreturn_init(), arm_linux_sigreturn_init(), arm_linux_sigtramp_cache(), arm_prologue_this_id(), armobsd_sigframe_init(), as_a_scm_t_subr(), as_a_scm_t_subr(), as_a_scm_t_subr(), as_a_scm_t_subr(), attach_or_detach(), avr_frame_this_id(), btrace_func_from_recpy_func(), completion_tracker::build_completion_result(), call_internal_function(), check_exception_resume(), cris_frame_this_id(), csky_linux_rt_sigreturn_init(), csky_linux_rt_sigreturn_init_pt_regs(), regcache::debug_print_register(), expr::op_this_operation::do_generate_ax(), windows_nat_target::do_synchronously(), eval_op_func_static_var(), expr::func_static_var_operation::evaluate(), evpy_emit_event(), evregpy_connect(), evregpy_disconnect(), execute_code(), find_frame_funname(), exec_target::find_memory_regions(), fbsd_nat_target::find_memory_regions(), nbsd_nat_target::find_memory_regions(), procfs_target::find_memory_regions(), find_memory_regions_callback(), find_objc_msgsend(), find_solib_trampoline_target(), for_each_block(), for_each_just_stopped_thread(), frv_frame_this_id(), gdbarch_find_memory_regions(), gdbscm_call_guile(), gdbscm_with_guile(), gdbscm_wrap(), get_compile_context(), get_py_iter_from_func(), hppanbsd_sigtramp_cache_init(), i386_fbsd_sigframe_init(), i386nbsd_sigtramp_cache_init(), i386obsd_trapframe_cache(), gdb.dap.startup::in_dap_thread(), gdb.dap.startup::in_gdb_thread(), info_frame_command_core(), dap_interp::init(), inline_frame_this_id(), interp_factory_register(), linux_find_memory_regions(), linux_find_memory_regions_full(), load_libcompile(), loongarch_linux_rt_sigframe_init(), m32r_frame_this_id(), m68hc11_frame_this_id(), mach_check_error(), mi_command_mi::mi_command_mi(), microblaze_linux_sighandler_cache_init(), microblaze_linux_sigtramp_cache(), mips64_fbsd_sigframe_init(), mips64obsd_sigframe_init(), mips_fbsd_sigframe_init(), mips_linux_n32n64_sigframe_init(), mips_linux_o32_sigframe_init(), mips_show_dr(), nios2_linux_rt_sigreturn_init(), objfile_find_memory_regions(), open_target(), or1k_linux_sigframe_init(), parse_exp_in_context(), ppc32_linux_sigaction_cache_init(), ppc32_linux_sighandler_cache_init(), ppc64_linux_sigaction_cache_init(), ppc64_linux_sighandler_cache_init(), ppc_linux_sigtramp_cache(), ppcfbsd_sigtramp_frame_cache(), ppcnbsd_sigtramp_cache_init(), ppcobsd_sigtramp_frame_cache(), print_frame_arg_vars(), print_frame_args(), proc_error(), proc_warn(), windows_nat_target::process_thread(), recpy_bt_func_instructions(), recpy_bt_func_level(), recpy_bt_func_next(), recpy_bt_func_prev(), recpy_bt_func_symbol(), recpy_bt_func_up(), gdb.dap.server::request(), riscv_fbsd_sigframe_init(), riscv_linux_sigframe_init(), rs6000_frame_cache(), run_on_main_thread(), s390_prologue_frame_unwind_cache(), pv_area::scan(), set_cmd_completer_handle_brkchars(), sh_linux_rt_sigreturn_init(), sh_linux_sigreturn_init(), sh_linux_sigtramp_cache(), finish_command_fsm::should_stop(), gdb.dap.server.Server::shutdown(), sparc32_linux_sigframe_init(), sparc64_linux_sigframe_init(), target_find_memory_regions(), tic6x_linux_rt_sigreturn_init(), tilegx_linux_sigframe_init(), tramp_frame_sniffer(), tramp_frame_start(), gdb.dap.typecheck::type_check(), until_next_command(), x86_show_dr(), and z80_frame_this_id().

◆ name

const char* name

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

Referenced by do_remote_fileio_request().

◆ remote_fileio_o_quit_handler

quit_handler_ftype* remote_fileio_o_quit_handler
static

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

Referenced by remote_fileio_reply(), and remote_fileio_request().

◆ [struct]

struct { ... } remote_fio_data

◆ [struct]

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

Referenced by do_remote_fileio_request().

◆ remote_fio_system_call_allowed

int remote_fio_system_call_allowed = 0
static