This is the mail archive of the
mailing list for the GDB project.
Re: gdb/remote - I/O
- To: Todd Whitesel <toddpw at best dot com>
- Subject: Re: gdb/remote - I/O
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 30 Mar 2001 12:23:48 -0500
- Cc: msalter at redhat dot com, gdb at sources dot redhat dot com
- References: <200103300709.XAA28219@shell17.ba.best.com>
Todd Whitesel wrote:
> 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.
syscall? Ah, you're thinking of UNIX :-)
> 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).
I was waiting for someone to head down that path :-)
While a ``really cool feature'' I think, like the other proposal to make
things truely bi-directional it is getting away from the current
protocol's principal objective - to be as simple as possible.
I don't think a ``syscall'' mechanism would need any protocol changes
(just a minor reimplementation of GDB's target stack ;-) I'd expect
something like a new target layer that would set a breakpoint on
syscall() and then intercept any thread-stopped event for that
breakpoint. The layer would then manipulate the target and resume it.
I think the emphasis here should be on identifying just sufficient
functionality to provide the primative console. Mark's point about the
target not having a break mechanism is the key - my original proposal
was flawed since it assume that GDB could directly interrupt the target.