From: "Paul N. Hilfinger" <hilfingr@otisco.mckusick.com>
To: gdb-patches@sources.redhat.com
Subject: RFA: Fix for piped input on Linux
Date: Tue, 08 May 2001 16:17:00 -0000 [thread overview]
Message-ID: <200105082317.QAA02186@localhost.localdomain> (raw)
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);
reply other threads:[~2001-05-08 16:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200105082317.QAA02186@localhost.localdomain \
--to=hilfingr@otisco.mckusick.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox