Vikash Jain | 24 May 15:26 2011
Picon

GDB: error detected on stdin

Hi All,

I'm trying to pipe commands to gdb but I get the following messages.
Will it cause any problems? How do i resolve the same?

(gdb) Hangup detected on fd 0
error detected on stdin

Python Script
============
#!/usr/local/bin/python
import subprocess

proc=subprocess.Popen('gdb',shell=True,stdin=su
bprocess.PIPE,stdout=subprocess.PIPE,executable="/usr/local/bin/bash")
proc.stdin.write('help')
output=proc.communicate()[0]
print output

Script Log
==========
[XXX <at> test ~/CAT/example]$ python -u main.py
GNU gdb (GDB) 7.2.50.20110328-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd6.3".
For bug reporting instructions, please see:
(Continue reading)

Andreas Schwab | 24 May 16:31 2011
Picon

Re: GDB: error detected on stdin

Vikash Jain <vikashjin <at> gmail.com> writes:

> I'm trying to pipe commands to gdb but I get the following messages.
> Will it cause any problems? How do i resolve the same?

2011-05-24  Andreas Schwab  <schwab <at> redhat.com>

	* event-loop.c (handle_file_event): Don't handle POLLHUP as error.

--- event-loop.c.~1.49.~	2011-03-22 11:59:52.000000000 +0100
+++ event-loop.c	2011-05-24 16:27:28.614311098 +0200
 <at>  <at>  -759,7 +759,6  <at>  <at>  handle_file_event (event_data data)
   int mask;
 #ifdef HAVE_POLL
   int error_mask;
-  int error_mask_returned;
 #endif
   int event_file_desc = data.integer;

 <at>  <at>  -783,22 +782,19  <at>  <at>  handle_file_event (event_data data)
 	  if (use_poll)
 	    {
 #ifdef HAVE_POLL
+	      /* POLLHUP means EOF, but can be combined with POLLIN to
+		 signal more data to read.  */
 	      error_mask = POLLHUP | POLLERR | POLLNVAL;
-	      mask = (file_ptr->ready_mask & file_ptr->mask) |
-		(file_ptr->ready_mask & error_mask);
-	      error_mask_returned = mask & error_mask;
+	      mask = file_ptr->ready_mask & (file_ptr->mask | error_mask);
(Continue reading)

Tom Tromey | 24 May 21:14 2011
Picon

Re: GDB: error detected on stdin

>>>>> "Andreas" == Andreas Schwab <schwab <at> redhat.com> writes:

Andreas> 2011-05-24  Andreas Schwab  <schwab <at> redhat.com>
Andreas> 	* event-loop.c (handle_file_event): Don't handle POLLHUP as error.

This is ok.  IIRC this fixes some PR as well.

Tom

Andreas Schwab | 25 May 09:59 2011
Picon

Re: GDB: error detected on stdin

Tom Tromey <tromey <at> redhat.com> writes:

>>>>>> "Andreas" == Andreas Schwab <schwab <at> redhat.com> writes:
>
> Andreas> 2011-05-24  Andreas Schwab  <schwab <at> redhat.com>
> Andreas> 	* event-loop.c (handle_file_event): Don't handle POLLHUP as error.
>
> This is ok.  IIRC this fixes some PR as well.

Yep, it's 8677.

Andreas.

--

-- 
Andreas Schwab, schwab <at> redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

Andreas Schwab | 25 May 09:59 2011
Picon

Re: GDB: error detected on stdin

Tom Tromey <tromey <at> redhat.com> writes:

>>>>>> "Andreas" == Andreas Schwab <schwab <at> redhat.com> writes:
>
> Andreas> 2011-05-24  Andreas Schwab  <schwab <at> redhat.com>
> Andreas> 	* event-loop.c (handle_file_event): Don't handle POLLHUP as error.
>
> This is ok.  IIRC this fixes some PR as well.

Yep, it's 8677.

Andreas.

--

-- 
Andreas Schwab, schwab <at> redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

Vikash Jain | 25 May 10:09 2011
Picon

Re: GDB: error detected on stdin

Thanks a lot, fix worked for me.

On Wed, May 25, 2011 at 1:29 PM, Andreas Schwab <schwab <at> redhat.com> wrote:
> Tom Tromey <tromey <at> redhat.com> writes:
>
>>>>>>> "Andreas" == Andreas Schwab <schwab <at> redhat.com> writes:
>>
>> Andreas> 2011-05-24  Andreas Schwab  <schwab <at> redhat.com>
>> Andreas>      * event-loop.c (handle_file_event): Don't handle POLLHUP as error.
>>
>> This is ok.  IIRC this fixes some PR as well.
>
> Yep, it's 8677.
>
> Andreas.
>
> --
> Andreas Schwab, schwab <at> redhat.com
> GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
> "And now for something completely different."
>

Tom Tromey | 24 May 21:14 2011
Picon

Re: GDB: error detected on stdin

>>>>> "Andreas" == Andreas Schwab <schwab <at> redhat.com> writes:

Andreas> 2011-05-24  Andreas Schwab  <schwab <at> redhat.com>
Andreas> 	* event-loop.c (handle_file_event): Don't handle POLLHUP as error.

This is ok.  IIRC this fixes some PR as well.

Tom

Andreas Schwab | 24 May 16:31 2011
Picon

Re: GDB: error detected on stdin

Vikash Jain <vikashjin <at> gmail.com> writes:

> I'm trying to pipe commands to gdb but I get the following messages.
> Will it cause any problems? How do i resolve the same?

2011-05-24  Andreas Schwab  <schwab <at> redhat.com>

	* event-loop.c (handle_file_event): Don't handle POLLHUP as error.

--- event-loop.c.~1.49.~	2011-03-22 11:59:52.000000000 +0100
+++ event-loop.c	2011-05-24 16:27:28.614311098 +0200
 <at>  <at>  -759,7 +759,6  <at>  <at>  handle_file_event (event_data data)
   int mask;
 #ifdef HAVE_POLL
   int error_mask;
-  int error_mask_returned;
 #endif
   int event_file_desc = data.integer;

 <at>  <at>  -783,22 +782,19  <at>  <at>  handle_file_event (event_data data)
 	  if (use_poll)
 	    {
 #ifdef HAVE_POLL
+	      /* POLLHUP means EOF, but can be combined with POLLIN to
+		 signal more data to read.  */
 	      error_mask = POLLHUP | POLLERR | POLLNVAL;
-	      mask = (file_ptr->ready_mask & file_ptr->mask) |
-		(file_ptr->ready_mask & error_mask);
-	      error_mask_returned = mask & error_mask;
+	      mask = file_ptr->ready_mask & (file_ptr->mask | error_mask);
(Continue reading)


Gmane