aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2002-05-14 15:21:10 +0000
committerKeith Seitz <keiths@redhat.com>2002-05-14 15:21:10 +0000
commit05a6c72cef0e3cf89abce2097519b90e373b4be5 (patch)
tree3a7f4b69233744116cb8da5762529255fdf87d7d /gdb
parentdb5897415cdde8d56bfc917c47475209e94c54a3 (diff)
downloadgdb-05a6c72cef0e3cf89abce2097519b90e373b4be5.zip
gdb-05a6c72cef0e3cf89abce2097519b90e373b4be5.tar.gz
gdb-05a6c72cef0e3cf89abce2097519b90e373b4be5.tar.bz2
* event-loop.c (create_file_handler): Don't do anything but
update data when we are given a fd which we are already monitoring.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/event-loop.c73
2 files changed, 43 insertions, 36 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 70046f2..d4035c2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2002-05-14 Keith Seitz <keiths@redhat.com>
+
+ * event-loop.c (create_file_handler): Don't do anything but
+ update data when we are given a fd which we are already
+ monitoring.
+
2002-05-14 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (context_cpy): Copy registers correctly.
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index ea74419..4e42d7e 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -494,51 +494,52 @@ create_file_handler (int fd, int mask, handler_func * proc, gdb_client_data clie
file_ptr->ready_mask = 0;
file_ptr->next_file = gdb_notifier.first_file_handler;
gdb_notifier.first_file_handler = file_ptr;
- }
- file_ptr->proc = proc;
- file_ptr->client_data = client_data;
- file_ptr->mask = mask;
- if (use_poll)
- {
+ if (use_poll)
+ {
#ifdef HAVE_POLL
- gdb_notifier.num_fds++;
- if (gdb_notifier.poll_fds)
- gdb_notifier.poll_fds =
- (struct pollfd *) xrealloc (gdb_notifier.poll_fds,
- (gdb_notifier.num_fds
- * sizeof (struct pollfd)));
- else
- gdb_notifier.poll_fds =
- (struct pollfd *) xmalloc (sizeof (struct pollfd));
- (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->fd = fd;
- (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->events = mask;
- (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->revents = 0;
+ gdb_notifier.num_fds++;
+ if (gdb_notifier.poll_fds)
+ gdb_notifier.poll_fds =
+ (struct pollfd *) xrealloc (gdb_notifier.poll_fds,
+ (gdb_notifier.num_fds
+ * sizeof (struct pollfd)));
+ else
+ gdb_notifier.poll_fds =
+ (struct pollfd *) xmalloc (sizeof (struct pollfd));
+ (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->fd = fd;
+ (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->events = mask;
+ (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->revents = 0;
#else
- internal_error (__FILE__, __LINE__,
- "use_poll without HAVE_POLL");
+ internal_error (__FILE__, __LINE__,
+ "use_poll without HAVE_POLL");
#endif /* HAVE_POLL */
- }
- else
- {
- if (mask & GDB_READABLE)
- FD_SET (fd, &gdb_notifier.check_masks[0]);
+ }
else
- FD_CLR (fd, &gdb_notifier.check_masks[0]);
+ {
+ if (mask & GDB_READABLE)
+ FD_SET (fd, &gdb_notifier.check_masks[0]);
+ else
+ FD_CLR (fd, &gdb_notifier.check_masks[0]);
- if (mask & GDB_WRITABLE)
- FD_SET (fd, &gdb_notifier.check_masks[1]);
- else
- FD_CLR (fd, &gdb_notifier.check_masks[1]);
+ if (mask & GDB_WRITABLE)
+ FD_SET (fd, &gdb_notifier.check_masks[1]);
+ else
+ FD_CLR (fd, &gdb_notifier.check_masks[1]);
- if (mask & GDB_EXCEPTION)
- FD_SET (fd, &gdb_notifier.check_masks[2]);
- else
- FD_CLR (fd, &gdb_notifier.check_masks[2]);
+ if (mask & GDB_EXCEPTION)
+ FD_SET (fd, &gdb_notifier.check_masks[2]);
+ else
+ FD_CLR (fd, &gdb_notifier.check_masks[2]);
- if (gdb_notifier.num_fds <= fd)
- gdb_notifier.num_fds = fd + 1;
+ if (gdb_notifier.num_fds <= fd)
+ gdb_notifier.num_fds = fd + 1;
+ }
}
+
+ file_ptr->proc = proc;
+ file_ptr->client_data = client_data;
+ file_ptr->mask = mask;
}
/* Remove the file descriptor FD from the list of monitored fd's: