* remote-mips.c (mips_initialize): Clear mips_initializing via
authorJim Kingdon <jkingdon@engr.sgi.com>
Sat, 22 Jan 1994 19:16:02 +0000 (19:16 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Sat, 22 Jan 1994 19:16:02 +0000 (19:16 +0000)
cleanup chain, not directly.

* ser-unix.c (wait_for) [HAVE_TERMIO, HAVE_TERMIOS]: Make a timeout
of -1 mean forever, like in the HAVE_SGTTY case.  Warn if we are
munging the timeout due to the limited range of c_cc[VTIME].

gdb/ChangeLog
gdb/remote-mips.c
gdb/ser-unix.c

index da5fe2e2406e9a0c29d70b6c1c1be26ce98ed6ab..b9de4b19ffd17486b4440ccca94f52da67539a9f 100644 (file)
@@ -1,5 +1,12 @@
 Sat Jan 22 08:30:42 1994  Jim Kingdon  (kingdon@deneb.cygnus.com)
 
+       * remote-mips.c (mips_initialize): Clear mips_initializing via
+       cleanup chain, not directly.
+
+       * ser-unix.c (wait_for) [HAVE_TERMIO, HAVE_TERMIOS]: Make a timeout
+       of -1 mean forever, like in the HAVE_SGTTY case.  Warn if we are
+       munging the timeout due to the limited range of c_cc[VTIME].
+
        * fork-child.c, inferior.h (fork_inferior): New argument shell_file.
        * procfs.c (procfs_create_inferior), inftarg.c (child_create_inferior),
        m3-nat.c (m3_create_inferior): Pass it.
index 02310b3b8723ed4fd93d11fae75800c11e8d2ff8..23e89f4a8cf27ad064cd62881576eedfbdfb4169 100644 (file)
@@ -888,6 +888,13 @@ mips_request (cmd, addr, data, perr, timeout)
   return rresponse;
 }
 
+static void
+mips_initialize_cleanups (arg)
+     PTR arg;
+{
+  mips_initializing = 0;
+}
+
 /* Initialize a new connection to the MIPS board, and make sure we are
    really connected.  */
 
@@ -897,9 +904,16 @@ mips_initialize ()
   char cr;
   char buff[DATA_MAXLEN + 1];
   int err;
+  struct cleanup *old_cleanups = make_cleanup (mips_initialize_cleanups, NULL);
 
+  /* What is this code doing here?  I don't see any way it can happen, and
+     it might mean mips_initializing didn't get cleared properly.
+     So I'll make it a warning.  */
   if (mips_initializing)
-    return;
+    {
+      warning ("internal error: mips_initialize called twice");
+      return;
+    }
 
   mips_initializing = 1;
 
@@ -929,7 +943,7 @@ mips_initialize ()
     }
   mips_receive_packet (buff, 1, 3);
 
-  mips_initializing = 0;
+  do_cleanups (old_cleanups);
 
   /* If this doesn't call error, we have connected; we don't care if
      the request itself succeeds or fails.  */
index d14a996ed5554522c6952ab0065613b068eb3719..0e490fb377f6315cd54d0b945b9015608bb0c891 100644 (file)
@@ -435,11 +435,41 @@ wait_for(scb, timeout)
       fprintf_unfiltered(gdb_stderr, "get_tty_state failed: %s\n", safe_strerror(errno));
 
 #ifdef HAVE_TERMIOS
-    state.termios.c_cc[VTIME] = timeout * 10;
+    if (timeout < 0)
+      {
+       /* No timeout.  */
+       state.termios.c_cc[VTIME] = 0;
+       state.termios.c_cc[VMIN] = 1;
+      }
+    else
+      {
+       state.termios.c_cc[VMIN] = 0;
+       state.termios.c_cc[VTIME] = timeout * 10;
+       if (state.termios.c_cc[VTIME] != timeout * 10)
+         {
+           warning ("Timeout value %d too large, using %d", timeout,
+                    state.termios.c_cc[VTIME] / 10);
+         }
+      }
 #endif
 
 #ifdef HAVE_TERMIO
-    state.termio.c_cc[VTIME] = timeout * 10;
+    if (timeout < 0)
+      {
+       /* No timeout.  */
+       state.termio.c_cc[VTIME] = 0;
+       state.termio.c_cc[VMIN] = 1;
+      }
+    else
+      {
+       state.termio.c_cc[VMIN] = 0;
+       state.termio.c_cc[VTIME] = timeout * 10;
+       if (state.termio.c_cc[VTIME] != timeout * 10)
+         {
+           warning ("Timeout value %d too large, using %d", timeout,
+                    state.termio.c_cc[VTIME] / 10);
+         }
+      }
 #endif
 
     scb->current_timeout = timeout;
This page took 0.044618 seconds and 4 git commands to generate.