This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug remote/17028] GDB+GDBserver hangs on Windows waiting for stop event since target-async on by default


https://sourceware.org/bugzilla/show_bug.cgi?id=17028

--- Comment #11 from Pedro Alves <palves at redhat dot com> ---
Oh, I think I found something.  I noticed that the N argument to gdb_select was
quite high.  So I added an assertion to check that we're not doing undefined
things with select and the FD_SET, etc. macros.  See "man 3 select":

"The behavior of these macros is undefined if the fd argument is less than 0 or
greater than or equal to FD_SETSIZE, or if fd is not a valid file descriptor, 
or if any of the arguments are expressions with side effects."

diff --git c/gdb/event-loop.c w/gdb/event-loop.c
index 5999c97..662deb2 100644
--- c/gdb/event-loop.c
+++ w/gdb/event-loop.c
@@ -566,6 +566,8 @@ create_file_handler (int fd, int mask, handler_func * proc,
        }
       else
        {
+         gdb_assert (fd >= 0 && fd < FD_SETSIZE);
+
          if (mask & GDB_READABLE)
            FD_SET (fd, &gdb_notifier.check_masks[0]);
          else
diff --git c/gdb/gdbserver/event-loop.c w/gdb/gdbserver/event-loop.c
index dc1eb41..1512e32 100644
--- c/gdb/gdbserver/event-loop.c
+++ w/gdb/gdbserver/event-loop.c
@@ -300,6 +300,10 @@ create_file_handler (gdb_fildes_t fd, int mask,
handler_func *proc,
       file_ptr->next_file = gdb_notifier.first_file_handler;
       gdb_notifier.first_file_handler = file_ptr;

+      fprintf (stderr, "fd=%d, FD_SETSIZE=%d\n", fd, FD_SETSIZE);
+
+      gdb_assert (fd >= 0 && fd < FD_SETSIZE);
+
       if (mask & GDB_READABLE)
        FD_SET (fd, &gdb_notifier.check_masks[0]);
       else


And lo:

E:\gdb\mygit\build-win32\gdb\gdbserver>gdbserver :9999 ../simple32.exe
Process ../simple32.exe created; pid = 1244
Listening on port 9999
fd=116, FD_SETSIZE=64
../../../src/gdb/gdbserver/event-loop.c:305: A problem internal to GDBserver
has been detected.
create_file_handler: Assertion `fd >= 0 && fd < FD_SETSIZE' failed.

E:\gdb\mygit\build-win32\gdb\gdbserver>

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]