@@ -3518,10 +3518,11 @@ class DevtoolIdeSdkGccTests(DevtoolIdeSdkTests):
# Start gdbserver on target using the task command (keep the ssh connection open while debugging)
ssh_gdbserver_cmd = [task_command] + task_args
- # Fix shell command escaping - remove extra quotes from the last argument
- # The task_args likely contains a quoted shell command that needs to be unquoted
+ # The tasks.json argument is formatted for an intermediate shell. Strip
+ # its quotes and restore dollar expansions before passing it directly to
+ # SSH via subprocess.
if len(ssh_gdbserver_cmd) > 0 and ssh_gdbserver_cmd[-1].startswith('"') and ssh_gdbserver_cmd[-1].endswith('"'):
- ssh_gdbserver_cmd[-1] = ssh_gdbserver_cmd[-1][1:-1] # Remove surrounding quotes
+ ssh_gdbserver_cmd[-1] = ssh_gdbserver_cmd[-1][1:-1].replace('\\$', '$') # Remove surrounding quotes
self.logger.debug(f"Starting gdbserver with command: {' '.join(ssh_gdbserver_cmd)}")
with RunCmdBackground(ssh_gdbserver_cmd, output_log=self._cmd_logger):
# Give gdbserver a moment to start