A fully-featured remote and preemptive debugger for python
A fully-featured remote debugger for python.
pip install madbg
Madbg provide both a python API and a CLI.
madbg attach <pid>
Or
import madbg
madbg.attach_to_process(pid)
Warning
- Attaching on linux could potentially deadlock the target process. Not recommneded for use in production environments yet.
madbg
has to be installed in the target process' interpreter forattach
to work.
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 ...>
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()
madbg connect
madbg.connect_to_debugger()
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
Madbg supports linux with python>=3.7.
What madbg does that might affect a debugged program:
What madbg doesn't do: