madbg


Namemadbg JSON
Version 1.3.2 PyPI version JSON
download
home_pagehttps://github.com/kmaork/madbg
SummaryA fully-featured remote debugger for python
upload_time2023-07-05 23:20:13
maintainer
docs_urlNone
authorMaor Kleinberger
requires_python>=3.7
license
keywords debugger remote tty attach ipdb pdb debug
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # madbg
[![Tests (GitHub Actions)](https://github.com/kmaork/madbg/workflows/Tests/badge.svg)](https://github.com/kmaork/madbg)
[![PyPI Supported Python Versions](https://img.shields.io/pypi/pyversions/madbg.svg)](https://pypi.python.org/pypi/madbg/)
[![PyPI version](https://badge.fury.io/py/madbg.svg)](https://badge.fury.io/py/madbg)
[![GitHub license](https://img.shields.io/github/license/kmaork/madbg)](https://github.com/kmaork/madbg/blob/master/LICENSE.txt)

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](#possible-effects), 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
```python
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:
```python
madbg.set_trace()
```
Continue running the program until a client connects, then stop it and start a debugger:
```python
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:
```python
madbg.post_mortem()
```

### Connecting to a debugger
#### Using the CLI
```
madbg connect
```

#### Using the API
```python
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:

```python
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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kmaork/madbg",
    "name": "madbg",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "debugger remote tty attach ipdb pdb debug",
    "author": "Maor Kleinberger",
    "author_email": "kmaork@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/56/84/dd2629377691a194b39d8a34a5514ebb13794d541684644f78239672f7c2/madbg-1.3.2.tar.gz",
    "platform": null,
    "description": "# 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 <pid>\n```\nOr\n```python\nimport madbg\nmadbg.attach_to_process(pid)\n```\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 <args_for_script ...>\n```\nRun a python module similarly to `python -m`:\n```\nmadbg run -m module.name <args_for_script ...>\n```\nStart a script, starting the debugger from the first line: \n```\nmadbg run --use-set-trace script.py <args_for_script ...>\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>=3.7.\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",
    "bugtrack_url": null,
    "license": "",
    "summary": "A fully-featured remote debugger for python",
    "version": "1.3.2",
    "project_urls": {
        "Homepage": "https://github.com/kmaork/madbg"
    },
    "split_keywords": [
        "debugger",
        "remote",
        "tty",
        "attach",
        "ipdb",
        "pdb",
        "debug"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "955417f03619b95f3fec8aad058716392ae40ba3e52a1c4909d37fe7c8ad7811",
                "md5": "05b302f1339e1ccf80ead642859074c4",
                "sha256": "0ed17665566daada9ec2713794e8275a79cefa1765a311fd11bb45f17b3af878"
            },
            "downloads": -1,
            "filename": "madbg-1.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "05b302f1339e1ccf80ead642859074c4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 13400,
            "upload_time": "2023-07-05T23:20:11",
            "upload_time_iso_8601": "2023-07-05T23:20:11.826184Z",
            "url": "https://files.pythonhosted.org/packages/95/54/17f03619b95f3fec8aad058716392ae40ba3e52a1c4909d37fe7c8ad7811/madbg-1.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5684dd2629377691a194b39d8a34a5514ebb13794d541684644f78239672f7c2",
                "md5": "3f6360d3c2990141825501644c270ca0",
                "sha256": "3e2d9a61bf48c5892cefd4237254be76ed1e94334ee33a8ec594a90e6b52dd1c"
            },
            "downloads": -1,
            "filename": "madbg-1.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "3f6360d3c2990141825501644c270ca0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 12203,
            "upload_time": "2023-07-05T23:20:13",
            "upload_time_iso_8601": "2023-07-05T23:20:13.288886Z",
            "url": "https://files.pythonhosted.org/packages/56/84/dd2629377691a194b39d8a34a5514ebb13794d541684644f78239672f7c2/madbg-1.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-05 23:20:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kmaork",
    "github_project": "madbg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "madbg"
}
        
Elapsed time: 0.12430s