mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-18 12:24:38 +08:00
* Makefile.in: Add dependencies for remote-fileio.o.
* remote-fileio.c: New file implementing the remote File-I/O protocol. * remote-fileio.h: New header file defining remote File-I/O interface. * remote.c (remote_write_bytes, remote_read_bytes): Remove static storage class. (remote_wait, remote_async_wait): Call remote_fileio_request() on 'F' packet. (_initialize_remote): Call initialize_remote_fileio(). * remote.h: Declare remote_write_bytes() and remote_read_bytes(). * Makefile.in (REMOTE_OBS): Add remote-fileio.o (SFILES): Add remote-fileio.c. Add dependencies for building remote-fileio.o. Add remote-fileio.h to dependencies for building remote.o. * defs.h: Declare gdb_stdin, gdb_stdtargerr and gdb_stdtargin. * main.c: New ui_file gdb_stdin, gdb_stdtargerr and gdb_stdtargin. (captured_main): Initialize new ui_files. * ui-file.c: Add read and fgets input functions. (ui_file_new): set ui_file_fputs and ui_file_read to null functions. (null_file_read): New function. (ui_file_read): New function. (set_ui_file_read): New function. (stdio_file_read): New function. * ui-file.h: New type ui_file_read_ftype. (set_ui_file_read): Declare. (ui_file_read): Declare.
This commit is contained in:
parent
430329a943
commit
449092f6f4
@ -1,3 +1,34 @@
|
||||
2003-06-10 Corinna Vinschen <vinschen@redhat.com>
|
||||
|
||||
* Makefile.in: Add dependencies for remote-fileio.o.
|
||||
* remote-fileio.c: New file implementing the remote File-I/O protocol.
|
||||
* remote-fileio.h: New header file defining remote File-I/O interface.
|
||||
* remote.c (remote_write_bytes, remote_read_bytes): Remove
|
||||
static storage class.
|
||||
(remote_wait, remote_async_wait): Call remote_fileio_request() on
|
||||
'F' packet.
|
||||
(_initialize_remote): Call initialize_remote_fileio().
|
||||
* remote.h: Declare remote_write_bytes() and remote_read_bytes().
|
||||
|
||||
2003-06-10 Martin M. Hunt <hunt@redhat.com>
|
||||
|
||||
* Makefile.in (REMOTE_OBS): Add remote-fileio.o
|
||||
(SFILES): Add remote-fileio.c.
|
||||
Add dependencies for building remote-fileio.o. Add remote-fileio.h to
|
||||
dependencies for building remote.o.
|
||||
* defs.h: Declare gdb_stdin, gdb_stdtargerr and gdb_stdtargin.
|
||||
* main.c: New ui_file gdb_stdin, gdb_stdtargerr and gdb_stdtargin.
|
||||
(captured_main): Initialize new ui_files.
|
||||
* ui-file.c: Add read and fgets input functions.
|
||||
(ui_file_new): set ui_file_fputs and ui_file_read to null functions.
|
||||
(null_file_read): New function.
|
||||
(ui_file_read): New function.
|
||||
(set_ui_file_read): New function.
|
||||
(stdio_file_read): New function.
|
||||
* ui-file.h: New type ui_file_read_ftype.
|
||||
(set_ui_file_read): Declare.
|
||||
(ui_file_read): Declare.
|
||||
|
||||
2003-06-09 Andrew Cagney <cagney@redhat.com>
|
||||
|
||||
* frame.h (deprecated_unwind_get_saved_register): Rename
|
||||
|
@ -400,7 +400,7 @@ SER_HARDWIRE = @SER_HARDWIRE@
|
||||
|
||||
# The `remote' debugging target is supported for most architectures,
|
||||
# but not all (e.g. 960)
|
||||
REMOTE_OBS = remote.o dcache.o remote-utils.o tracepoint.o ax-general.o ax-gdb.o
|
||||
REMOTE_OBS = remote.o dcache.o remote-utils.o tracepoint.o ax-general.o ax-gdb.o remote-fileio.o
|
||||
|
||||
# This is remote-sim.o if a simulator is to be linked in.
|
||||
SIM_OBS =
|
||||
@ -535,7 +535,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
|
||||
objc-exp.y objc-lang.c \
|
||||
objfiles.c osabi.c observer.c \
|
||||
p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c printcmd.c \
|
||||
regcache.c reggroups.c remote.c \
|
||||
regcache.c reggroups.c remote.c remote-fileio.c \
|
||||
scm-exp.c scm-lang.c scm-valprint.c \
|
||||
sentinel-frame.c \
|
||||
serial.c ser-unix.c source.c \
|
||||
@ -710,6 +710,7 @@ regcache_h = regcache.h
|
||||
reggroups_h = reggroups.h
|
||||
remote_utils_h = remote-utils.h $(target_h)
|
||||
remote_h = remote.h
|
||||
remote_fileio_h = remote_fileio.h
|
||||
scm_lang_h = scm-lang.h $(scm_tags_h)
|
||||
scm_tags_h = scm-tags.h
|
||||
sentinel_frame_h = sentinel-frame.h
|
||||
@ -2153,7 +2154,8 @@ remote.o: remote.c $(defs_h) $(gdb_string_h) $(inferior_h) $(bfd_h) \
|
||||
$(symfile_h) $(target_h) $(gdbcmd_h) $(objfiles_h) $(gdb_stabs_h) \
|
||||
$(gdbthread_h) $(remote_h) $(regcache_h) $(value_h) $(gdb_assert_h) \
|
||||
$(event_loop_h) $(event_top_h) $(inf_loop_h) $(serial_h) \
|
||||
$(gdbcore_h) $(solib_h)
|
||||
$(gdbcore_h) $(solib_h) $(remote-fileio_h)
|
||||
remote-fileio.o: remote-fileio.c $(defs_h) $(gdb_string_h) $(gdbcmd_h) $(remote_h)
|
||||
rom68k-rom.o: rom68k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
|
||||
$(serial_h) $(regcache_h) $(value_h) $(m68k_tdep_h)
|
||||
rs6000-nat.o: rs6000-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
|
||||
|
@ -405,6 +405,8 @@ extern void reinitialize_more_filter (void);
|
||||
|
||||
/* Normal results */
|
||||
extern struct ui_file *gdb_stdout;
|
||||
/* Input stream */
|
||||
extern struct ui_file *gdb_stdin;
|
||||
/* Serious error notifications */
|
||||
extern struct ui_file *gdb_stderr;
|
||||
/* Log/debug/trace messages that should bypass normal stdout/stderr
|
||||
@ -417,6 +419,8 @@ extern struct ui_file *gdb_stdlog;
|
||||
very near future that restriction shall be removed - either call
|
||||
shall be unfiltered. (cagney 1999-07-02). */
|
||||
extern struct ui_file *gdb_stdtarg;
|
||||
extern struct ui_file *gdb_stdtargerr;
|
||||
extern struct ui_file *gdb_stdtargin;
|
||||
|
||||
#if defined(TUI)
|
||||
#include "tui.h"
|
||||
|
@ -73,6 +73,10 @@ struct ui_file *gdb_stdout;
|
||||
struct ui_file *gdb_stderr;
|
||||
struct ui_file *gdb_stdlog;
|
||||
struct ui_file *gdb_stdtarg;
|
||||
struct ui_file *gdb_stdin;
|
||||
/* target IO streams */
|
||||
struct ui_file *gdb_stdtargin;
|
||||
struct ui_file *gdb_stdtargerr;
|
||||
|
||||
/* Whether to enable writing into executable and core files */
|
||||
extern int write_files;
|
||||
@ -193,6 +197,9 @@ captured_main (void *data)
|
||||
gdb_stderr = stdio_fileopen (stderr);
|
||||
gdb_stdlog = gdb_stderr; /* for moment */
|
||||
gdb_stdtarg = gdb_stderr; /* for moment */
|
||||
gdb_stdin = stdio_fileopen (stdin);
|
||||
gdb_stdtargerr = gdb_stderr; /* for moment */
|
||||
gdb_stdtargin = gdb_stdin; /* for moment */
|
||||
|
||||
/* initialize error() */
|
||||
error_init ();
|
||||
|
1377
gdb/remote-fileio.c
Normal file
1377
gdb/remote-fileio.c
Normal file
File diff suppressed because it is too large
Load Diff
36
gdb/remote-fileio.h
Normal file
36
gdb/remote-fileio.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* Remote File-I/O communications
|
||||
|
||||
Copyright 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* See the GDB User Guide for details of the GDB remote protocol. */
|
||||
|
||||
#ifndef FILEIO_H
|
||||
#define FILEIO_H
|
||||
|
||||
/* Unified interface to remote fileio, called in remote.c from
|
||||
remote_wait () and remote_async_wait () */
|
||||
extern void remote_fileio_request (char *buf);
|
||||
|
||||
/* Called from _initialize_remote () */
|
||||
extern void initialize_remote_fileio (
|
||||
struct cmd_list_element *remote_set_cmdlist,
|
||||
struct cmd_list_element *remote_show_cmdlist);
|
||||
|
||||
#endif
|
19
gdb/remote.c
19
gdb/remote.c
@ -55,6 +55,8 @@
|
||||
|
||||
#include "gdbcore.h" /* for exec_bfd */
|
||||
|
||||
#include "remote-fileio.h"
|
||||
|
||||
/* Prototypes for local functions */
|
||||
static void cleanup_sigint_signal_handler (void *dummy);
|
||||
static void initialize_sigint_signal_handler (void);
|
||||
@ -67,10 +69,6 @@ void async_remote_interrupt_twice (gdb_client_data);
|
||||
|
||||
static void build_remote_gdbarch_data (void);
|
||||
|
||||
static int remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len);
|
||||
|
||||
static int remote_read_bytes (CORE_ADDR memaddr, char *myaddr, int len);
|
||||
|
||||
static void remote_files_info (struct target_ops *ignore);
|
||||
|
||||
static int remote_xfer_memory (CORE_ADDR memaddr, char *myaddr,
|
||||
@ -2953,6 +2951,9 @@ remote_wait (ptid_t ptid, struct target_waitstatus *status)
|
||||
case 'E': /* Error of some sort */
|
||||
warning ("Remote failure reply: %s", buf);
|
||||
continue;
|
||||
case 'F': /* File-I/O request */
|
||||
remote_fileio_request (buf);
|
||||
continue;
|
||||
case 'T': /* Status with PC, SP, FP, ... */
|
||||
{
|
||||
int i;
|
||||
@ -3204,6 +3205,9 @@ remote_async_wait (ptid_t ptid, struct target_waitstatus *status)
|
||||
case 'E': /* Error of some sort */
|
||||
warning ("Remote failure reply: %s", buf);
|
||||
continue;
|
||||
case 'F': /* File-I/O request */
|
||||
remote_fileio_request (buf);
|
||||
continue;
|
||||
case 'T': /* Status with PC, SP, FP, ... */
|
||||
{
|
||||
int i;
|
||||
@ -3758,7 +3762,7 @@ check_binary_download (CORE_ADDR addr)
|
||||
Returns number of bytes transferred, or 0 (setting errno) for
|
||||
error. Only transfer a single packet. */
|
||||
|
||||
static int
|
||||
int
|
||||
remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
|
||||
{
|
||||
unsigned char *buf;
|
||||
@ -3902,7 +3906,7 @@ remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
|
||||
caller and its callers caller ;-) already contains code for
|
||||
handling partial reads. */
|
||||
|
||||
static int
|
||||
int
|
||||
remote_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
|
||||
{
|
||||
char *buf;
|
||||
@ -6276,4 +6280,7 @@ Set use of remote protocol `Z' packets",
|
||||
set_remote_protocol_Z_packet_cmd,
|
||||
show_remote_protocol_Z_packet_cmd,
|
||||
&remote_set_cmdlist, &remote_show_cmdlist);
|
||||
|
||||
/* Eventually initialize fileio. See fileio.c */
|
||||
initialize_remote_fileio (remote_set_cmdlist, remote_show_cmdlist);
|
||||
}
|
||||
|
@ -54,6 +54,10 @@ extern void remote_cisco_objfile_relocate (bfd_signed_vma text_off,
|
||||
|
||||
extern void async_remote_interrupt_twice (void *arg);
|
||||
|
||||
extern int remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len);
|
||||
|
||||
extern int remote_read_bytes (CORE_ADDR memaddr, char *myaddr, int len);
|
||||
|
||||
extern void (*target_resume_hook) (void);
|
||||
extern void (*target_wait_loop_hook) (void);
|
||||
|
||||
|
@ -25,9 +25,12 @@
|
||||
#include "ui-file.h"
|
||||
#include "gdb_string.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
static ui_file_isatty_ftype null_file_isatty;
|
||||
static ui_file_write_ftype null_file_write;
|
||||
static ui_file_fputs_ftype null_file_fputs;
|
||||
static ui_file_read_ftype null_file_read;
|
||||
static ui_file_flush_ftype null_file_flush;
|
||||
static ui_file_delete_ftype null_file_delete;
|
||||
static ui_file_rewind_ftype null_file_rewind;
|
||||
@ -39,6 +42,7 @@ struct ui_file
|
||||
ui_file_flush_ftype *to_flush;
|
||||
ui_file_write_ftype *to_write;
|
||||
ui_file_fputs_ftype *to_fputs;
|
||||
ui_file_read_ftype *to_read;
|
||||
ui_file_delete_ftype *to_delete;
|
||||
ui_file_isatty_ftype *to_isatty;
|
||||
ui_file_rewind_ftype *to_rewind;
|
||||
@ -56,6 +60,7 @@ ui_file_new (void)
|
||||
set_ui_file_flush (file, null_file_flush);
|
||||
set_ui_file_write (file, null_file_write);
|
||||
set_ui_file_fputs (file, null_file_fputs);
|
||||
set_ui_file_read (file, null_file_read);
|
||||
set_ui_file_isatty (file, null_file_isatty);
|
||||
set_ui_file_rewind (file, null_file_rewind);
|
||||
set_ui_file_put (file, null_file_put);
|
||||
@ -123,6 +128,15 @@ null_file_write (struct ui_file *file,
|
||||
}
|
||||
}
|
||||
|
||||
static long
|
||||
null_file_read (struct ui_file *file,
|
||||
char *buf,
|
||||
long sizeof_buf)
|
||||
{
|
||||
errno = EBADF;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
null_file_fputs (const char *buf, struct ui_file *file)
|
||||
{
|
||||
@ -186,6 +200,12 @@ ui_file_write (struct ui_file *file,
|
||||
file->to_write (file, buf, length_buf);
|
||||
}
|
||||
|
||||
long
|
||||
ui_file_read (struct ui_file *file, char *buf, long length_buf)
|
||||
{
|
||||
return file->to_read (file, buf, length_buf);
|
||||
}
|
||||
|
||||
void
|
||||
fputs_unfiltered (const char *buf, struct ui_file *file)
|
||||
{
|
||||
@ -223,6 +243,12 @@ set_ui_file_write (struct ui_file *file,
|
||||
file->to_write = write;
|
||||
}
|
||||
|
||||
void
|
||||
set_ui_file_read (struct ui_file *file, ui_file_read_ftype *read)
|
||||
{
|
||||
file->to_read = read;
|
||||
}
|
||||
|
||||
void
|
||||
set_ui_file_fputs (struct ui_file *file, ui_file_fputs_ftype *fputs)
|
||||
{
|
||||
@ -383,6 +409,7 @@ mem_file_write (struct ui_file *file,
|
||||
|
||||
static ui_file_write_ftype stdio_file_write;
|
||||
static ui_file_fputs_ftype stdio_file_fputs;
|
||||
static ui_file_read_ftype stdio_file_read;
|
||||
static ui_file_isatty_ftype stdio_file_isatty;
|
||||
static ui_file_delete_ftype stdio_file_delete;
|
||||
static struct ui_file *stdio_file_new (FILE * file, int close_p);
|
||||
@ -409,6 +436,7 @@ stdio_file_new (FILE *file, int close_p)
|
||||
set_ui_file_flush (ui_file, stdio_file_flush);
|
||||
set_ui_file_write (ui_file, stdio_file_write);
|
||||
set_ui_file_fputs (ui_file, stdio_file_fputs);
|
||||
set_ui_file_read (ui_file, stdio_file_read);
|
||||
set_ui_file_isatty (ui_file, stdio_file_isatty);
|
||||
return ui_file;
|
||||
}
|
||||
@ -437,6 +465,16 @@ stdio_file_flush (struct ui_file *file)
|
||||
fflush (stdio->file);
|
||||
}
|
||||
|
||||
static long
|
||||
stdio_file_read (struct ui_file *file, char *buf, long length_buf)
|
||||
{
|
||||
struct stdio_file *stdio = ui_file_data (file);
|
||||
if (stdio->magic != &stdio_file_magic)
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"stdio_file_read: bad magic number");
|
||||
return read (fileno (stdio->file), buf, length_buf);
|
||||
}
|
||||
|
||||
static void
|
||||
stdio_file_write (struct ui_file *file, const char *buf, long length_buf)
|
||||
{
|
||||
|
@ -41,6 +41,9 @@ extern void set_ui_file_write (struct ui_file *stream, ui_file_write_ftype *fput
|
||||
typedef void (ui_file_fputs_ftype) (const char *, struct ui_file * stream);
|
||||
extern void set_ui_file_fputs (struct ui_file *stream, ui_file_fputs_ftype * fputs);
|
||||
|
||||
typedef long (ui_file_read_ftype) (struct ui_file * stream, char *buf, long length_buf);
|
||||
extern void set_ui_file_read (struct ui_file *stream, ui_file_read_ftype *fread);
|
||||
|
||||
typedef int (ui_file_isatty_ftype) (struct ui_file * stream);
|
||||
extern void set_ui_file_isatty (struct ui_file *stream, ui_file_isatty_ftype * isatty);
|
||||
|
||||
@ -78,6 +81,8 @@ extern char *ui_file_xstrdup (struct ui_file *file, long *length);
|
||||
|
||||
|
||||
|
||||
extern long ui_file_read (struct ui_file *file, char *buf, long length_buf);
|
||||
|
||||
/* Create/open a memory based file. Can be used as a scratch buffer
|
||||
for collecting output. */
|
||||
extern struct ui_file *mem_fileopen (void);
|
||||
|
Loading…
Reference in New Issue
Block a user