A python debugger that can attach to running processes.
Slowing down. Last release over 3 years ago, little activity since. Fine for existing code; think twice for a new project.
pip install pdb-attachpdb-attach
A python debugger that can attach to running processes.
:exclamation: pdb-attach does not work on processes where it hasn't been imported and set up. If you just discovered this package and hope to use it on an already running process, you will need to restart the program with pdb-attach listening. Another option is to use
gdbwhich can attach to a running python process, more information can be found here. The catch with usinggdbis that it doesn't step through the python source code, but instead steps through the C code running the python program. Your mileage may vary withgdb.
This package was made in response to frustration over debugging long running processes. Wouldn't it be nice to just attach pdb to a running python program and see what's going on? Well that's exactly what pdb-attach does.
Installation
$ pip install pdb-attach
Requirements
OS
Supports OSes that implement POSIX only.
Unfortunately pdb-attach doesn't work on Windows. It's an artifact of the implementation using signals to prompt the remote debugger to accept a socket connection. I would like to support Windows in the future, but because of how Windows handles signals, it will require a different implementation that doesn't rely on signals.
:warning: On Windows, pdb-attach is still importable, but
listenwon't do anything. Instead a warning will be raised on import and whenlistenis called.
Python versions
Currently supports:
- 2.7 (Github no longer supports CI workflows for 2.7; support will be dropped in the future)
- 3.3
- 3.4
- 3.5
- 3.6
- 3.7
- 3.8
- 3.9
The policy on python version support is to support all active versions of python. For any version that has reached end of life, that version will continue to be supported for the last major release of pdb-attach it was a part of. New major releases of pdb-attach after a python version has been end of lifed may drop support for that version of python.
Usage
:warning: pdb-attach uses sockets to communicate with the running process where
pdbis actually being executed. There is always the possibility that a bad actor that has access to your machine can connect to that port before you do. Since is an interactive session with the process, this would give them the ability to inspect the source code of the running process, modify state of the running process, and That is bad and now you've been warned.