This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GDB hangs when debugging a python program


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$


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]