* GDB hangs when debugging a python program
@ 2007-01-17 9:31 John Pye
2007-01-17 16:03 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: John Pye @ 2007-01-17 9:31 UTC (permalink / raw)
To: gdb
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$
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: GDB hangs when debugging a python program
2007-01-17 9:31 GDB hangs when debugging a python program John Pye
@ 2007-01-17 16:03 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2007-01-17 16:03 UTC (permalink / raw)
To: John Pye; +Cc: gdb
On Wed, Jan 17, 2007 at 08:29:18PM +1100, John Pye wrote:
> 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.
This was a bug in that version of GDB; I'm pretty sure it's fixed in
6.6 (which is not yet in Debian, but it's fairly simple to build
yourself; it will be in unstable soon).
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-01-17 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-17 9:31 GDB hangs when debugging a python program John Pye
2007-01-17 16:03 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox