From e6df155b16ee470200b3cda0c99a95e34a4a1d1b Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 6 May 2021 12:23:05 -0400 Subject: [PATCH 1/3] Initial support for a `--continue` flag for `--server` --- _pydevd_bundle/pydevd_command_line_handling.py | 1 + pydevd.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/_pydevd_bundle/pydevd_command_line_handling.py b/_pydevd_bundle/pydevd_command_line_handling.py index 2afae09e7..2985a352c 100644 --- a/_pydevd_bundle/pydevd_command_line_handling.py +++ b/_pydevd_bundle/pydevd_command_line_handling.py @@ -69,6 +69,7 @@ def convert_ppid(ppid): ArgHandlerWithParam('client-access-token'), ArgHandlerBool('server'), + ArgHandlerBool('continue'), ArgHandlerBool('DEBUG_RECORD_SOCKET_READS'), ArgHandlerBool('multiproc'), # Used by PyCharm (reuses connection: ssh tunneling) ArgHandlerBool('multiprocess'), # Used by PyDev (creates new connection to ide) diff --git a/pydevd.py b/pydevd.py index 4639778b6..9745addfa 100644 --- a/pydevd.py +++ b/pydevd.py @@ -3276,14 +3276,21 @@ def main(): apply_debugger_options(setup) + wait = True + if setup['continue']: + wait = False + try: - debugger.connect(host, port) + if wait: + debugger.connect(host, port) + else: + debugger.create_wait_for_connection_thread() except: sys.stderr.write("Could not connect to %s: %s\n" % (host, port)) pydev_log.exception() sys.exit(1) - globals = debugger.run(setup['file'], None, None, is_module) + globals = debugger.run(setup['file'], None, None, is_module, set_trace=wait) if setup['cmd-line']: debugger.wait_for_commands(globals) From 44b36f25795f0c3248cf7d8e94a1ae9a4714ccc1 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Fri, 7 May 2021 15:28:23 -0400 Subject: [PATCH 2/3] must install trace points --- pydevd.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pydevd.py b/pydevd.py index 9745addfa..0da7e2741 100644 --- a/pydevd.py +++ b/pydevd.py @@ -1376,6 +1376,8 @@ def __init__(self, py_db): def run(self): host = SetupHolder.setup['client'] + if host is None: + host = 'localhost' port = SetupHolder.setup['port'] self._server_socket = create_server_socket(host=host, port=port) @@ -2240,7 +2242,7 @@ def patch_threads(self): from _pydev_bundle.pydev_monkey import patch_thread_modules patch_thread_modules() - def run(self, file, globals=None, locals=None, is_module=False, set_trace=True): + def run(self, file, globals=None, locals=None, is_module=False, set_trace=True, wait=True): module_name = None entry_point_fn = '' if is_module: @@ -2322,7 +2324,8 @@ def run(self, file, globals=None, locals=None, is_module=False, set_trace=True): sys.path.insert(0, os.path.split(os_path_abspath(file))[0]) if set_trace: - self.wait_for_ready_to_run() + if wait: + self.wait_for_ready_to_run() # call prepare_to_run when we already have all information about breakpoints self.prepare_to_run() @@ -3290,7 +3293,7 @@ def main(): pydev_log.exception() sys.exit(1) - globals = debugger.run(setup['file'], None, None, is_module, set_trace=wait) + globals = debugger.run(setup['file'], None, None, is_module, wait=wait) if setup['cmd-line']: debugger.wait_for_commands(globals) From 88f964368723ace696289f770b98f8c1d542b535 Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Thu, 13 May 2021 11:21:01 -0400 Subject: [PATCH 3/3] if no host, default to inaddr_any --- pydevd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydevd.py b/pydevd.py index 0da7e2741..9ecfec061 100644 --- a/pydevd.py +++ b/pydevd.py @@ -1377,7 +1377,7 @@ def __init__(self, py_db): def run(self): host = SetupHolder.setup['client'] if host is None: - host = 'localhost' + host = '' port = SetupHolder.setup['port'] self._server_socket = create_server_socket(host=host, port=port)