This is the mail archive of the
insight@sourceware.cygnus.com
mailing list for the Insight project.
Re: Ctrl-C strange behavior
- To: Will Lentz <Will_Lentz at Trimble dot COM>
- Subject: Re: Ctrl-C strange behavior
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Mon, 22 May 2000 10:56:57 -0400 (EDT)
- Cc: leonp at plris dot com, Insight <insight at sourceware dot cygnus dot com>
- References: <8B0BE50D6F9AD01185A300A0C92BF455085E62BC@US01XCH01.Trimble.COM>
Will Lentz writes:
> Hi Leon & all,
>
> Leon Pollak wrote:
> >
> > Hello, gurus.
> > Please, can somebody describe rather strange behavior of Ctrl-C that I
> have?
> > I run Insight from xterm and the program downloads to the target and
> starts to run.
> > When I press Ctrl-C in command window, press "STOP" button or try
> close Insignt -
> > nothing happens.
> > Even the windows are not redrawn and remain blank if I minimize them.
> > But when I press Ctrl-C from the xterm window, Insignt says that it
> received
> > SGINT interrupt and stops the target.
> >
Will,
I just committed the patch I posted a few days back for this
problem. Can you see if it helps?
Thanks
Elena
>
> I was having the same problem under Linux and Windows 98
> with the 2000-05-15 insight+dejagnu snapshot (connecting
> to an extended-remote target over TCP).
>
> Under Linux, I found a workaround (see the diff below).
> Under Windows, the Insight window now updates but I don't
> get a stop button. I also tried the patch about __CYGWIN32__
> on gdbtk.c, and that did not work for me.
>
> There's most probably a better way to do the workaround, but basically:
> 1- ser_unix_wait_for was getting called with a timeout=-1,
> so it hung the GUI. Now everything has a timeout.
> 2- read() was hanging when status==SERIAL_TIMEOUT. I don't
> know why I set status to 0 in this case (but it works).
>
> Will
>
> PS- Anyone have better luck with Ctrl-C and Insight in Windows?
>
> PPS-
> Here's the diff -u -p :
> --- ser-unix.c Tue Mar 28 00:24:28 2000
> +++ ser-unix2.c Tue May 16 10:36:53 2000
> @@ -875,11 +875,13 @@ ser_unix_wait_for (serial_t scb, int tim
>
> while (1)
> {
> - if (timeout >= 0)
> + if (timeout > 0)
> numfds = select (scb->fd + 1, &readfds, 0, &exceptfds, &tv);
> - else
> - numfds = select (scb->fd + 1, &readfds, 0, &exceptfds, 0);
> -
> + else {
> + tv.tv_sec = 1;
> + tv.tv_usec = 0;
> + numfds = select (scb->fd + 1, &readfds, 0, &exceptfds, &tv);
> + }
> if (numfds <= 0)
> {
> if (numfds == 0)
> @@ -936,7 +938,10 @@ do_unix_readchar (serial_t scb, int time
> if (status == SERIAL_ERROR)
> return status;
>
> - status = read (scb->fd, scb->buf, BUFSIZ);
> + if( status != SERIAL_TIMEOUT )
> + status = read (scb->fd, scb->buf, BUFSIZ);
> + else
> + status = 0;
>
> if (status <= 0)
> {
>