Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Remote vanilla PDB (over TCP sockets) *done right*: no extras, proper handling around connection failures and CI. Based on `pdbx <https://pypi.python.org/pypi/pdbx>`_.
Remote vanilla PDB (over TCP sockets) done right: no extras, proper handling around connection failures and CI. Based
on pdbx <https://pypi.python.org/pypi/pdbx>
_.
::
pip install remote-pdb
To open a remote PDB on first available port:
.. code:: python
from remote_pdb import set_trace
set_trace() # you'll see the port number in the logs
To use some specific host/port:
.. code:: python
from remote_pdb import RemotePdb
RemotePdb('127.0.0.1', 4444).set_trace()
To connect just run telnet 127.0.0.1 4444
. When you are finished
debugging, either exit the debugger, or press Control-], then Control-d.
Alternately, one can connect with NetCat: nc -C 127.0.0.1 4444
or Socat: socat readline tcp:127.0.0.1:4444
(for line editing and history support). When finished debugging, either exit
the debugger, or press Control-c.
Note that newer Ubuntu disabled readline support in socat, so if you get
unknown device/address "readline"
try using rlwrap like this::
rlwrap socat - tcp:127.0.0.1:4444
If you want to connect from the host to remote-pdb running inside the container you should make sure that:
-p 4444:4444
).0.0.0.0
(localhost` or
127.0.0.1`` will not work because
Docker doesn't map the port on the local interface).If you are using Python 3.7 one can use the new breakpoint()
built in to invoke
remote PDB. In this case the following environment variable must be set:
.. code:: bash
PYTHONBREAKPOINT=remote_pdb.set_trace
The debugger can then be invoked as follows, without any imports:
.. code:: python
breakpoint()
As the breakpoint()
function does not take any arguments, environment variables can be used to
specify the host and port that the server should listen to. For example, to run script.py
in such a
way as to make telnet 127.0.0.1 4444
the correct way of connecting, one would run:
.. code:: bash
PYTHONBREAKPOINT=remote_pdb.set_trace REMOTE_PDB_HOST=127.0.0.1 REMOTE_PDB_PORT=4444 python script.py
If REMOTE_PDB_HOST
is omitted then a default value of 127.0.0.1 will be used. If REMOTE_PDB_PORT
is
omitted then the first available port will be used. The connection information will be logged to the console,
as with calls to remote_pdb.set_trace()
.
To quiet the output, set REMOTE_PDB_QUIET=1
, this will prevent
RemotePdb
from producing any output -- you'll probably want to specify
REMOTE_PDB_PORT
as well since the randomized port won't be printed.
In certain scenarios (backgrounded processes) OS X will prevent readline to be imported (and readline is a dependency of pdb). A workaround (run this early):
.. code:: python
import signal
signal.signal(signal.SIGTTOU, signal.SIG_IGN)
See #9 <https://github.com/ionelmc/python-remote-pdb/issues/9>
_ and cpython#14892 <http://bugs.python.org/issue14892>
_.
Python 2.6, 2.7, 3.2, 3.3 and PyPy are supported.
qdb <https://pypi.python.org/pypi/qdb>
_remote_pdb
logger instead of the root one.
Contributed by Terence Honles in #24 <https://github.com/ionelmc/python-remote-pdb/pull/24>
_.pdb
- BdbQuit
will now be raised on quitting.
Contributed by Anthony Sottile in #18 <https://github.com/ionelmc/python-remote-pdb/pull/18>
_.
BACKWARDS INCOMPATIBLE.REMOTE_PDB_QUIET=1
to silence output.
Contributed by Anthony Sottile in #19 <https://github.com/ionelmc/python-remote-pdb/pull/19>
_.breakpoint()
.REMOTE_PDB_HOST
/REMOTE_PDB_PORT
environment variables. Contributed by Matthew Wilkes in #14 <https://github.com/ionelmc/python-remote-pdb/pull/14>
_.rw
file wrappers around sockets (turns out socket's makefile
is very buggy in Python 3.6 and
later - output is discarded <https://bugs.python.org/issue35928>
). Contributed in #13 <https://github.com/ionelmc/python-remote-pdb/pull/13>
.remote_pdb
console script.FAQs
Remote vanilla PDB (over TCP sockets) *done right*: no extras, proper handling around connection failures and CI. Based on `pdbx <https://pypi.python.org/pypi/pdbx>`_.
We found that remote-pdb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.