virtualenv icon indicating copy to clipboard operation
virtualenv copied to clipboard

gdb Python extensions not properly linked into new virtualenv

Open zbuc opened this issue 11 years ago • 5 comments

I was playing around with virtualenv and gdb for debugging Python apps(that call out to some C libraries I wanted to inspect).

System:

$ virtualenv --version
1.11.4
$ uname -a
Linux virtual-machine 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ /usr/bin/python2.7-dbg --version
Python 2.7.6
$ gdb --version
GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7

Setup of virtual environment:

$ virtualenv -p /usr/bin/python2.7-dbg debugenv
$ source debugenv/bin/activate

Testing gdb Python extended commands(fails):

(debugenv)$ gdb --args python
(gdb) py-bt
Undefined command: "py-bt".  Try "help".

This person on StackOverflow had a solution posted: http://stackoverflow.com/questions/22931774/how-to-use-gdb-python-debugging-extension-inside-virtualenv

(debugenv)$ ln -s /usr/lib/debug/usr/bin/python2.7-gdb.py /path/to/debugenv/bin/python2.7-dbg-gdb.py
(debugenv)$ gdb --args python
(gdb) py-bt
Python Exception <class 'gdb.error'> No frame is currently selected.: 
Error occurred in Python command: No frame is currently selected.

I'm not sure if this should be implemented in virtualenv itself if it detects a Python debug executable is being used, but this was slightly annoying/confusing to deal with and wanted to make the virtualenv team aware.

zbuc avatar Aug 28 '14 15:08 zbuc

Sweet i run into that same problem, thanks so far. If it doesn't hurt it should be added.

delijati avatar Apr 09 '15 17:04 delijati

I meet this error, when import libpython and use py-bt: "Error occurred in Python command: init() takes exactly 3 arguments (2 given)"

loopmocker avatar Apr 28 '18 04:04 loopmocker

This is still an issue?

I got the same problem:

(gdb) py-list
Undefined command: "py-list"

davidalbertonogueira avatar Aug 02 '18 10:08 davidalbertonogueira

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just add a comment if you want to keep it open. Thank you for your contributions.

stale[bot] avatar Jan 14 '19 10:01 stale[bot]

Still a problem with python3.6-dbg on ubuntu 18.10

xantoz avatar Jan 21 '19 09:01 xantoz

Seems no longer an issue as no one reported it in 3 years.

gaborbernat avatar Jun 27 '23 03:06 gaborbernat