* RFA: Fix for piped input on Linux
@ 2001-05-08 16:17 Paul N. Hilfinger
0 siblings, 0 replies; only message in thread
From: Paul N. Hilfinger @ 2001-05-08 16:17 UTC (permalink / raw)
To: gdb-patches
I'm not sure if piping input to GDB is all that common, but I happened
to encounter an odd little glitch on my RedHat Linux 6.2 setup
(2.2.16-3 i686) that causes GDB to receive bogus SIGHUPs on input. The
following works for me, but someone who actually understands the real
semantics of the flags ought to comment. The symptom encountered is
that
gdb foo < script
works just fine, but
cat script | gdb foo
(for example) fails with messages such as
(gdb) Hangup detected on fd 0
error detected on stdin
without reading a single complete command. With the change, one gets the
message above only at EOF, where it makes a little more sense.
Paul Hilfinger
2001-05-08 Paul N. Hilfinger <hilfingr@otisco.mckusick.com>
ChangeLog:
* event-loop.c (handle_file_event): Mask off POLLHUP when we receive
input. For some reason, Redhat Linux 6.2 (at least) sets the POLLHUP
bit on each input when reading from a pipe (not from a file).
diff -c -3 -p -r1.16 event-loop.c
*** event-loop.c 2001/03/27 20:36:23 1.16
--- event-loop.c 2001/05/08 22:38:07
*************** handle_file_event (int event_file_desc)
*** 662,667 ****
--- 662,674 ----
if (use_poll)
{
#ifdef HAVE_POLL
+ /* The following two lines address a problem seen on at
+ least one Linux version (RedHat 6.2): when input
+ comes from a pipe, the POLLHUP flag is set on each
+ input, so in the event we are expecting input and get
+ it, we turn off POLLHUP. */
+ if (file_ptr->ready_mask & file_ptr->mask & POLLIN)
+ file_ptr->ready_mask &= ~POLLHUP;
error_mask = POLLHUP | POLLERR | POLLNVAL;
mask = (file_ptr->ready_mask & file_ptr->mask) |
(file_ptr->ready_mask & error_mask);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-05-08 16:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-08 16:17 RFA: Fix for piped input on Linux Paul N. Hilfinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox