From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: Todd Whitesel Cc: msalter@redhat.com, gdb@sources.redhat.com Subject: Re: gdb/remote - I/O Date: Fri, 30 Mar 2001 09:23:00 -0000 Message-id: <3AC4C124.9CF81823@cygnus.com> References: <200103300709.XAA28219@shell17.ba.best.com> X-SW-Source: 2001-03/msg00328.html 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. Andrew