Skip to content

Commit

Permalink
Introduced the capability to launch the debug server in a separate pr…
Browse files Browse the repository at this point in the history
…ocess // Resolve #4722
  • Loading branch information
ivankravets committed Jan 9, 2024
1 parent 4729d9f commit ba58db3
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 30 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ test-driven methodologies, and modern toolchains for unrivaled success.
~~~~~~~~~~~~~~~~~~~

* Added support for Python 3.12
* Introduced the capability to launch the debug server in a separate process (`issue #4722 <https://github.com/platformio/platformio-core/issues/4722>`_)
* 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>`_)
* Drastically enhanced the speed of project building when operating in verbose mode (`issue #4783 <https://github.com/platformio/platformio-core/issues/4783>`_)
* 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>`__)
Expand Down
11 changes: 7 additions & 4 deletions platformio/debug/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@


class DebugConfigBase: # pylint: disable=too-many-instance-attributes
def __init__(self, platform, project_config, env_name, port=None):
DEFAULT_PORT = None

def __init__(self, platform, project_config, env_name):
self.platform = platform
self.project_config = project_config
self.env_name = env_name
Expand All @@ -48,7 +50,6 @@ def __init__(self, platform, project_config, env_name, port=None):
self._load_cmds = None
self._port = None

self.port = port
self.server = self._configure_server()

try:
Expand Down Expand Up @@ -120,8 +121,10 @@ def extra_cmds(self):
@property
def port(self):
return (
self.env_options.get("debug_port", self.tool_settings.get("port"))
or self._port
self._port
or self.env_options.get("debug_port")
or self.tool_settings.get("port")
or self.DEFAULT_PORT
)

@port.setter
Expand Down
6 changes: 1 addition & 5 deletions platformio/debug/config/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


class GenericDebugConfig(DebugConfigBase):
DEFAULT_PORT = ":3333"
GDB_INIT_SCRIPT = """
define pio_reset_halt_target
monitor reset halt
Expand All @@ -31,8 +32,3 @@ class GenericDebugConfig(DebugConfigBase):
pio_reset_halt_target
$INIT_BREAK
"""

def __init__(self, *args, **kwargs):
if "port" not in kwargs:
kwargs["port"] = ":3333"
super().__init__(*args, **kwargs)
6 changes: 1 addition & 5 deletions platformio/debug/config/jlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


class JlinkDebugConfig(DebugConfigBase):
DEFAULT_PORT = ":2331"
GDB_INIT_SCRIPT = """
define pio_reset_halt_target
monitor reset
Expand All @@ -36,11 +37,6 @@ class JlinkDebugConfig(DebugConfigBase):
$INIT_BREAK
"""

def __init__(self, *args, **kwargs):
if "port" not in kwargs:
kwargs["port"] = ":2331"
super().__init__(*args, **kwargs)

@property
def server_ready_pattern(self):
return super().server_ready_pattern or ("Waiting for GDB connection")
6 changes: 1 addition & 5 deletions platformio/debug/config/mspdebug.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


class MspdebugDebugConfig(DebugConfigBase):
DEFAULT_PORT = ":2000"
GDB_INIT_SCRIPT = """
define pio_reset_halt_target
end
Expand All @@ -29,8 +30,3 @@ class MspdebugDebugConfig(DebugConfigBase):
pio_reset_halt_target
$INIT_BREAK
"""

def __init__(self, *args, **kwargs):
if "port" not in kwargs:
kwargs["port"] = ":2000"
super().__init__(*args, **kwargs)
6 changes: 1 addition & 5 deletions platformio/debug/config/qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


class QemuDebugConfig(DebugConfigBase):
DEFAULT_PORT = ":1234"
GDB_INIT_SCRIPT = """
define pio_reset_halt_target
monitor system_reset
Expand All @@ -30,8 +31,3 @@ class QemuDebugConfig(DebugConfigBase):
pio_reset_halt_target
$INIT_BREAK
"""

def __init__(self, *args, **kwargs):
if "port" not in kwargs:
kwargs["port"] = ":1234"
super().__init__(*args, **kwargs)
6 changes: 1 addition & 5 deletions platformio/debug/config/renode.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


class RenodeDebugConfig(DebugConfigBase):
DEFAULT_PORT = ":3333"
GDB_INIT_SCRIPT = """
define pio_reset_halt_target
monitor machine Reset
Expand All @@ -33,11 +34,6 @@ class RenodeDebugConfig(DebugConfigBase):
monitor start
"""

def __init__(self, *args, **kwargs):
if "port" not in kwargs:
kwargs["port"] = ":3333"
super().__init__(*args, **kwargs)

@property
def server_ready_pattern(self):
return super().server_ready_pattern or (
Expand Down
4 changes: 3 additions & 1 deletion platformio/debug/process/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ async def run(self): # pylint: disable=too-many-branches

openocd_pipe_allowed = all(
[
not self.debug_config.env_options.get("debug_port"),
not self.debug_config.env_options.get(
"debug_port", self.debug_config.tool_settings.get("port")
),
"gdb" in self.debug_config.client_executable_path,
"openocd" in server_executable,
]
Expand Down

0 comments on commit ba58db3

Please sign in to comment.