-
-
Notifications
You must be signed in to change notification settings - Fork 474
Add --debug option to briefcase run
#2173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 101 commits
Commits
Show all changes
141 commits
Select commit
Hold shift + click to select a range
c19ea84
Added initial remote debugging support
timrid f138e7a
- added plugin system for debugger
timrid fb79869
some cleanups
timrid 70b290e
added "pth_folder_path" for iOS and Linux
timrid 8746452
- use `BRIEFCASE_MAIN_MODULE` environment variable to start the remot…
timrid aad7565
fix for linux flatpak
timrid 6d86c6c
change "_briefcase_launcher" approach to an approach with an separate…
timrid dd28eff
add enviroment variable on android
timrid 1946e31
set environment variables on ios
timrid bb238d6
fix path mapping for android
timrid aa1df93
add remote debug support via environment variable for flatpak
timrid ea5f3f7
revert unnesessary changes on xcode
timrid 5d0232a
changed "org.beeware.ENV" to "org.beeware.ENVIRON"
timrid dc3eb35
add BRIEFCASE_DEBUG to android
timrid 97b9a9b
Add sources to the extract_packages so that the debugger can get the …
timrid e6b5167
remove port forwarding on android when "briefcase run" stops
timrid 14fec61
removed unnessesary output to the console
timrid cf137bf
- Added option "--debug" for build, run and update command.
timrid 2c14a4c
make android working and remove unnecessary code
timrid cd99d80
fixed all unit tests
timrid e612e45
Differentiate between "debug_mode" and "debugger". The selected debug…
timrid 4446968
make android debugging working again
timrid 88b71a7
Only forward port on android when "debugger_host" is "localhost"
timrid e7fe385
added documentation
timrid 3d1e776
add a small how to for debugging with vscode
timrid fbb0c33
fixed a few pytest errors
timrid ddaf6a1
debug_mode is bool
timrid b67ac3f
env is not needed for adb forward/reverse
timrid 21463e9
added unittests
timrid 32337d8
Merge branch 'beeware:main' into feature/debugger-support
timrid 84ec2b0
fixed test case and corrected changelog entry
timrid 68128ab
fixed typo
timrid f5242f7
remove iOS environment variables when stopped
timrid e5ef27a
Merge branch 'main' into feature/debugger-support
timrid 5c80cf5
fixed some unit tests
timrid 9314998
added `debug_mode` in `AppConfig` and fixed unit tests
timrid cb5a32e
add context manager for android debugging connection
timrid b9d9d4b
add context manager for iOS environment variables
timrid 478eb56
removed "debug_requires" and "debug_mode".
timrid 1a7cd37
embed debugger support package into briefcase
timrid ec47b9f
"pdb" is now the default if no debugger is specified
timrid 823edd7
Merge branch 'main' into feature/debugger-support
timrid f9198eb
corrected formatting
timrid 123e932
use "remote-pdb"
timrid 1786d7a
removed duplicate code
timrid 4372e21
telnet is also available on linux
timrid 582b57d
fixed unit tests
timrid ca55ef7
fixed more unit tests
timrid 5bd4257
fixed docs
timrid d59b2ff
removed unnecessary branch
timrid 4259f4a
fixed more CI errors
timrid 68179ec
corrected the docs a little
timrid a382fbb
- removed all platform specific code
timrid 40b3e88
fixed unit tests
timrid 00c9376
Merge branch 'main' into feature/debugger-support
timrid 87e675a
fixed unit tests in python 3.9 & 3.10
timrid 7eb8e4b
Updated docs
timrid a3d15f3
removed how-to guides, as they are not working yet.
timrid 5ff73ea
corrected changelog
timrid 8843ab3
change from dynamic creation of debugger-support packages to a static…
timrid 7772c79
Added Windows debugging support
timrid 6ffb51c
Added macOS debugging support
timrid 57d1d76
Update docs
timrid 6eaacd1
Added detection if briefcase is installed as editable
timrid 2cddf89
Added restriction hint for macOS.
timrid 3aa88bf
typo
timrid 5add24b
Merge remote-tracking branch 'origin/main' into feature/debugger-support
timrid 456c373
more docstring optimizations
timrid 46a88cf
remove restriction to min. macOS 14
timrid 202d15e
correct changelog
timrid 183c311
added missing unittests
timrid 92da289
added missing test
timrid 5a70721
fixed tests for windows
timrid c7f14c5
moved editable check logic to debuggers folder
timrid 2a1dc1b
added hints and cosmetic changes
timrid 0b879d5
removed "-debuger-support" from name
timrid dacf7ea
fixed unit tests
timrid 84ee166
renamed packages
timrid 3c5ab10
added unittests, tox-config and ci for briefcase-debugpy and briefcas…
timrid 9828dba
clarified default parameter of --debug
timrid 1a812bb
added testcase for os.__file__ bugfix
timrid 73b6028
Merge remote-tracking branch 'remotes/origin/main' into ci-test
timrid 68f22c6
Add how-to for debugging support
timrid 17f2a93
"justMyCode" has to be set to false
timrid c4e0ed0
added hint to build and run, that the selected debuggers has to match.
timrid 27af64e
added warning to packaging
timrid 4c8a4f0
removed reference to android
timrid 5224177
removed test ci branch used for testing in my fork
timrid 42554e9
add verbose debugpy output
timrid d06f45c
correct comment
timrid 17df334
merged "briefcase-debugpy" and "briefcase-pdb" to "briefcase-debugger"
timrid b9ebbee
fixed unit tests
timrid db57422
remove build folder
timrid 58cb41b
add missing test in briefcase
timrid 1d2f50f
whe a regex is not found in path this should be an error instead of s…
timrid 550a3d1
REMOTE_DEBUGGER_STARTED is unnecessary
timrid 304b531
add code coverage
timrid 462d1b6
no german
timrid dbf3ac5
Merge remote-tracking branch 'remotes/origin/main' into feature/debug…
timrid e260e98
modifications because 3.9 is not supported any longer
timrid 092f356
remove ci-test branch
timrid abd042d
update documentation, add comments, correct formating
timrid deae895
fixed licens badge
timrid 16ae953
added more docs
timrid 296f7d2
moved tox debugger config
timrid caf9f5e
use dependency groups
timrid 535d49e
start debugger in the .pth file and not on import
timrid 673dbf0
reorderd sections in pyproject.toml
timrid 88ba809
parameterized path mapping tests with additional cases for andorid on…
timrid aa9b600
fixed path mapping test on posix
timrid f57abfd
remove "if verbose" inside test cases
timrid b1ef9a0
rename "debugger-support" folder to just "debugger"
timrid ba8c990
actually rename the folder "debugger-support" to "debugger"
timrid 5a560c9
moved "debugger-host" and "debugger-port" arguments to "_add_debug_op…
timrid 07b56e2
moved "debugger_host" and "debugger_port" to AppConfig
timrid 886b3c6
fixed "debugger_port" type to int
timrid c039165
moved "debugger_config" to "BaseDebugger"
timrid 6c60d3c
use `nc` instead of `rlwrap socat` and make hints platform aware.
timrid e658d85
fixed unit tests
timrid 4c9c81b
debugpy v1.8.17 fixed the os.__file__ handling. So this workaround is…
timrid b60c0c5
remove "PureWindowsPath" from tests
timrid 1218a6a
fixed unit tests
timrid 9657c95
updated docs
timrid 56623bd
simplify help msg creation
timrid 1800212
refactored commands to variable and removed host os hint.
timrid ea66f50
use "artifact-basename" in ci.yml
timrid cfe33c9
updated release.yml
timrid d072152
Merge branch 'main' into feature/debugger-support
timrid 90f3f4c
converted docs from .rst to .md
timrid f648508
environments created with tox_uv dont have pip preinstalled
timrid 8b13a6c
fixed ruff errors
timrid 35907f2
fixed spelling issues
timrid 0342efc
fix ci
timrid 3aa81ed
Merge branch 'main' into feature/debugger-support
timrid 2db8449
Merge branch 'main' into feature/debugger-support
mhsmith e6c4138
Documentation cleanups
mhsmith f1f11b6
Rename 2147.feature.rst to 2147.feature.md and reword
mhsmith 5e74fef
Update docs URLs; use `%(default)s` in argparse help
mhsmith 234195e
add hint that you have to define `breakpoint()` somewhere when using …
timrid 4b123ba
Add missing comma
mhsmith c917269
Fix long line
mhsmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,16 @@ jobs: | |
| with: | ||
| attest: ${{ inputs.attest-package }} | ||
|
|
||
| package-debugger: | ||
| name: Package Debugger | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| attestations: write | ||
| uses: beeware/.github/.github/workflows/python-package-create.yml@main | ||
| with: | ||
| build-subdirectory: "debugger-support" | ||
|
|
||
| package-automation: | ||
| name: Package Automation | ||
| permissions: | ||
|
|
@@ -58,7 +68,7 @@ jobs: | |
|
|
||
| unit-tests: | ||
| name: Unit tests | ||
| needs: [ pre-commit, towncrier, package ] | ||
| needs: [ pre-commit, towncrier, package, package-debugger ] | ||
| runs-on: ${{ matrix.platform }} | ||
| continue-on-error: ${{ matrix.experimental || false }} | ||
| strategy: | ||
|
|
@@ -101,7 +111,7 @@ jobs: | |
| requirements: tox | ||
| extra: dev | ||
|
|
||
| - name: Test | ||
| - name: Test Briefcase | ||
| id: test | ||
| run: | | ||
| RUNNER_OS=$(cut -d- -f1 <<< ${{ matrix.platform }}) | ||
|
|
@@ -124,6 +134,16 @@ jobs: | |
| # coverage reporting must use the same Python version used to produce coverage | ||
| run: tox -qe coverage$(tr -dc "0-9" <<< "${{ matrix.python-version }}") | ||
|
|
||
| - name: Get Debugger Package | ||
| uses: actions/[email protected] | ||
| with: | ||
| name: ${{ needs.package-debugger.outputs.artifact-name }} | ||
| path: dist | ||
|
|
||
| - name: Test Debugger | ||
| run: | | ||
| tox -e py-debugger --installpkg dist/briefcase_debugger-*.whl | ||
|
|
||
| coverage: | ||
| name: Project coverage | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| /dist | ||
| /build | ||
| automation/build | ||
| debugger-support/build | ||
| docs/_build/ | ||
| distribute-* | ||
| .DS_Store | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Added basic functions for an ``--debug <debugger>`` option for Windows and macOS. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Briefcase Debugger Support | ||
| This package contains the debugger support package for the `pdb` and `debugpy` debuggers. | ||
|
|
||
| It starts the remote debugger automatically at startup through an .pth file, if a `BRIEFCASE_DEBUGGER` environment variable is set. | ||
|
|
||
| ## Installation | ||
| Normally you do not need to install this package manually, because it is done automatically by briefcase using the `--debug=pdb` or `--debug=debugpy` option. | ||
timrid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| [build-system] | ||
| requires = [ | ||
| # keep versions in sync with automation/pyproject.toml and ../pyproject.toml | ||
| "setuptools==80.9.0", | ||
| "setuptools_scm==8.3.1", | ||
| ] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "briefcase-debugger" | ||
| description = "Add-on for briefcase to add remote debugging." | ||
timrid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| readme = "README.md" | ||
| license = "BSD-3-Clause" | ||
timrid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| dependencies = [ | ||
| # see "pdb" or "debugpy" optional dependencies below | ||
| ] | ||
| dynamic = ["version"] | ||
|
|
||
| [tool.setuptools_scm] | ||
| root = "../" | ||
timrid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| [project.optional-dependencies] | ||
| dev = [ | ||
| "pytest == 8.4.1", | ||
| "coverage[toml] == 7.10.2", | ||
| ] | ||
timrid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| pdb = [ | ||
| "remote-pdb>=2.1.0,<3.0.0" | ||
timrid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ] | ||
| debugpy = [ | ||
| "debugpy>=1.8.14,<2.0.0" | ||
| ] | ||
|
|
||
| [tool.coverage.run] | ||
| parallel = true | ||
| branch = true | ||
| relative_files = true | ||
| source_pkgs = ["briefcase_debugger"] | ||
|
|
||
| [tool.coverage.paths] | ||
| source = [ | ||
| "src", | ||
| "**/site-packages", | ||
| ] | ||
|
|
||
| [tool.coverage.report] | ||
| show_missing = true | ||
| skip_covered = true | ||
| skip_empty = true | ||
| precision = 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import os | ||
|
|
||
| import setuptools | ||
| from setuptools.command.install import install | ||
|
|
||
|
|
||
| # Copied from setuptools: | ||
| # (https://github.com/pypa/setuptools/blob/7c859e017368360ba66c8cc591279d8964c031bc/setup.py#L40C6-L82) | ||
| class install_with_pth(install): | ||
| """Custom install command to install a .pth file for distutils patching. | ||
| This hack is necessary because there's no standard way to install behavior | ||
| on startup (and it's debatable if there should be one). This hack (ab)uses | ||
| the `extra_path` behavior in Setuptools to install a `.pth` file with | ||
| implicit behavior on startup to give higher precedence to the local version | ||
| of `distutils` over the version from the standard library. | ||
| Please do not replicate this behavior. | ||
timrid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
|
|
||
| _pth_name = "briefcase_debugger" | ||
| _pth_contents = "import briefcase_debugger" | ||
timrid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| def initialize_options(self): | ||
| install.initialize_options(self) | ||
| self.extra_path = self._pth_name, self._pth_contents | ||
|
|
||
| def finalize_options(self): | ||
| install.finalize_options(self) | ||
| self._restore_install_lib() | ||
|
|
||
| def _restore_install_lib(self): | ||
| """Undo secondary effect of `extra_path` adding to `install_lib`""" | ||
| suffix = os.path.relpath(self.install_lib, self.install_libbase) | ||
|
|
||
| if suffix.strip() == self._pth_contents.strip(): | ||
| self.install_lib = self.install_libbase | ||
|
|
||
|
|
||
| setuptools.setup( | ||
| cmdclass={"install": install_with_pth}, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import json | ||
| import os | ||
| import sys | ||
| import traceback | ||
|
|
||
|
|
||
| def start_remote_debugger(): | ||
| try: | ||
| # check verbose output | ||
| verbose = os.environ.get("BRIEFCASE_DEBUG", "0") == "1" | ||
|
|
||
| # reading config | ||
| config_str = os.environ.get("BRIEFCASE_DEBUGGER", None) | ||
|
|
||
| # skip debugger if no config is set | ||
| if config_str is None: | ||
| if verbose: | ||
| print( | ||
| "No 'BRIEFCASE_DEBUGGER' environment variable found. Debugger not starting." | ||
| ) | ||
| return # If BRIEFCASE_DEBUGGER is not set, this packages does nothing... | ||
|
|
||
| if verbose: | ||
| print(f"'BRIEFCASE_DEBUGGER'={config_str}") | ||
|
|
||
| # Parsing config json | ||
| config = json.loads(config_str) | ||
|
|
||
| # start debugger | ||
| print("Starting remote debugger...") | ||
| if config["debugger"] == "debugpy": | ||
| from briefcase_debugger.debugpy import start_debugpy | ||
|
|
||
| start_debugpy(config, verbose) | ||
| elif config["debugger"] == "pdb": | ||
| from briefcase_debugger.pdb import start_pdb | ||
|
|
||
| start_pdb(config, verbose) | ||
| else: | ||
| raise ValueError(f"Unknown debugger '{config['debugger']}'") | ||
| except Exception: | ||
| # Show exception and stop the whole application when an error occurs | ||
| print(traceback.format_exc()) | ||
| sys.exit(-1) | ||
|
|
||
|
|
||
| start_remote_debugger() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| from typing import TypedDict | ||
|
|
||
|
|
||
| class AppPathMappings(TypedDict): | ||
| device_sys_path_regex: str | ||
| device_subfolders: list[str] | ||
| host_folders: list[str] | ||
|
|
||
|
|
||
| class AppPackagesPathMappings(TypedDict): | ||
| sys_path_regex: str | ||
| host_folder: str | ||
|
|
||
|
|
||
| class DebuggerConfig(TypedDict): | ||
| debugger: str | ||
| host: str | ||
| port: int | ||
| app_path_mappings: AppPathMappings | None | ||
| app_packages_path_mappings: AppPackagesPathMappings | None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| import os | ||
| import re | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| import debugpy | ||
|
|
||
| from briefcase_debugger.config import DebuggerConfig | ||
|
|
||
|
|
||
| def find_first_matching_path(regex: str) -> str: | ||
| """Returns the first element of sys.paths that matches regex, otherwise None.""" | ||
| for p in sys.path: | ||
| if re.search(regex, p): | ||
| return p | ||
timrid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| raise ValueError(f"No sys.path entry matches regex '{regex}'") | ||
|
|
||
|
|
||
| def load_path_mappings(config: DebuggerConfig, verbose: bool) -> list[tuple[str, str]]: | ||
| app_path_mappings = config.get("app_path_mappings", None) | ||
| app_packages_path_mappings = config.get("app_packages_path_mappings", None) | ||
|
|
||
| mappings_list = [] | ||
| if app_path_mappings: | ||
| device_app_folder = find_first_matching_path( | ||
| app_path_mappings["device_sys_path_regex"] | ||
| ) | ||
| for app_subfolder_device, app_subfolder_host in zip( | ||
| app_path_mappings["device_subfolders"], | ||
| app_path_mappings["host_folders"], | ||
| strict=False, | ||
| ): | ||
| mappings_list.append( | ||
| ( | ||
| app_subfolder_host, | ||
| str(Path(device_app_folder) / app_subfolder_device), | ||
| ) | ||
| ) | ||
| if app_packages_path_mappings: | ||
| device_app_packages_folder = find_first_matching_path( | ||
| app_packages_path_mappings["sys_path_regex"] | ||
| ) | ||
| mappings_list.append( | ||
| ( | ||
| app_packages_path_mappings["host_folder"], | ||
| str(Path(device_app_packages_folder)), | ||
| ) | ||
| ) | ||
|
|
||
| if verbose: | ||
| print("Extracted path mappings:") | ||
| for idx, p in enumerate(mappings_list): | ||
| print(f"[{idx}] host = {p[0]}") | ||
| print(f"[{idx}] device = {p[1]}") | ||
timrid marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| return mappings_list | ||
|
|
||
|
|
||
| def start_debugpy(config: DebuggerConfig, verbose: bool): | ||
| host = config["host"] | ||
| port = config["port"] | ||
| path_mappings = load_path_mappings(config, verbose) | ||
|
|
||
| # There is a bug in debugpy that has to be handled until there is a new | ||
| # debugpy release, see https://github.com/microsoft/debugpy/issues/1943 | ||
| if not hasattr(os, "__file__"): | ||
| if verbose: | ||
| print("'os.__file__' not available. Patching it...") | ||
| os.__file__ = "" | ||
|
|
||
| # Starting remote debugger... | ||
| print(f"Starting debugpy in server mode at {host}:{port}...") | ||
| debugpy.listen((host, port), in_process_debug_adapter=True) | ||
|
|
||
| if verbose: | ||
| # pydevd is dynamically loaded and only available after debugpy is started | ||
| import pydevd | ||
|
|
||
| pydevd.DebugInfoHolder.DEBUG_TRACE_LEVEL = 3 | ||
|
|
||
| if len(path_mappings) > 0: | ||
| if verbose: | ||
| print("Adding path mappings...") | ||
|
|
||
| # pydevd is dynamically loaded and only available after a debugger has connected | ||
| import pydevd_file_utils | ||
|
|
||
| pydevd_file_utils.setup_client_server_paths(path_mappings) | ||
|
|
||
| print("The debugpy server started. Waiting for debugger to attach...") | ||
| print( | ||
| f""" | ||
| To connect to debugpy using VSCode add the following configuration to '.vscode/launch.json': | ||
| {{ | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| {{ | ||
| "name": "Briefcase: Attach (Connect)", | ||
| "type": "debugpy", | ||
| "request": "attach", | ||
| "connect": {{ | ||
| "host": "{host}", | ||
| "port": {port} | ||
| }}, | ||
| "justMyCode": false | ||
| }} | ||
| ] | ||
| }} | ||
| For more information see: https://briefcase.readthedocs.io/en/stable/how-to/debugging/vscode.html#bundled-app | ||
| """ | ||
| ) | ||
| debugpy.wait_for_client() | ||
|
|
||
| print("Debugger attached.") | ||
| print("-" * 75) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import sys | ||
|
|
||
| from remote_pdb import RemotePdb | ||
|
|
||
| from briefcase_debugger.config import DebuggerConfig | ||
|
|
||
|
|
||
| def start_pdb(config: DebuggerConfig, verbose: bool): | ||
| """Start remote PDB server.""" | ||
| # Parsing host/port | ||
| host = config["host"] | ||
| port = config["port"] | ||
|
|
||
| print( | ||
| f""" | ||
| Remote PDB server opened at {host}:{port}. | ||
| Waiting for debugger to attach... | ||
| To connect to remote PDB use eg.: | ||
| - telnet {host} {port} (Windows) | ||
| - rlwrap socat - tcp:{host}:{port} (Linux, macOS) | ||
mhsmith marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| For more information see: https://briefcase.readthedocs.io/en/stable/how-to/debugging/console.html#bundled-app | ||
| """ | ||
| ) | ||
|
|
||
| # Create a RemotePdb instance | ||
| remote_pdb = RemotePdb(host, port, quiet=True) | ||
|
|
||
| # Connect the remote PDB with the "breakpoint()" function | ||
| sys.breakpointhook = remote_pdb.set_trace | ||
|
|
||
| print("Debugger client attached.") | ||
| print("-" * 75) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.