remote pdb which connects to developer
pdbme - remote active debugger based on rpdb
This is active fork of https://github.com/tamentis/rpdb.
Rpdb is a wrapper around pdb that re-routes stdin and stdout to a socket handler.
Pdbme is Rpdb, which is active. Which means, that while Rpdb open port and waits until you connect to this port, Pdbme connects to your port.
So, in other words, you open pdbme-cli tool, ask your app "pdb me please" and your app will pdb you :).
Rpdb opens debugger pon port (default 4444), but it has many drawbacks. Eg - it cannot be used in mutlithreaded or multiprocessing application. Even in non-parallel app, port can be occupied a little while after closing it and app will break trying to open it again.
Calling your terminal sounds way better way. It's useful when you want to debug app which can break simultaneously more than once in a time, and passive mode will refuse to open port 4444 again.
Solution to the problem is:
# default host is 127.0.0.1 and default port is 4444 import pdbme; pdbme.set_trace()
or, in more complex case, eg. when it's running in other host, in your docker, or sth like that
import pdbme pdbme.set_trace(host='192.168.1.120', port=12345)
You should have pdbme-cli running on other side of your communication.
pdbme-cli is a simple tool, using tmux, tcpwrapper and socat to accept incoming connections and spawn tmux session for each incoming breakpoint.
- tcpwrapper comes from https://cr.yp.to/ucspi-tcp.html (available in many distros and in MacOS brew)
- socat - http://www.dest-unreach.org/socat/
Installation in CPython (standard Python)
pip install pdbme (not yet on PyPi)
pip install git+https://github.com/mahomahomaho/pdbme
Trigger rpdb with signal
set_trace() can be triggered at any time by using the TRAP signal handler.
This allows you to debug a running process independantly of a specific failure
import pdbme pdbme.handle_trap() # As with set_trace, you can optionally specify addr and port rpdb.handle_trap(host="0.0.0.0", port=4441)
handle_trap will overwrite the existing handler for SIGTRAP if one has
already been defined in your application.
and rpdbs contributors: (chronological, latest first):
- Cameron Davidson-Pilon - @CamDavidsonPilon
- Pavel Fux - @fuxpavel
- Ken Manheimer - @kenmanheimer
- Steven Willis - @onlynone
- Jorge Niedbalski R firstname.lastname@example.org
- Cyprien Le Pannérer email@example.com
- k4ml firstname.lastname@example.org
- Sean M. Collins email@example.com
- Sean Myers firstname.lastname@example.org
- New functionality, new package name, new versioning....
- dropped some rpdb functionality,
- Give access to attributes of stdin and stdout (by @fuxpavel).
- Add rpdb.post_mortem(), similar to pdb.post_mortem() (by @CamDavidsonPilon).
- Write addr/port to stderr instead of stdout (thanks to @onlynone).
- Allow for dynamic host port (thanks to @onlynone).
- Make q/quit do proper cleanup (@kenmanheimer)
- Benignly disregard repeated rpdb.set_trace() to same port as currently active session (@kenmanheimer)
- Extend backwards compatibility down to Python 2.5 (@kenmanheimer)
- Expose the addr, port arguments to the set_trace method (thanks to @niedbalski).
- Remove a try/finally that seemed to shift the trace location (thanks to k4ml@github).
- Catch IOError raised by print in initialization, it may not work in some environments (e.g. mod_wsgi). (Menno Smits)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pdbme-0.0.1-py3-none-any.whl (8.1 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size pdbme-0.0.1.tar.gz (6.3 kB)||File type Source||Python version None||Upload date||Hashes View|