From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27808 invoked by alias); 3 Jun 2003 18:31:01 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 27619 invoked from network); 3 Jun 2003 18:30:58 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.131) by sources.redhat.com with SMTP; 3 Jun 2003 18:30:58 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id E9BD52B2F for ; Tue, 3 Jun 2003 14:30:50 -0400 (EDT) Message-ID: <3EDCE95A.1060308@redhat.com> Date: Tue, 03 Jun 2003 18:31:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: Re: [RFA]: File-I/O patch References: <20021121100341.T24928@cygbert.vinschen.de> <3E68F370.4010207@redhat.com> <20030310182555.GD1193@cygbert.vinschen.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-06/txt/msg00127.txt.bz2 > On Fri, Mar 07, 2003 at 02:30:56PM -0500, Andrew Cagney wrote: > >> I think the basic file io implementation should be moved out of >> "remote.c" and into "fileio.[hc]" so that both remote.c and remote-sim.c >> can share it. > > > Ok. New ChangeLog and patch attached. I'm now looking carefully at the code and, sigh, as things stand, yes, the split isn't that simple :-( So I'm trying to figure out the easiest way of getting this current code into something nearer to the expected structure. What i was thinking of was: remote-fileio.[hc]: Would provide a target_fileio object and methods leading to something like: - struct remote_fileio; - struct remote_fileio *new_remote_fileio(); - create/initialize the fileio - remote_fileio_open(fileio, const char *name, int modes) - remote_fileio_read(fileio, CORE_ADDR addr, len) - et.al. remote.[hc]: Would be responsible for the protocol and mapping the remote requests onto relevant remote_fileio_XXX() calls. That way I could modify remote-sim to use those file I/O methods and delete the duplicated code. Unfortunatly, the current code assumes a single target (using the global remote_fio_data); and the existing remote_fileio_func_open() methods both unpack the protocol and perform the I/O operation. This makes reusing this code from remote-sim very hard. Sigh. I'm not sure what to do next, any suggestions? My best guess is if the code at least addresses the global remote_fio_data problem it avoids problems with trying to have multiple targets. The re-org needed for integrating it into remote-sim would have to come much much later (i.e., it probably wouldn't happen). Andrew > 2003-03-10 Corinna Vinschen > > * > * fileio.c: New file implementing the remote File-I/O protocol. > * 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(). > > 2002-11-21 Martin M. Hunt > > * Makefile.in (REMOTE_OBS): Add fileio.o > (SFILES): Add fileio.c. > Add dependencies for building fileio.o. Add 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. >