Im using python3.6.1 installed in pyenv. I have problem with running gdb on my code. When I run gdb --args python mycode.py
it ends with error "/home/vydra/.pyenv/shims/python": not in executable format: File format not recognized
Cannot start dbg on my python C extension
Asked Answered
As suggested by Jean-François Fabre, the python file installed by pyenv is actually a bash script. You can easily make gdb run this script with:
gdb -ex r --args bash python mycode.py
See this question for other approaches: Use GDB to debug a C++ program called from a shell script
© 2022 - 2024 — McMap. All rights reserved.
/home/vydra/.pyenv/shims/python
? it's probably a script that runs something else. gdb can only debug real executables. – Isocline/home/vydra/.pyenv/shims/python
since it's probably a script. Change the line where it runs the actual python exe by adding gdb prefix – Isocline