From: John Pye <john.pye@anu.edu.au>
To: gdb@sourceware.org
Subject: GDB hangs when debugging a python program
Date: Wed, 17 Jan 2007 09:31:00 -0000 [thread overview]
Message-ID: <45ADEC6E.90504@anu.edu.au> (raw)
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$
next reply other threads:[~2007-01-17 9:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-17 9:31 John Pye [this message]
2007-01-17 16:03 ` Daniel Jacobowitz
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=45ADEC6E.90504@anu.edu.au \
--to=john.pye@anu.edu.au \
--cc=gdb@sourceware.org \
/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