Skip to content

Commit ba58db3

Browse files
committed
Introduced the capability to launch the debug server in a separate process // Resolve platformio#4722
1 parent 4729d9f commit ba58db3

File tree

8 files changed

+16
-30
lines changed

8 files changed

+16
-30
lines changed

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ test-driven methodologies, and modern toolchains for unrivaled success.
2121
~~~~~~~~~~~~~~~~~~~
2222

2323
* Added support for Python 3.12
24+
* Introduced the capability to launch the debug server in a separate process (`issue #4722 <https://github.com/platformio/platformio-core/issues/4722>`_)
2425
* Introduced a warning during the verification of MCU maximum RAM usage, signaling when the allocated RAM surpasses 100% (`issue #4791 <https://github.com/platformio/platformio-core/issues/4791>`_)
2526
* Drastically enhanced the speed of project building when operating in verbose mode (`issue #4783 <https://github.com/platformio/platformio-core/issues/4783>`_)
2627
* Upgraded the build engine to the latest version of SCons (4.6.0) to improve build performance, reliability, and compatibility with other tools and systems (`release notes <https://github.com/SCons/scons/releases/tag/4.6.0>`__)

platformio/debug/config/base.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525

2626
class DebugConfigBase: # pylint: disable=too-many-instance-attributes
27-
def __init__(self, platform, project_config, env_name, port=None):
27+
DEFAULT_PORT = None
28+
29+
def __init__(self, platform, project_config, env_name):
2830
self.platform = platform
2931
self.project_config = project_config
3032
self.env_name = env_name
@@ -48,7 +50,6 @@ def __init__(self, platform, project_config, env_name, port=None):
4850
self._load_cmds = None
4951
self._port = None
5052

51-
self.port = port
5253
self.server = self._configure_server()
5354

5455
try:
@@ -120,8 +121,10 @@ def extra_cmds(self):
120121
@property
121122
def port(self):
122123
return (
123-
self.env_options.get("debug_port", self.tool_settings.get("port"))
124-
or self._port
124+
self._port
125+
or self.env_options.get("debug_port")
126+
or self.tool_settings.get("port")
127+
or self.DEFAULT_PORT
125128
)
126129

127130
@port.setter

platformio/debug/config/generic.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717

1818
class GenericDebugConfig(DebugConfigBase):
19+
DEFAULT_PORT = ":3333"
1920
GDB_INIT_SCRIPT = """
2021
define pio_reset_halt_target
2122
monitor reset halt
@@ -31,8 +32,3 @@ class GenericDebugConfig(DebugConfigBase):
3132
pio_reset_halt_target
3233
$INIT_BREAK
3334
"""
34-
35-
def __init__(self, *args, **kwargs):
36-
if "port" not in kwargs:
37-
kwargs["port"] = ":3333"
38-
super().__init__(*args, **kwargs)

platformio/debug/config/jlink.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717

1818
class JlinkDebugConfig(DebugConfigBase):
19+
DEFAULT_PORT = ":2331"
1920
GDB_INIT_SCRIPT = """
2021
define pio_reset_halt_target
2122
monitor reset
@@ -36,11 +37,6 @@ class JlinkDebugConfig(DebugConfigBase):
3637
$INIT_BREAK
3738
"""
3839

39-
def __init__(self, *args, **kwargs):
40-
if "port" not in kwargs:
41-
kwargs["port"] = ":2331"
42-
super().__init__(*args, **kwargs)
43-
4440
@property
4541
def server_ready_pattern(self):
4642
return super().server_ready_pattern or ("Waiting for GDB connection")

platformio/debug/config/mspdebug.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717

1818
class MspdebugDebugConfig(DebugConfigBase):
19+
DEFAULT_PORT = ":2000"
1920
GDB_INIT_SCRIPT = """
2021
define pio_reset_halt_target
2122
end
@@ -29,8 +30,3 @@ class MspdebugDebugConfig(DebugConfigBase):
2930
pio_reset_halt_target
3031
$INIT_BREAK
3132
"""
32-
33-
def __init__(self, *args, **kwargs):
34-
if "port" not in kwargs:
35-
kwargs["port"] = ":2000"
36-
super().__init__(*args, **kwargs)

platformio/debug/config/qemu.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717

1818
class QemuDebugConfig(DebugConfigBase):
19+
DEFAULT_PORT = ":1234"
1920
GDB_INIT_SCRIPT = """
2021
define pio_reset_halt_target
2122
monitor system_reset
@@ -30,8 +31,3 @@ class QemuDebugConfig(DebugConfigBase):
3031
pio_reset_halt_target
3132
$INIT_BREAK
3233
"""
33-
34-
def __init__(self, *args, **kwargs):
35-
if "port" not in kwargs:
36-
kwargs["port"] = ":1234"
37-
super().__init__(*args, **kwargs)

platformio/debug/config/renode.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717

1818
class RenodeDebugConfig(DebugConfigBase):
19+
DEFAULT_PORT = ":3333"
1920
GDB_INIT_SCRIPT = """
2021
define pio_reset_halt_target
2122
monitor machine Reset
@@ -33,11 +34,6 @@ class RenodeDebugConfig(DebugConfigBase):
3334
monitor start
3435
"""
3536

36-
def __init__(self, *args, **kwargs):
37-
if "port" not in kwargs:
38-
kwargs["port"] = ":3333"
39-
super().__init__(*args, **kwargs)
40-
4137
@property
4238
def server_ready_pattern(self):
4339
return super().server_ready_pattern or (

platformio/debug/process/server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ async def run(self): # pylint: disable=too-many-branches
6262

6363
openocd_pipe_allowed = all(
6464
[
65-
not self.debug_config.env_options.get("debug_port"),
65+
not self.debug_config.env_options.get(
66+
"debug_port", self.debug_config.tool_settings.get("port")
67+
),
6668
"gdb" in self.debug_config.client_executable_path,
6769
"openocd" in server_executable,
6870
]

0 commit comments

Comments
 (0)