aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/gdbserver/low-hppabsd.c4
-rw-r--r--gdb/gdbserver/low-linux.c4
-rw-r--r--gdb/gdbserver/low-nbsd.c4
-rw-r--r--gdb/gdbserver/low-sparc.c4
-rw-r--r--gdb/gdbserver/remote-utils.c36
6 files changed, 50 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2236826..988afa5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2001-07-11 Greg McGary <greg@mcgary.org>
+
+ * gdbserver/remote-utils.c (remote_open): Set gdbserver as "owner"
+ of SIGIO.
+ (input_interrupt): Don't block on read, in case we got redundant
+ SIGIO. Don't gripe about redundant SIGIO.
+ * gdbserver/low-hppabsd.c (mywait): Use waitpid(). Enable SIGIO
+ handler while waiting.
+ * gdbserver/low-linux.c (mywait): Likewise.
+ * gdbserver/low-nbsd.c (mywait): Likewise.
+ * gdbserver/low-sparc.c (mywait): Likewise.
+
2001-07-11 Keith Seitz <keiths@redhat.com>
* infrun.c (print_stop_reason): Add missing uiout field
diff --git a/gdb/gdbserver/low-hppabsd.c b/gdb/gdbserver/low-hppabsd.c
index 194ede2..b5f02ae 100644
--- a/gdb/gdbserver/low-hppabsd.c
+++ b/gdb/gdbserver/low-hppabsd.c
@@ -96,7 +96,9 @@ mywait (char *status)
int pid;
union wait w;
- pid = wait (&w);
+ enable_async_io ();
+ pid = waitpid (inferior_pid, &w, 0);
+ disable_async_io ();
if (pid != inferior_pid)
perror_with_name ("wait");
diff --git a/gdb/gdbserver/low-linux.c b/gdb/gdbserver/low-linux.c
index ea210f3..eea8c1d 100644
--- a/gdb/gdbserver/low-linux.c
+++ b/gdb/gdbserver/low-linux.c
@@ -105,7 +105,9 @@ mywait (char *status)
int pid;
union wait w;
- pid = wait (&w);
+ enable_async_io ();
+ pid = waitpid (inferior_pid, &w, 0);
+ disable_async_io ();
if (pid != inferior_pid)
perror_with_name ("wait");
diff --git a/gdb/gdbserver/low-nbsd.c b/gdb/gdbserver/low-nbsd.c
index 9a0f07a..3b3009f 100644
--- a/gdb/gdbserver/low-nbsd.c
+++ b/gdb/gdbserver/low-nbsd.c
@@ -172,7 +172,9 @@ mywait (char *status)
int pid;
int w;
- pid = wait (&w);
+ enable_async_io ();
+ pid = waitpid (inferior_pid, &w, 0);
+ disable_async_io ();
if (pid != inferior_pid)
perror_with_name ("wait");
diff --git a/gdb/gdbserver/low-sparc.c b/gdb/gdbserver/low-sparc.c
index fda52ae..d2eb113 100644
--- a/gdb/gdbserver/low-sparc.c
+++ b/gdb/gdbserver/low-sparc.c
@@ -102,7 +102,9 @@ mywait (char *status)
int pid;
union wait w;
- pid = wait (&w);
+ enable_async_io ();
+ pid = waitpid (inferior_pid, &w, 0);
+ disable_async_io ();
if (pid != inferior_pid)
perror_with_name ("wait");
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index f486b10..19f6715 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -1,5 +1,5 @@
/* Remote utility routines for the remote server for GDB.
- Copyright 1986, 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1986, 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GDB.
@@ -32,6 +32,8 @@
#include <sys/ioctl.h>
#include <signal.h>
#include <fcntl.h>
+#include <sys/time.h>
+#include <unistd.h>
int remote_debug = 0;
struct ui_file *gdb_stdlog;
@@ -156,8 +158,11 @@ remote_open (char *name)
#if defined(F_SETFL) && defined (FASYNC)
save_fcntl_flags = fcntl (remote_desc, F_GETFL, 0);
fcntl (remote_desc, F_SETFL, save_fcntl_flags | FASYNC);
+#endif
+#if defined (F_SETOWN)
+ fcntl (remote_desc, F_SETOWN, getpid ());
+#endif
disable_async_io ();
-#endif /* FASYNC */
fprintf (stderr, "Remote debugging using %s\n", name);
}
@@ -261,18 +266,29 @@ putpkt (char *buf)
static void
input_interrupt (void)
{
- int cc;
- char c;
+ fd_set readset;
+ struct timeval immediate = { 0, 0 };
- cc = read (remote_desc, &c, 1);
+ /* Protect against spurious interrupts. This has been observed to
+ be a problem under NetBSD 1.4 and 1.5. */
- if (cc != 1 || c != '\003')
+ FD_ZERO (&readset);
+ FD_SET (remote_desc, &readset);
+ if (select (remote_desc + 1, &readset, 0, 0, &immediate) > 0)
{
- fprintf (stderr, "input_interrupt, cc = %d c = %d\n", cc, c);
- return;
- }
+ int cc;
+ char c;
+
+ cc = read (remote_desc, &c, 1);
- kill (inferior_pid, SIGINT);
+ if (cc != 1 || c != '\003')
+ {
+ fprintf (stderr, "input_interrupt, cc = %d c = %d\n", cc, c);
+ return;
+ }
+
+ kill (inferior_pid, SIGINT);
+ }
}
void