madbg
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 environments
- 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
Release files for madbg 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| madbg-1.3.2.tar.gz | 12.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| madbg-1.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.6 kB
Release files / madbg-1.3.2.tar.gz
| Download URL | madbg-1.3.2.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e2d9a61bf48c5892cefd4237254be76ed1e94334ee33a8ec594a90e6b52dd1c
|
|
BLAKE2b-256 checksum How to use checksums |
5684dd2629377691a194b39d8a34a5514ebb13794d541684644f78239672f7c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / madbg-1.3.2-py3-none-any.whl
| Download URL | madbg-1.3.2-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ed17665566daada9ec2713794e8275a79cefa1765a311fd11bb45f17b3af878
|
|
BLAKE2b-256 checksum How to use checksums |
955417f03619b95f3fec8aad058716392ae40ba3e52a1c4909d37fe7c8ad7811
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|