Skip to main content

remote pdb which connects to developer

Project description

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 :).

Why active?

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

pdbme-cli is a simple tool, using tmux, tcpwrapper and socat to accept incoming connections and spawn tmux session for each incoming breakpoint.

Installation in CPython (standard Python)

pip install pdbme (not yet on PyPi)

or

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 or breakpoint::

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)

Calling handle_trap will overwrite the existing handler for SIGTRAP if one has already been defined in your application.

Author(s)

Łukasz Mach maho@pagema.net - http://pagema.net/

based on work of rpdb author: Bertrand Janin b@janin.com - http://tamentis.com/

and rpdbs contributors: (chronological, latest first):

0.0.1 (2019-06-14)

  • New functionality, new package name, new versioning....
  • dropped some rpdb functionality,

0.1.6 (2015-01-05)

  • Give access to attributes of stdin and stdout (by @fuxpavel).
  • Add rpdb.post_mortem(), similar to pdb.post_mortem() (by @CamDavidsonPilon).

0.1.5 (2014-10-16)

  • 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)

0.1.4 (2014-04-28)

  • Expose the addr, port arguments to the set_trace method (thanks to @niedbalski).

0.1.3 (2013-08-02)

  • Remove a try/finally that seemed to shift the trace location (thanks to k4ml@github).

0.1.2 (2012-01-26)

  • Catch IOError raised by print in initialization, it may not work in some environments (e.g. mod_wsgi). (Menno Smits)

0.1.1 (2010-05-09)

Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdbme-0.0.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

pdbme-0.0.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file pdbme-0.0.1.tar.gz.

File metadata

  • Download URL: pdbme-0.0.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for pdbme-0.0.1.tar.gz
Algorithm Hash digest
SHA256 484fef178894c51aeb47aa04214cc5bad6d77174aba4c08ae295e7fb756a161b
MD5 00c3cd761870bfd025488312ff4f895a
BLAKE2b-256 b8bfb1ae78a94943048243c919a0a30cf32fe8d853c8657236c70ab5c262be13

See more details on using hashes here.

File details

Details for the file pdbme-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pdbme-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for pdbme-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fdbdd47cea5b435a3136c46df63badb18c75be848ec41488fcf1e036c97cef9f
MD5 4dd501daea97e0e5fffa0719e095f3e7
BLAKE2b-256 301ef64ef443a8e3d87ee994e3e04c3f1d1c268ac387d5456215ca781b3975a6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page