public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Will Lentz <Will_Lentz@Trimble.COM>
To: leonp@plris.com
Cc: Insight <insight@sourceware.cygnus.com>
Subject: Re: Ctrl-C strange behavior
Date: Tue, 16 May 2000 11:08:00 -0000	[thread overview]
Message-ID: <8B0BE50D6F9AD01185A300A0C92BF455085E62BC@US01XCH01.Trimble.COM> (raw)

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.
> 

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)
         {

             reply	other threads:[~2000-05-16 11:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-16 11:08 Will Lentz [this message]
2000-05-22  7:58 ` Elena Zannoni
  -- strict thread matches above, loose matches on Subject: below --
2000-05-22  9:14 Will Lentz
2000-05-22  9:18 ` Elena Zannoni
2000-05-05 13:30 Scott A Sumner
2000-05-12 11:11 ` Elena Zannoni
2000-05-03 17:00 Scott A Sumner
2000-05-03 17:45 ` Chris Faylor
2000-05-04  8:58 ` Keith Seitz
2000-05-02 10:32 Leon Pollak
2000-05-04  9:10 ` Keith Seitz

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=8B0BE50D6F9AD01185A300A0C92BF455085E62BC@US01XCH01.Trimble.COM \
    --to=will_lentz@trimble.com \
    --cc=insight@sourceware.cygnus.com \
    --cc=leonp@plris.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).