forked from qt-creator/qt-creator
Debugger: Pass command line parameters with LLDB
Change-Id: Id25155688e0e9bbe0d45cde20563929b7370695d Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -658,7 +658,8 @@ class Dumper(DumperBase):
|
||||
|
||||
self.executable_ = args['executable']
|
||||
self.startMode_ = args.get('startMode', 1)
|
||||
self.processArgs_ = args.get('processArgs', '')
|
||||
self.processArgs_ = args.get('processArgs', [])
|
||||
self.processArgs_ = map(lambda x: self.hexdecode(x), self.processArgs_)
|
||||
self.attachPid_ = args.get('attachPid', 0)
|
||||
self.sysRoot_ = args.get('sysRoot', '')
|
||||
self.remoteChannel_ = args.get('remoteChannel', '')
|
||||
@@ -706,7 +707,7 @@ class Dumper(DumperBase):
|
||||
# stop
|
||||
self.report('state="enginerunandinferiorrunok"')
|
||||
else:
|
||||
launchInfo = lldb.SBLaunchInfo(self.processArgs_.split())
|
||||
launchInfo = lldb.SBLaunchInfo(self.processArgs_)
|
||||
launchInfo.SetWorkingDirectory(os.getcwd())
|
||||
environmentList = [key + "=" + value for key,value in os.environ.items()]
|
||||
launchInfo.SetEnvironmentEntries(environmentList, False)
|
||||
@@ -1592,6 +1593,10 @@ class Dumper(DumperBase):
|
||||
def convertHash(args):
|
||||
if sys.version_info[0] == 3:
|
||||
return args
|
||||
if isinstance(args, str):
|
||||
return args
|
||||
if isinstance(args, unicode):
|
||||
return args.encode('utf8')
|
||||
cargs = {}
|
||||
for arg in args:
|
||||
rhs = args[arg]
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/savedaction.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <texteditor/itexteditor.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
@@ -198,10 +199,19 @@ void LldbEngine::startLldb()
|
||||
void LldbEngine::setupInferior()
|
||||
{
|
||||
const DebuggerStartParameters &sp = startParameters();
|
||||
|
||||
QString executable;
|
||||
QStringList args;
|
||||
Utils::QtcProcess::prepareCommand(QFileInfo(sp.executable).absoluteFilePath(),
|
||||
sp.processArgs, &executable, &args);
|
||||
|
||||
Command cmd("setupInferior");
|
||||
cmd.arg("executable", QFileInfo(sp.executable).absoluteFilePath());
|
||||
cmd.arg("executable", executable);
|
||||
cmd.arg("startMode", sp.startMode); // directly relying on this is brittle wrt. insertions, so check it here
|
||||
cmd.arg("processArgs", sp.processArgs);
|
||||
cmd.beginList("processArgs");
|
||||
foreach (const QString &arg, args)
|
||||
cmd.arg(arg.toUtf8().toHex());
|
||||
cmd.endList();
|
||||
|
||||
// it is better not to check the start mode on the python sid (as we would have to duplicate the
|
||||
// enum values), and thus we assume that if the sp.attachPID is valid we really have to attach
|
||||
@@ -1289,6 +1299,14 @@ const LldbEngine::Command &LldbEngine::Command::arg(const char *name, const char
|
||||
return *this;
|
||||
}
|
||||
|
||||
const LldbEngine::Command &LldbEngine::Command::arg(const char *value) const
|
||||
{
|
||||
args.append("\"");
|
||||
args.append(value);
|
||||
args.append("\",");
|
||||
return *this;
|
||||
}
|
||||
|
||||
const LldbEngine::Command &LldbEngine::Command::beginList(const char *name) const
|
||||
{
|
||||
if (name) {
|
||||
|
||||
@@ -68,6 +68,7 @@ private:
|
||||
Command() {}
|
||||
Command(const char *f) : function(f) {}
|
||||
|
||||
const Command &arg(const char *name) const;
|
||||
const Command &arg(const char *name, int value) const;
|
||||
const Command &arg(const char *name, qlonglong value) const;
|
||||
const Command &arg(const char *name, qulonglong value) const;
|
||||
|
||||
Reference in New Issue
Block a user