diff options
| -rw-r--r-- | docs/dev/plugins.md | 1 | ||||
| -rw-r--r-- | python/__init__.py | 18 |
2 files changed, 18 insertions, 1 deletions
diff --git a/docs/dev/plugins.md b/docs/dev/plugins.md index 1985fcd9..ec6d769e 100644 --- a/docs/dev/plugins.md +++ b/docs/dev/plugins.md @@ -47,6 +47,7 @@ If you wish to debug your python scripts, there are a few methods: ### Remote debugging with VSCode: +1. Run `pip install --user debugpy` in the Python interpreter you have selected in Binary Ninja Settings. 1. In VSCode, open the Run and Debug sidebar. 1. Create a `launch.json` file if one does not already exist, or open `launch.json` if one does. 1. In `launch.json`, select Add Configuration > Python > Remote Attach diff --git a/python/__init__.py b/python/__init__.py index 4d9e1fd7..b81b6089 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -330,6 +330,14 @@ def open_view(*args, **kwargs) -> Optional[BinaryView]: def connect_pycharm_debugger(port=5678): + """ + Connect to PyCharm (Professional Edition) for debugging. + + .. note:: See https://docs.binary.ninja/dev/plugins.html#remote-debugging-with-intellij-pycharm + for step-by-step instructions on how to set up Python debugging. + + :param port: Port number for connecting to the debugger. + """ # Get pip install string from PyCharm's Python Debug Server Configuration # e.g. for PyCharm 2021.1.1 #PY-7142.13: # pip install --user pydevd-pycharm~=211.7142.13 @@ -338,7 +346,15 @@ def connect_pycharm_debugger(port=5678): def connect_vscode_debugger(port=5678): - # Note: Calling this from startup.py will cause Binary Ninja to hang on startup until VSCode starts debugging + """ + Connect to Visual Studio Code for debugging. This function blocks until the debugger + is connected! Not recommended for use in startup.py + + .. note:: See https://docs.binary.ninja/dev/plugins.html#remote-debugging-with-vscode + for step-by-step instructions on how to set up Python debugging. + + :param port: Port number for connecting to the debugger. + """ # pip install --user debugpy import debugpy # type: ignore import sys |
