Debugger: Allow spaces in arguments with LLDB

Change-Id: Iebc6f7975e9a306805911ed18eb4689074abd891
Task-number: QTCREATORBUG-22811
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-08-05 16:26:20 +02:00
parent ea901fd4f1
commit 5b33660a57
2 changed files with 3 additions and 15 deletions

View File

@@ -841,7 +841,7 @@ class Dumper(DumperBase):
self.startMode_ = args.get('startmode', 1)
self.breakOnMain_ = args.get('breakonmain', 0)
self.useTerminal_ = args.get('useterminal', 0)
self.processArgs_ = self.hexdecode(args.get('processargs'))
self.processArgs_ = self.hexdecode(args.get('processargs', '')).split('\0')
self.environment_ = args.get('environment', [])
self.environment_ = list(map(lambda x: self.hexdecode(x), self.environment_))
self.attachPid_ = args.get('attachpid', 0)
@@ -932,19 +932,7 @@ class Dumper(DumperBase):
else:
self.reportState('enginerunfailed')
else:
# This does not seem to work on Linux nor macOS?
#launchInfo = lldb.SBLaunchInfo([self.processArgs_])
#launchInfo.SetShellExpandArguments(True)
args = []
try:
import subprocess
cmd = 'for x in {} ; do printf "%s\n" "$x" ; done' \
.format(self.processArgs_)
args = subprocess.check_output(cmd, shell=True, cwd=self.workingDirectory_).split()
except:
# Wrong, but...
args = self.processArgs_
launchInfo = lldb.SBLaunchInfo(args)
launchInfo = lldb.SBLaunchInfo(self.processArgs_)
launchInfo.SetWorkingDirectory(self.workingDirectory_)
launchInfo.SetEnvironmentEntries(self.environment_, False)
if self.breakOnMain_:

View File

@@ -275,7 +275,7 @@ void LldbEngine::setupEngine()
cmd2.arg("nativemixed", isNativeMixedActive());
cmd2.arg("workingdirectory", rp.inferior.workingDirectory);
cmd2.arg("environment", rp.inferior.environment.toStringList());
cmd2.arg("processargs", toHex(rp.inferior.commandLineArguments));
cmd2.arg("processargs", toHex(QtcProcess::splitArgs(rp.inferior.commandLineArguments).join(QChar(0))));
if (terminal()) {
const qint64 attachedPID = terminal()->applicationPid();