Skip to main content

A fully-featured remote debugger for python

Project description

madbg

Tests (GitHub Actions) PyPI Supported Python Versions PyPI version GitHub license

A fully-featured remote debugger for python.

  • Provides a full remote tty, allowing sending keyboard signals to the debugger, tab completion, command history, line editing and more
  • Runs the IPython debugger with all its capabilities
  • Allows attaching to running programs preemptively (does not require gdb, unlike similar tools)
  • Affects the debugged program minimally, although not yet recommended for use in production environment
  • Provides TTY features even when debugged program is a deamon, or run outside a terminal.

Installation

pip install madbg

Usage

Madbg provide both a python API and a CLI.

Attaching to a running process

madbg attach <pid>

Or

import madbg
madbg.attach_to_process(pid)

Starting a debugger

Using the CLI

Run a python file with automatic post-mortem:

madbg run path_to_your_script.py <args_for_script ...>

Run a python module similarly to python -m:

madbg run -m module.name <args_for_script ...>

Start a script, starting the debugger from the first line:

madbg run --use-set-trace script.py <args_for_script ...>

Using the API

Start a debugger in the next line:

madbg.set_trace()

Continue running the program until a client connects, then stop it and start a debugger:

madbg.set_trace_on_connect()

After an exception has occurred, or in an exception context, start a debugger in the frame the exception was raised from:

madbg.post_mortem()

Connecting to a debugger

Using the CLI

madbg connect

Using the API

madbg.connect_to_debugger()

Connection

All madbg API functions and CLI entry points allow using a custom IP and port (the default is 127.0.0.1:3513), for example:

madbg.set_trace(ip='0.0.0.0', port=1337)

or

madbg connect 8.8.8.8 1337

Platforms

Madbg supports linux with python>=3.7.

Possible effects

What madbg does that might affect a debugged program:

  • Changes the pgid and sid of the debugged process
  • Changes the CTTY of the debugged process
  • Affects child processes in unknown ways (Not tested yet)

What madbg doesn't do:

  • Writes or reads from stdio
  • Feeds your cat

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

madbg-1.1.5.zip (16.2 kB view details)

Uploaded Source

Built Distribution

madbg-1.1.5-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file madbg-1.1.5.zip.

File metadata

  • Download URL: madbg-1.1.5.zip
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for madbg-1.1.5.zip
Algorithm Hash digest
SHA256 d0d0d2646c6c24d1f2d475fe59ddc014a5a53dd48b4951ae6b448ca583eb4b82
MD5 2fe57f7207f5581579ab8f2191f0903f
BLAKE2b-256 2fe0878c3ddb933b5f60f9b73d0635f4fff8e65d59187f09421517f7f710d38e

See more details on using hashes here.

File details

Details for the file madbg-1.1.5-py3-none-any.whl.

File metadata

  • Download URL: madbg-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for madbg-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c735e05095550034c7c5c228c75241f938d7e00493bf3ca24257f2766fd06646
MD5 c71ec1a23a92af3bfe258d3d2413e358
BLAKE2b-256 cdc36bc41f43d9633a70b179a7103e41d51d444dd2499ccf0eead188168ac81e

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