Dilawar's Blog

watch -n 1 /dev/null

03 Nov 2020

Debugging python extension in gdb

$ gdb -ex r --args python myscript.py

If you are using virtual environment then you are likely to run into the following error.

/home/dilawars/PY38/shims/python": not in executable format: File format not recognized

Because, in virtualenv, the command python is a bash script wrapping the real python executable. To bypass this, just do the following:

$ gdb -ex r --args bash python myscript.py

Categories

Tags