From: Todd Whitesel <toddpw@best.com>
To: fnasser@redhat.com (Fernando Nasser)
Cc: msalter@redhat.com, ac131313@cygnus.com, gdb@sources.redhat.com
Subject: Re: gdb/remote - I/O
Date: Thu, 29 Mar 2001 23:10:00 -0000 [thread overview]
Message-ID: <200103300709.XAA28219@shell17.ba.best.com> (raw)
In-Reply-To: <3ABFA8D1.DA0D2EAE@redhat.com>
> However, this now puts GDB in an "inferior input" state, as state that
> we did not have before). At what level will this be handled?
>
> There are several details that have to be sorted out as well, like if
> the "i" packet does not have all the input needed by the read to
> continue what should the target do? Maybe issue another "T<SIGTTIN>"
> until it gets all the data it needs. On the other extreme the user may
> have typed ahead. We can just have the stub discard those (but if we
> have echoed the characters typed on the GDB console this can be
> confusing).
I prefer the implementation where target I/O is treated like a general
syscall request, which always blocks on the host. After all, it's really
for debugging and bootstrapping, not production -- and you gain a lot of
flexibility by doing it this way.
On the target, a syscall acts just like a breakpoint except that some
extra "I'm a syscall!" information is sent up too. For example, the
syscall number and the first three argument registers, which covers
all of your basic syscalls.
The target then just sits and waits to be manipulated with register/memory
commands, and eventually gets a command sequence telling it to write the
return register and 'errno flag' register and to continue.
On the host, a target that stops on a syscall gets processed through logic
which feels somewhat like the "should we continue stepping or not?" paths
in The Code Formerly Known As WaitForInferior. The host translates the
syscall to native bit-flags and such and attempts to execute it, including
simulated I/O (you need some minimal buffering here, nothing complicated).
If the requested syscall completes immediately, great. Diddle the target
and resume it. But if it doesn't, then you put the inferior into a state
which says "blocked on I/O" that is generally equivalent to "running" but
tells the event loop to keep checking to see if the target I/O can be
completed. Presumably this involves some combination of select/poll,
non-blocking read's, interaction with GUI's, etc.
The main things to keep straight are that the target PC has to remain at
the syscall instruction itself UNTIL the syscall is completed. This allows
you to process a user-level stop request by simply dropping the syscall and
declaring the target stopped. If the target is then continued at the same
PC, the syscall is simply re-executed.
Todd Whitesel
toddpw @ best.com
next prev parent reply other threads:[~2001-03-29 23:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-23 15:36 Andrew Cagney
2001-03-29 16:27 ` Mark Salter
[not found] ` <3ABF9077.DFC22AE7@cygnus.com>
[not found] ` <200103261954.f2QJsBg15093@deneb.localdomain>
[not found] ` <3ABFA8D1.DA0D2EAE@redhat.com>
[not found] ` <3AC0C9DF.CB1BC2D9@cygnus.com>
2001-03-29 16:27 ` Fernando Nasser
2001-03-29 16:27 ` Andrew Cagney
2001-03-29 23:10 ` Todd Whitesel [this message]
2001-03-30 9:23 ` Andrew Cagney
[not found] ` <5mhf0fov3q.fsf@jtc.redback.com>
2001-03-30 9:48 ` Andrew Cagney
2001-04-06 11:28 ` Andrew Cagney
2001-04-06 11:47 ` Fernando Nasser
2001-04-06 12:56 ` J.T. Conklin
2001-04-07 16:02 ` Frank Ch. Eigler
2001-04-09 10:43 ` J.T. Conklin
2001-05-14 8:55 ` 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=200103300709.XAA28219@shell17.ba.best.com \
--to=toddpw@best.com \
--cc=ac131313@cygnus.com \
--cc=fnasser@redhat.com \
--cc=gdb@sources.redhat.com \
--cc=msalter@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