On 08/12, Oleg Nesterov wrote:
>
> >       I will investigate tomorrow, but I am almost sure gdb is
> >       wrong.
>
> Yes, this seems to be true... Tomorrow.

Can't sleep because of this problem ;)

So, the patch below fixes the problem, and gdb + /proc/ugdb seems
to work.

Indeed, gdb sees that this fd is not pipe/tcp and uses the "hardwire"
serial_ops, but hardwire_readchar() doesn't play well with select().

Please teach gdb to use poll/select ?

Oleg.

--- gdb-7.1/gdb/ser-unix.c
+++ gdb-7.1/gdb/ser-unix.c
@@ -452,7 +452,7 @@ hardwire_raw (struct serial *scb)
 static int
 wait_for (struct serial *scb, int timeout)
 {
-#ifdef HAVE_SGTTY
+#if 1
   while (1)
     {
       struct timeval tv;
@@ -474,13 +474,14 @@ wait_for (struct serial *scb, int timeou
       else
        numfds = gdb_select (scb->fd + 1, &readfds, 0, 0, 0);
 
-      if (numfds <= 0)
+      if (numfds <= 0) {
        if (numfds == 0)
          return SERIAL_TIMEOUT;
        else if (errno == EINTR)
          continue;
        else
          return SERIAL_ERROR;  /* Got an error from select or poll */
+      }
 
       return 0;
     }

Reply via email to