mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Resolved an issue where the PlatformIO Debugging solution was not escaping the tool installation process into MI2 correctly // Resolve #4565
This commit is contained in:
@ -6,6 +6,7 @@ Release Notes
|
|||||||
.. |LDF| replace:: `LDF <https://docs.platformio.org/en/latest/librarymanager/ldf.html>`__
|
.. |LDF| replace:: `LDF <https://docs.platformio.org/en/latest/librarymanager/ldf.html>`__
|
||||||
.. |INTERPOLATION| replace:: `Interpolation of Values <https://docs.platformio.org/en/latest/projectconf/interpolation.html>`__
|
.. |INTERPOLATION| replace:: `Interpolation of Values <https://docs.platformio.org/en/latest/projectconf/interpolation.html>`__
|
||||||
.. |UNITTESTING| replace:: `Unit Testing <https://docs.platformio.org/en/latest/advanced/unit-testing/index.html>`__
|
.. |UNITTESTING| replace:: `Unit Testing <https://docs.platformio.org/en/latest/advanced/unit-testing/index.html>`__
|
||||||
|
.. |DEBUGGING| replace:: `Debugging <https://docs.platformio.org/en/latest/plus/debugging.html>`__
|
||||||
|
|
||||||
.. _release_notes_6:
|
.. _release_notes_6:
|
||||||
|
|
||||||
@ -26,9 +27,10 @@ PlatformIO Core 6
|
|||||||
* Implemented a fix for shell injection vulnerabilities when converting INO files to CPP, ensuring your code is safe and secure (`issue #4532 <https://github.com/platformio/platformio-core/issues/4532>`_)
|
* Implemented a fix for shell injection vulnerabilities when converting INO files to CPP, ensuring your code is safe and secure (`issue #4532 <https://github.com/platformio/platformio-core/issues/4532>`_)
|
||||||
* Restored the project generator for the `NetBeans IDE <https://docs.platformio.org/en/latest/integration/ide/netbeans.html>`__, providing you with more flexibility and options for your development workflow
|
* Restored the project generator for the `NetBeans IDE <https://docs.platformio.org/en/latest/integration/ide/netbeans.html>`__, providing you with more flexibility and options for your development workflow
|
||||||
* Resolved an issue where the `build_cache_dir <https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/directory/build_cache_dir.html>`__ setting was not being recognized consistently across multiple environments (`issue #4574 <https://github.com/platformio/platformio-core/issues/4574>`_)
|
* Resolved an issue where the `build_cache_dir <https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/directory/build_cache_dir.html>`__ setting was not being recognized consistently across multiple environments (`issue #4574 <https://github.com/platformio/platformio-core/issues/4574>`_)
|
||||||
* Fixed an issue where organization details could not be updated using the `pio org update <https://docs.platformio.org/en/latest/core/userguide/org/cmd_update.html>`__ command
|
* Resolved an issue where organization details could not be updated using the `pio org update <https://docs.platformio.org/en/latest/core/userguide/org/cmd_update.html>`__ command
|
||||||
* Resolved an issue where the incorrect debugging environment was generated for VSCode in "Auto" mode (`issue #4597 <https://github.com/platformio/platformio-core/issues/4597>`_)
|
* Resolved an issue where the incorrect debugging environment was generated for VSCode in "Auto" mode (`issue #4597 <https://github.com/platformio/platformio-core/issues/4597>`_)
|
||||||
* Resolved an issue where native tests would fail if a custom program name was specified (`issue #4546 <https://github.com/platformio/platformio-core/issues/4546>`_)
|
* Resolved an issue where native tests would fail if a custom program name was specified (`issue #4546 <https://github.com/platformio/platformio-core/issues/4546>`_)
|
||||||
|
* Resolved an issue where the PlatformIO |DEBUGGING| solution was not escaping the tool installation process into MI2 correctly (`issue #4565 <https://github.com/platformio/platformio-core/issues/4565>`_)
|
||||||
|
|
||||||
6.1.6 (2023-01-23)
|
6.1.6 (2023-01-23)
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -28,9 +28,9 @@ from platformio.debug import helpers
|
|||||||
from platformio.debug.config.factory import DebugConfigFactory
|
from platformio.debug.config.factory import DebugConfigFactory
|
||||||
from platformio.debug.exception import DebugInvalidOptionsError
|
from platformio.debug.exception import DebugInvalidOptionsError
|
||||||
from platformio.debug.process.gdb import GDBClientProcess
|
from platformio.debug.process.gdb import GDBClientProcess
|
||||||
|
from platformio.exception import ReturnErrorCode
|
||||||
from platformio.platform.factory import PlatformFactory
|
from platformio.platform.factory import PlatformFactory
|
||||||
from platformio.project.config import ProjectConfig
|
from platformio.project.config import ProjectConfig
|
||||||
from platformio.project.exception import ProjectEnvsNotAvailableError
|
|
||||||
from platformio.project.helpers import is_platformio_project
|
from platformio.project.helpers import is_platformio_project
|
||||||
from platformio.project.options import ProjectOptions
|
from platformio.project.options import ProjectOptions
|
||||||
|
|
||||||
@ -81,61 +81,57 @@ def cli(
|
|||||||
project_dir = os.getenv(name)
|
project_dir = os.getenv(name)
|
||||||
|
|
||||||
with fs.cd(project_dir):
|
with fs.cd(project_dir):
|
||||||
return _debug_in_project_dir(
|
project_config = ProjectConfig.get_instance(project_conf)
|
||||||
|
project_config.validate(envs=[environment] if environment else None)
|
||||||
|
env_name = environment or helpers.get_default_debug_env(project_config)
|
||||||
|
|
||||||
|
if not interface:
|
||||||
|
return helpers.predebug_project(
|
||||||
|
ctx, project_dir, project_config, env_name, False, verbose
|
||||||
|
)
|
||||||
|
|
||||||
|
configure_args = (
|
||||||
ctx,
|
ctx,
|
||||||
project_dir,
|
project_config,
|
||||||
project_conf,
|
env_name,
|
||||||
environment,
|
|
||||||
load_mode,
|
load_mode,
|
||||||
verbose,
|
verbose,
|
||||||
interface,
|
|
||||||
__unprocessed,
|
__unprocessed,
|
||||||
)
|
)
|
||||||
|
if helpers.is_gdbmi_mode():
|
||||||
|
os.environ["PLATFORMIO_DISABLE_PROGRESSBAR"] = "true"
|
||||||
|
stream = helpers.GDBMIConsoleStream()
|
||||||
|
with proc.capture_std_streams(stream):
|
||||||
|
debug_config = _configure(*configure_args)
|
||||||
|
stream.close()
|
||||||
|
else:
|
||||||
|
debug_config = _configure(*configure_args)
|
||||||
|
|
||||||
|
_run(project_dir, debug_config, __unprocessed)
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _debug_in_project_dir(
|
def _configure(ctx, project_config, env_name, load_mode, verbose, __unprocessed):
|
||||||
ctx,
|
platform = PlatformFactory.new(
|
||||||
project_dir,
|
project_config.get(f"env:{env_name}", "platform"), autoinstall=True
|
||||||
project_conf,
|
)
|
||||||
environment,
|
|
||||||
load_mode,
|
|
||||||
verbose,
|
|
||||||
interface,
|
|
||||||
__unprocessed,
|
|
||||||
):
|
|
||||||
project_config = ProjectConfig.get_instance(project_conf)
|
|
||||||
project_config.validate(envs=[environment] if environment else None)
|
|
||||||
env_name = environment or helpers.get_default_debug_env(project_config)
|
|
||||||
|
|
||||||
if not interface:
|
|
||||||
return helpers.predebug_project(
|
|
||||||
ctx, project_dir, project_config, env_name, False, verbose
|
|
||||||
)
|
|
||||||
|
|
||||||
env_options = project_config.items(env=env_name, as_dict=True)
|
|
||||||
if "platform" not in env_options:
|
|
||||||
raise ProjectEnvsNotAvailableError()
|
|
||||||
|
|
||||||
debug_config = DebugConfigFactory.new(
|
debug_config = DebugConfigFactory.new(
|
||||||
PlatformFactory.new(env_options["platform"], autoinstall=True),
|
platform,
|
||||||
project_config,
|
project_config,
|
||||||
env_name,
|
env_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
if "--version" in __unprocessed:
|
if "--version" in __unprocessed:
|
||||||
return subprocess.run(
|
raise ReturnErrorCode(
|
||||||
[debug_config.client_executable_path, "--version"], check=True
|
subprocess.run(
|
||||||
|
[debug_config.client_executable_path, "--version"], check=True
|
||||||
|
).returncode
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fs.ensure_udev_rules()
|
fs.ensure_udev_rules()
|
||||||
except exception.InvalidUdevRules as exc:
|
except exception.InvalidUdevRules as exc:
|
||||||
click.echo(
|
click.echo(str(exc))
|
||||||
helpers.escape_gdbmi_stream("~", str(exc) + "\n")
|
|
||||||
if helpers.is_gdbmi_mode()
|
|
||||||
else str(exc) + "\n",
|
|
||||||
nl=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
rebuild_prog = False
|
rebuild_prog = False
|
||||||
preload = debug_config.load_cmds == ["preload"]
|
preload = debug_config.load_cmds == ["preload"]
|
||||||
@ -157,25 +153,10 @@ def _debug_in_project_dir(
|
|||||||
debug_config.load_cmds = []
|
debug_config.load_cmds = []
|
||||||
|
|
||||||
if rebuild_prog:
|
if rebuild_prog:
|
||||||
if helpers.is_gdbmi_mode():
|
click.echo("Preparing firmware for debugging...")
|
||||||
click.echo(
|
helpers.predebug_project(
|
||||||
helpers.escape_gdbmi_stream(
|
ctx, os.getcwd(), project_config, env_name, preload, verbose
|
||||||
"~", "Preparing firmware for debugging...\n"
|
)
|
||||||
),
|
|
||||||
nl=False,
|
|
||||||
)
|
|
||||||
stream = helpers.GDBMIConsoleStream()
|
|
||||||
with proc.capture_std_streams(stream):
|
|
||||||
helpers.predebug_project(
|
|
||||||
ctx, project_dir, project_config, env_name, preload, verbose
|
|
||||||
)
|
|
||||||
stream.close()
|
|
||||||
else:
|
|
||||||
click.echo("Preparing firmware for debugging...")
|
|
||||||
helpers.predebug_project(
|
|
||||||
ctx, project_dir, project_config, env_name, preload, verbose
|
|
||||||
)
|
|
||||||
|
|
||||||
# save SHA sum of newly created prog
|
# save SHA sum of newly created prog
|
||||||
if load_mode == "modified":
|
if load_mode == "modified":
|
||||||
helpers.is_prog_obsolete(debug_config.program_path)
|
helpers.is_prog_obsolete(debug_config.program_path)
|
||||||
@ -183,6 +164,10 @@ def _debug_in_project_dir(
|
|||||||
if not os.path.isfile(debug_config.program_path):
|
if not os.path.isfile(debug_config.program_path):
|
||||||
raise DebugInvalidOptionsError("Program/firmware is missed")
|
raise DebugInvalidOptionsError("Program/firmware is missed")
|
||||||
|
|
||||||
|
return debug_config
|
||||||
|
|
||||||
|
|
||||||
|
def _run(project_dir, debug_config, __unprocessed):
|
||||||
loop = asyncio.ProactorEventLoop() if IS_WINDOWS else asyncio.get_event_loop()
|
loop = asyncio.ProactorEventLoop() if IS_WINDOWS else asyncio.get_event_loop()
|
||||||
asyncio.set_event_loop(loop)
|
asyncio.set_event_loop(loop)
|
||||||
|
|
||||||
@ -199,5 +184,3 @@ def _debug_in_project_dir(
|
|||||||
finally:
|
finally:
|
||||||
client.close()
|
client.close()
|
||||||
loop.close()
|
loop.close()
|
||||||
|
|
||||||
return True
|
|
||||||
|
@ -146,9 +146,9 @@ class DebugConfigBase: # pylint: disable=too-many-instance-attributes
|
|||||||
|
|
||||||
def _load_build_data(self):
|
def _load_build_data(self):
|
||||||
data = load_build_metadata(os.getcwd(), self.env_name, cache=True, debug=True)
|
data = load_build_metadata(os.getcwd(), self.env_name, cache=True, debug=True)
|
||||||
if data:
|
if not data:
|
||||||
return data
|
raise DebugInvalidOptionsError("Could not load a build configuration")
|
||||||
raise DebugInvalidOptionsError("Could not load a build configuration")
|
return data
|
||||||
|
|
||||||
def _configure_server(self):
|
def _configure_server(self):
|
||||||
# user disabled server in platformio.ini
|
# user disabled server in platformio.ini
|
||||||
|
Reference in New Issue
Block a user