From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14167 invoked by alias); 19 Apr 2011 20:10:42 -0000 Received: (qmail 14154 invoked by uid 22791); 19 Apr 2011 20:10:35 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Apr 2011 20:10:20 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3JKAIMf014060 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 19 Apr 2011 16:10:19 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3JKAGAT031521; Tue, 19 Apr 2011 16:10:17 -0400 From: Phil Muldoon To: Kevin Pouget Cc: gdb@sourceware.org Subject: Re: [Python] Input from user from extended breakpoint `stop' function References: Reply-to: pmuldoon@redhat.com X-URL: http://www.redhat.com Date: Tue, 19 Apr 2011 20:10:00 -0000 In-Reply-To: (Kevin Pouget's message of "Tue, 19 Apr 2011 10:41:30 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00102.txt.bz2 Kevin Pouget writes: > Hello, > > is there any function provided by GDB to read from the terminal ? > (I still don't know much about Python) Nope, but in the context of this bug there might need to be. GDB does a few things with stdout/tty. > I'm facing a problem when I was to ask a question the user from an > extended breakpoint `stop' function: try > > class MyBreakpoint (gdb.Breakpoint): > def stop (self): > bug = raw_input("Input ?") > print "--> ", bug > return True > MyBreakpoint(spec="main") > > > and you will see this output: > >> (gdb) source sigttin.py >> Breakpoint 1 at 0x400579 >> (gdb) r >> Starting program: /home/kevin/a.out >> Input ? >> [1]+ Stopped gdb-git a.out >> kevin@kevin:~$ fg >> gdb-git a.out >> hello >> --> hello >> Breakpoint 1, 0x0000000000400579 in main () > > because GDB receives a SIGTTIN ("SIGTTIN is the signal sent to a > process when it attempts to read from the tty while in the > background." says wikipedia), which somehow makes sense. I'm not sure what is going on here. It seems GDB is not acting correctly with the SIGTTIN. I really do not know this area of GDB at all. > Any solution, or shall I send a bug report? Bug report please. Cheers, Phil