* ser-unix.c (wait_for): Do not reset timeout_remaining for cygwin32 so
authorKeith Seitz <keiths@cygnus>
Sun, 24 May 1998 21:05:12 +0000 (21:05 +0000)
committerKeith Seitz <keiths@cygnus>
Sun, 24 May 1998 21:05:12 +0000 (21:05 +0000)
that
        we can use this member to track real timeouts.
        (hardwire_readchar): Modify for cygwin32 so that we only ever use a real
        system timeout of one second. Track the "real" timeout as a series of th
ese
        one second timeouts.
        Call ui_loop_hook to keep the gui alive.

        * top.c: Define new hook for cygwin32, "ui_loop_hook".

        * gdbtk.c (gdbtk_init): Add ui_loop_hook for CygWin32 to work around
        update problems.

gdb/ChangeLog-gdbtk
gdb/gdbtk.c
gdb/ser-unix.c
gdb/top.c

index 1113816cb20b0643bd40177d58fb6cd7316f0208..0833e5442fe07a23468fc8990e8a2ae65a614bb1 100644 (file)
@@ -1,3 +1,17 @@
+Sun May 24 14:00:24 1998  Keith Seitz  <keiths@cygnus.com>
+
+       * ser-unix.c (wait_for): Do not reset timeout_remaining for cygwin32 so that
+       we can use this member to track real timeouts.
+       (hardwire_readchar): Modify for cygwin32 so that we only ever use a real
+       system timeout of one second. Track the "real" timeout as a series of these
+       one second timeouts.
+       Call ui_loop_hook to keep the gui alive.
+
+       * top.c: Define new hook for cygwin32, "ui_loop_hook".
+
+       * gdbtk.c (gdbtk_init): Add ui_loop_hook for CygWin32 to work around
+       update problems.
+
 Thu May 21 13:56:24 1998  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
        
        * gdbtk.c: reinserted the changes that were accidentally deleted:
index 6027cdbec362bd3a06f9ebc8399554d41a4edba3..4ca7a63b5a53484a574b5b7670fef8165bbefd01 100644 (file)
@@ -91,6 +91,10 @@ int (*ui_load_progress_hook) PARAMS ((char *, unsigned long));
 void (*pre_add_symbol_hook) PARAMS ((char *));
 void (*post_add_symbol_hook) PARAMS ((void));
 
+#ifdef __CYGWIN32__
+extern void (*ui_loop_hook) PARAMS ((int));
+#endif
+
 char * get_prompt PARAMS ((void));
 
 static void null_routine PARAMS ((int));
@@ -1895,6 +1899,12 @@ x_event (signo)
 
   in_x_event = 1;
 
+#ifdef __CYGWIN32__
+  if (signo == -2)
+    if (gdbtk_timer_going)
+      gdbtk_stop_timer ();
+#endif
+
   /* Process pending events */
   while (Tcl_DoOneEvent (TCL_DONT_WAIT|TCL_ALL_EVENTS) != 0)
     ;
@@ -2305,6 +2315,9 @@ gdbtk_init ( argv0 )
   readline_hook = gdbtk_readline;
   readline_end_hook = gdbtk_readline_end;
   ui_load_progress_hook = gdbtk_load_hash;
+#ifdef __CYGWIN32__
+  ui_loop_hook = x_event;
+#endif
   pre_add_symbol_hook   = gdbtk_pre_add_symbol;
   post_add_symbol_hook  = gdbtk_post_add_symbol;
   create_tracepoint_hook = gdbtk_create_tracepoint;
index c365434bc2d9eda220b8c60ebf75e84f9430009f..81374eaf37826020bb9615fe40742a313fd23202 100644 (file)
@@ -83,6 +83,10 @@ static int hardwire_flush_input PARAMS ((serial_t));
 static int hardwire_send_break PARAMS ((serial_t));
 static int hardwire_setstopbits PARAMS ((serial_t, int));
 
+#ifdef __CYGWIN32__
+extern void ui_loop_hook PARAMS ((int));
+#endif
+
 /* Open up a real live device for serial I/O */
 
 static int
@@ -430,7 +434,9 @@ wait_for(scb, timeout)
      serial_t scb;
      int timeout;
 {
+#ifndef __CYGWIN32__
   scb->timeout_remaining = 0;
+#endif
 
 #ifdef HAVE_SGTTY
   {
@@ -539,21 +545,34 @@ wait_for(scb, timeout)
    to wait, or -1 to wait forever.  Use timeout of 0 to effect a poll.  Returns
    char if successful.  Returns SERIAL_TIMEOUT if timeout expired, EOF if line
    dropped dead, or SERIAL_ERROR for any other error (see errno in that case).  */
-
 static int
 hardwire_readchar(scb, timeout)
      serial_t scb;
      int timeout;
 {
-  int status;
+  int status, t;
 
   if (scb->bufcnt-- > 0)
     return *scb->bufp++;
 
+#ifdef __CYGWIN32__
+  if (timeout > 0)
+    timeout++;
+#endif
+
   while (1)
     {
+#ifdef __CYGWIN32__
+      t = timeout == 0 ? 0 : 1;
+      scb->timeout_remaining = timeout < 0 ? timeout : timeout - t;
+      status = wait_for (scb, t);
+
+      /* -2 means disable timer */
+      if (ui_loop_hook)
+        ui_loop_hook (-2);
+#else
       status = wait_for (scb, timeout);
-
+#endif
       if (status < 0)
        return status;
 
@@ -570,6 +589,10 @@ hardwire_readchar(scb, timeout)
                  timeout = scb->timeout_remaining;
                  continue;
                }
+#ifdef __CYGWIN32__
+          else if (scb->timeout_remaining < 0)
+            continue;
+#endif
              else
                return SERIAL_TIMEOUT;
            }
index 248a44df63500b5b2c1a3f332b5eb8e812ee302f..b9d759b3e0b09a9ea70e9bc69716432c99579719 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -379,6 +379,9 @@ static void stop_sig PARAMS ((int));
    command file.  */
 
 void (*init_ui_hook) PARAMS ((char *argv0));
+#ifdef __CYGWIN32__
+void (*ui_loop_hook) PARAMS ((int));
+#endif
 
 /* Called instead of command_loop at top level.  Can be invoked via
    return_to_top_level.  */
This page took 0.029299 seconds and 4 git commands to generate.