{"id":21810464,"url":"https://github.com/kmaork/madbg","last_synced_at":"2025-04-07T17:07:21.950Z","repository":{"id":35620381,"uuid":"194724457","full_name":"kmaork/madbg","owner":"kmaork","description":"A fully-featured remote and preemptive debugger for python","archived":false,"fork":false,"pushed_at":"2024-09-04T22:08:48.000Z","size":168,"stargazers_count":280,"open_issues_count":21,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T16:13:49.363Z","etag":null,"topics":["attach","cli","debugger","debugger-library","ipdb","ipython-debugger","pdb","preemptive","pty","python","python-library","remote-debug","remote-debugger","terminal","tty","tty-features"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/madbg/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kmaork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"kmaork"}},"created_at":"2019-07-01T18:32:10.000Z","updated_at":"2025-03-21T22:19:05.000Z","dependencies_parsed_at":"2024-06-19T22:58:21.846Z","dependency_job_id":"d25b21d4-3628-48de-8058-000a4e23d848","html_url":"https://github.com/kmaork/madbg","commit_stats":{"total_commits":87,"total_committers":2,"mean_commits":43.5,"dds":"0.011494252873563204","last_synced_commit":"5688801bb97d725c6d8699588e31ab40dc3aa773"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmaork%2Fmadbg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmaork%2Fmadbg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmaork%2Fmadbg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmaork%2Fmadbg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kmaork","download_url":"https://codeload.github.com/kmaork/madbg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694875,"owners_count":20980733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attach","cli","debugger","debugger-library","ipdb","ipython-debugger","pdb","preemptive","pty","python","python-library","remote-debug","remote-debugger","terminal","tty","tty-features"],"created_at":"2024-11-27T13:35:48.470Z","updated_at":"2025-04-07T17:07:21.925Z","avatar_url":"https://github.com/kmaork.png","language":"Python","funding_links":["https://github.com/sponsors/kmaork"],"categories":[],"sub_categories":[],"readme":"# madbg\n[![Tests (GitHub Actions)](https://github.com/kmaork/madbg/workflows/Tests/badge.svg)](https://github.com/kmaork/madbg)\n[![PyPI Supported Python Versions](https://img.shields.io/pypi/pyversions/madbg.svg)](https://pypi.python.org/pypi/madbg/)\n[![PyPI version](https://badge.fury.io/py/madbg.svg)](https://badge.fury.io/py/madbg)\n[![GitHub license](https://img.shields.io/github/license/kmaork/madbg)](https://github.com/kmaork/madbg/blob/master/LICENSE.txt)\n\nA fully-featured remote debugger for python.\n\n- Provides a full remote tty, allowing sending keyboard signals to the debugger,\ntab completion, command history, line editing and more\n- Runs the IPython debugger with all its capabilities\n- Allows attaching to running programs preemptively (does not require gdb, unlike similar tools)\n- Affects the debugged program [minimally](#possible-effects), although not yet recommended for use in production environments\n- Provides TTY features even when debugged program is a deamon, or run outside a terminal\n\n## Installation\n```\npip install madbg\n```\n\n## Usage\nMadbg provide both a python API and a CLI.\n\n### Attaching to a running process\n```\nmadbg attach \u003cpid\u003e\n```\nOr\n```python\nimport madbg\nmadbg.attach_to_process(pid)\n```\n\u003e **Warning**  \n\u003e  - Attaching on linux could potentially deadlock the target process. Not recommneded for use in production environments yet.\n\u003e  - `madbg` has to be installed in the target process' interpreter for `attach` to work.\n\n### Starting a debugger\n#### Using the CLI\nRun a python file with automatic post-mortem:\n```\nmadbg run path_to_your_script.py \u003cargs_for_script ...\u003e\n```\nRun a python module similarly to `python -m`:\n```\nmadbg run -m module.name \u003cargs_for_script ...\u003e\n```\nStart a script, starting the debugger from the first line: \n```\nmadbg run --use-set-trace script.py \u003cargs_for_script ...\u003e\n```\n\n#### Using the API\nStart a debugger in the next line:\n```python\nmadbg.set_trace()\n```\nContinue running the program until a client connects, then stop it and start a debugger:\n```python\nmadbg.set_trace_on_connect()\n```\nAfter an exception has occurred, or in an exception context, start a debugger in the frame the exception was raised from:\n```python\nmadbg.post_mortem()\n```\n\n### Connecting to a debugger\n#### Using the CLI\n```\nmadbg connect\n```\n\n#### Using the API\n```python\nmadbg.connect_to_debugger()\n```\n\n### Connection\nAll madbg API functions and CLI entry points allow using a custom IP and port (the default is `127.0.0.1:3513`), for example:\n\n```python\nmadbg.set_trace(ip='0.0.0.0', port=1337)\n```\nor\n```\nmadbg connect 8.8.8.8 1337\n```\n## Platforms\n\nMadbg supports linux with python\u003e=3.8.\n\n## Possible effects\n\nWhat madbg does that might affect a debugged program:\n- Changes the pgid and sid of the debugged process\n- Changes the CTTY of the debugged process\n- Affects child processes in unknown ways (Not tested yet)\n\nWhat madbg doesn't do:\n- Writes or reads from stdio\n- Feeds your cat\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmaork%2Fmadbg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkmaork%2Fmadbg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmaork%2Fmadbg/lists"}