Fixed an issue with incorrect escaping of Windows slashes for PIO Unified Debugger

This commit is contained in:
Ivan Kravets
2019-07-15 14:20:14 +03:00
parent d5dd4d4b3a
commit b51f2ae722
5 changed files with 15 additions and 11 deletions

View File

@ -6,6 +6,12 @@ Release Notes
PlatformIO 4.0 PlatformIO 4.0
-------------- --------------
4.0.1 (2019-??-??)
~~~~~~~~~~~~~~~~~~
* Print `debug tool <http://docs.platformio.org/en/latest/plus/debugging.html#tools-debug-probes>`__ name for the active debugging session
* Fixed an issue with incorrect escaping of Windows slashes when using `PIO Unified Debugger <http://docs.platformio.org/en/latest/plus/debugging.html>`__ and "piped" openOCD
4.0.0 (2019-07-10) 4.0.0 (2019-07-10)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@ -66,9 +66,9 @@ class GDBClient(BaseProcess): # pylint: disable=too-many-instance-attributes
self._kill_previous_session() self._kill_previous_session()
patterns = { patterns = {
"PROJECT_DIR": helpers.escape_path(self.project_dir), "PROJECT_DIR": self.project_dir,
"PROG_PATH": helpers.escape_path(prog_path), "PROG_PATH": prog_path,
"PROG_DIR": helpers.escape_path(dirname(prog_path)), "PROG_DIR": dirname(prog_path),
"PROG_NAME": basename(splitext(prog_path)[0]), "PROG_NAME": basename(splitext(prog_path)[0]),
"DEBUG_PORT": self.debug_options['port'], "DEBUG_PORT": self.debug_options['port'],
"UPLOAD_PROTOCOL": self.debug_options['upload_protocol'], "UPLOAD_PROTOCOL": self.debug_options['upload_protocol'],

View File

@ -121,7 +121,7 @@ def validate_debug_options(cmd_ctx, env_options):
cwd=server_package_dir if server_package else None, cwd=server_package_dir if server_package else None,
executable=tool_settings['server'].get("executable"), executable=tool_settings['server'].get("executable"),
arguments=[ arguments=[
a.replace("$PACKAGE_DIR", escape_path(server_package_dir)) a.replace("$PACKAGE_DIR", server_package_dir)
if server_package_dir else a if server_package_dir else a
for a in tool_settings['server'].get("arguments", []) for a in tool_settings['server'].get("arguments", [])
]) ])

View File

@ -17,7 +17,6 @@ import signal
import click import click
from twisted.internet import protocol # pylint: disable=import-error from twisted.internet import protocol # pylint: disable=import-error
from platformio.commands.debug import helpers
from platformio.compat import string_types from platformio.compat import string_types
from platformio.proc import get_pythonexe_path from platformio.proc import get_pythonexe_path
from platformio.project.helpers import get_project_core_dir from platformio.project.helpers import get_project_core_dir
@ -30,8 +29,8 @@ class BaseProcess(protocol.ProcessProtocol, object):
STDOUT_CHUNK_SIZE = 2048 STDOUT_CHUNK_SIZE = 2048
COMMON_PATTERNS = { COMMON_PATTERNS = {
"PLATFORMIO_HOME_DIR": helpers.escape_path(get_project_core_dir()), "PLATFORMIO_HOME_DIR": get_project_core_dir(),
"PLATFORMIO_CORE_DIR": helpers.escape_path(get_project_core_dir()), "PLATFORMIO_CORE_DIR": get_project_core_dir(),
"PYTHONEXE": get_pythonexe_path() "PYTHONEXE": get_pythonexe_path()
} }

View File

@ -19,7 +19,6 @@ from twisted.internet import error # pylint: disable=import-error
from twisted.internet import reactor # pylint: disable=import-error from twisted.internet import reactor # pylint: disable=import-error
from platformio import exception, util from platformio import exception, util
from platformio.commands.debug import helpers
from platformio.commands.debug.process import BaseProcess from platformio.commands.debug.process import BaseProcess
from platformio.proc import where_is_program from platformio.proc import where_is_program
@ -67,15 +66,15 @@ class DebugServer(BaseProcess):
if openocd_pipe_allowed: if openocd_pipe_allowed:
args = [] args = []
if server['cwd']: if server['cwd']:
args.extend(["-s", helpers.escape_path(server['cwd'])]) args.extend(["-s", server['cwd']])
args.extend([ args.extend([
"-c", "gdb_port pipe; tcl_port disabled; telnet_port disabled" "-c", "gdb_port pipe; tcl_port disabled; telnet_port disabled"
]) ])
args.extend(server['arguments']) args.extend(server['arguments'])
str_args = " ".join( str_args = " ".join(
[arg if arg.startswith("-") else '"%s"' % arg for arg in args]) [arg if arg.startswith("-") else '"%s"' % arg for arg in args])
self._debug_port = '| "%s" %s' % ( self._debug_port = '| "%s" %s' % (server_executable, str_args)
helpers.escape_path(server_executable), str_args) self._debug_port = self._debug_port.replace("\\", "\\\\")
else: else:
env = os.environ.copy() env = os.environ.copy()
# prepend server "lib" folder to LD path # prepend server "lib" folder to LD path