Debugging Python with GDB

To run python under gdb there are also two ways.

$ gdb python
(gdb) run <programname>.py <arguments>


$ gdb -ex r --args python <programname>.py <arguments>

If the process is already running, you can attach to it provided you know the process ID.

$ gdb python <pid of running process>


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.