Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFA]: File-I/O patch
Date: Tue, 03 Jun 2003 18:31:00 -0000	[thread overview]
Message-ID: <3EDCE95A.1060308@redhat.com> (raw)
In-Reply-To: <20030310182555.GD1193@cygbert.vinschen.de>

> 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  <vinschen@redhat.com>
> 
> 	* 
>         * 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  <hunt@redhat.com>
> 
> 	* 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.
> 



  reply	other threads:[~2003-06-03 18:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-21  1:03 Corinna Vinschen
2002-11-21 11:05 ` Andrew Cagney
2002-11-21 13:04 ` Corinna Vinschen
2003-03-07 19:31 ` Andrew Cagney
2003-03-10 18:26   ` Corinna Vinschen
2003-06-03 18:31     ` Andrew Cagney [this message]
2003-06-08 18:55       ` Andrew Cagney
2003-06-10 14:44         ` Corinna Vinschen
2003-06-10 15:51           ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EDCE95A.1060308@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox