Re: Shared screen for help with simultaneous debugging

Kumar Rangarajan <[email protected]> Tue, 17 Jun 2008 19:41:52 +0530
Newsgroups gmane.comp.gnu.screen
Message-ID <936FD173-1C80-43D1-888B-ABAABC8B09B3__22356.9563626826$1238089004$gmane$org@gmail.com>
Hi Fernando,

> Hi,
>
> You should not hit the «reply» button, when starting a new thread.

Ooops. Sorry about that.

> On Sun, Jun 15, 2008 at 10:29:27PM +0530, Kumar Rangarajan wrote:
>> My company works on doing a lot of migration related work, and we  
>> do a
>> lot of unix to unix migrations.
>
> While my attached code will not help you on exotic Unices, it  
> definitely
> works on Linux, and I believe it does on BSD.  It uses the TIOCSTI
> sysctl on the term devices.  It may trash the terminal from where you
> run it.  Just `reset`. :)

Thanks for it. It just worked. Connected two ptys to cscreen and  
things I typed under cscreen got passed onto the the two ptys.

>> Here is where I wanted to see if I could improve things. What if  
>> the two
>> screen windows ran on a 'shared keyboard' session. Ie irrespective of
>> which window I am, the key strokes typed on that window should be  
>> made
>> visible to all its 'shared' sessions. So basically if I type 'next'  
>> on
>> one debugger session, the same command should be made available to  
>> the
>> other window too.
>
>> Is there such an option already available under screen ?
>
> Not that I know of, but the command «stuff» lets you insert
> characters/strings into another window's input buffer.  I would use
> that.  You might want to look into its implementation.  Looping over a
> series of windows, and calling "stuff" for each of them, sounds like
> doable.

Will look into how I can make screen do the same too.

> Alternatively, see the attached code.  You may need to run it as root.
>
>  (on pts/5)$ ./cscreen -t /dev/pts/3 -t /dev/pts/4
>
> Whatever you type into cscreen pts/5 (yes also control characters),  
> gets
> sent to pts/3 and pts/4.  Of course if you switch to pts/3 and type
> something, only pts/3 sees it.  I've been using this across clusters,
> and whatnot.
>
> It exits on ^C, so I've never used it for gdb.  You may need to tweak
> signal handling and/or curses interaction.

I used it on gdb and it works. Havent tried anything fancy here, but  
so far regular stuff just works.  Thanks for passing this on.

>> If not, I would certainly be interested to work on this. But I am a
>> complete novice on screen development and its source base. Any  
>> pointers
>> on where I should start to understand screen and its source base  
>> and also
>> pointers for this particular enhancement would be really great.
>
> comm.c and process.c are the best candidates, IMHO.

I will play a little with screen and your program to see what else I  
can do with it.

Thanks a lot again.

:-)