From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19432 invoked by alias); 17 Jan 2007 09:31:19 -0000 Received: (qmail 19420 invoked by uid 22791); 17 Jan 2007 09:31:18 -0000 X-Spam-Check-By: sourceware.org Received: from out4.smtp.messagingengine.com (HELO out4.smtp.messagingengine.com) (66.111.4.28) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 17 Jan 2007 09:31:10 +0000 Received: from out1.internal (unknown [10.202.2.149]) by out1.messagingengine.com (Postfix) with ESMTP id 220487E1C4 for ; Wed, 17 Jan 2007 04:29:24 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by out1.internal (MEProxy); Wed, 17 Jan 2007 04:29:24 -0500 Received: from [10.1.1.3] (d58-104-193-4.dsl.nsw.optusnet.com.au [58.104.193.4]) by mail.messagingengine.com (Postfix) with ESMTP id 670FC21DDA for ; Wed, 17 Jan 2007 04:29:20 -0500 (EST) Message-ID: <45ADEC6E.90504@anu.edu.au> Date: Wed, 17 Jan 2007 09:31:00 -0000 From: John Pye User-Agent: Thunderbird 1.5.0.9 (X11/20070103) MIME-Version: 1.0 To: gdb@sourceware.org Subject: GDB hangs when debugging a python program Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2007-01/txt/msg00269.txt.bz2 Hi all I have a python script that I'm debugging that contains the following: os.execvp("python",[script] + sys.argv) I use that to set some environment variables then restart Python in the new environment. Although Bash seems to behave well with this (it dutifully waits until the replacement process exits before returning control to me) it seems that GDB 'looses the thread' as shown below. It gives me a message about 'Cannot file user-level thread' then gives me back a prompt. When I exit gdb (ctrl-D) it hangs. I have to go to another terminal and send SIGKILL to the orphaned python process before I get my bash prompt back in the original window. I'm not sure whether it's reasonably to hope that GDB could support debugging of programs that restart themselves in this way. But I thought I would mention it just in case it is possible, or if there is a workaround in place, etc. Cheers JP john@roadwork:~/ascend$ gdb --args python test.py TestSensitivity GNU gdb 6.4.90-debian Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i486-linux-gnu"...Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1". (gdb) r Starting program: /usr/bin/python test.py TestSensitivity [Thread debugging using libthread_db enabled] [New Thread -1210603328 (LWP 1645)] Restarting with... LD_LIBRARY_PATH = /home/john/ascend:/home/john/ascend/pygtk:/usr/local/lib PYTHONPATH = /home/john/ascend/pygtk ASCENDLIBRARY = /home/john/ascend/models:/home/john/freesteam/ascend Cannot find user-level thread for LWP 1645: generic error (gdb) The program is running. Exit anyway? (y or n) y john@roadwork:~/ascend$