iOS: Adapt to new setter-based DebuggerRunTool interface

Change-Id: I96f113b831dcbd3735f743c8f12042e9b17903a4
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
hjk
2017-08-24 17:38:06 +02:00
parent 69f3ddb213
commit 0a5abdae59
7 changed files with 47 additions and 24 deletions
+1 -1
View File
@@ -130,7 +130,7 @@ void AndroidDebugSupport::start()
+ "/app_process"); + "/app_process");
setSkipExecutableValidation(true); setSkipExecutableValidation(true);
setUseExtendedRemote(true); setUseExtendedRemote(true);
setGdbServerChannel(":" + m_runner->gdbServerPort().toString()); setRemoteChannel(":" + m_runner->gdbServerPort().toString());
setSysRoot(AndroidConfigurations::currentConfig().ndkLocation().appendPath("platforms") setSysRoot(AndroidConfigurations::currentConfig().ndkLocation().appendPath("platforms")
.appendPath(QString("android-%1").arg(AndroidManager::minimumSDK(target))) .appendPath(QString("android-%1").arg(AndroidManager::minimumSDK(target)))
.appendPath(toNdkArch(AndroidManager::targetArch(target))).toString()); .appendPath(toNdkArch(AndroidManager::targetArch(target))).toString());
@@ -130,7 +130,7 @@ void BareMetalDebugSupport::start()
setStartMode(AttachToRemoteServer); setStartMode(AttachToRemoteServer);
setCommandsAfterConnect(p->initCommands()); // .. and here? setCommandsAfterConnect(p->initCommands()); // .. and here?
setCommandsForReset(p->resetCommands()); setCommandsForReset(p->resetCommands());
setGdbServerChannel(p->channel()); setRemoteChannel(p->channel());
setUseContinueInsteadOfRun(true); setUseContinueInsteadOfRun(true);
DebuggerRunTool::start(); DebuggerRunTool::start();
+21 -1
View File
@@ -210,7 +210,7 @@ void DebuggerRunTool::setSymbolFile(const QString &symbolFile)
m_runParameters.symbolFile = symbolFile; m_runParameters.symbolFile = symbolFile;
} }
void DebuggerRunTool::setGdbServerChannel(const QString &channel) void DebuggerRunTool::setRemoteChannel(const QString &channel)
{ {
m_runParameters.remoteChannel = channel; m_runParameters.remoteChannel = channel;
} }
@@ -230,6 +230,11 @@ void DebuggerRunTool::setUseTargetAsync(bool on)
m_runParameters.useTargetAsync = on; m_runParameters.useTargetAsync = on;
} }
void DebuggerRunTool::setContinueAfterAttach(bool on)
{
m_runParameters.continueAfterAttach = on;
}
void DebuggerRunTool::setSkipExecutableValidation(bool on) void DebuggerRunTool::setSkipExecutableValidation(bool on)
{ {
m_runParameters.skipExecutableValidation = on; m_runParameters.skipExecutableValidation = on;
@@ -250,12 +255,27 @@ void DebuggerRunTool::setQmlServer(const QUrl &qmlServer)
m_runParameters.qmlServer = qmlServer; m_runParameters.qmlServer = qmlServer;
} }
void DebuggerRunTool::setIosPlatform(const QString &platform)
{
m_runParameters.platform = platform;
}
void DebuggerRunTool::setDeviceSymbolsRoot(const QString &deviceSymbolsRoot)
{
m_runParameters.deviceSymbolsRoot = deviceSymbolsRoot;
}
void DebuggerRunTool::setInferior(const Runnable &runnable) void DebuggerRunTool::setInferior(const Runnable &runnable)
{ {
QTC_ASSERT(runnable.is<StandardRunnable>(), reportFailure(); return); QTC_ASSERT(runnable.is<StandardRunnable>(), reportFailure(); return);
m_runParameters.inferior = runnable.as<StandardRunnable>(); m_runParameters.inferior = runnable.as<StandardRunnable>();
} }
void DebuggerRunTool::setInferiorExecutable(const QString &executable)
{
m_runParameters.inferior.executable = executable;
}
void DebuggerRunTool::setRunControlName(const QString &name) void DebuggerRunTool::setRunControlName(const QString &name)
{ {
m_runParameters.displayName = name; m_runParameters.displayName = name;
+6 -1
View File
@@ -83,6 +83,7 @@ public:
static void setBreakOnMainNextTime(); static void setBreakOnMainNextTime();
void setInferior(const ProjectExplorer::Runnable &runnable); void setInferior(const ProjectExplorer::Runnable &runnable);
void setInferiorExecutable(const QString &executable);
void setRunControlName(const QString &name); void setRunControlName(const QString &name);
void appendInferiorCommandLineArgument(const QString &arg); void appendInferiorCommandLineArgument(const QString &arg);
void prependInferiorCommandLineArgument(const QString &arg); void prependInferiorCommandLineArgument(const QString &arg);
@@ -97,11 +98,12 @@ public:
void setAttachPid(Utils::ProcessHandle pid); void setAttachPid(Utils::ProcessHandle pid);
void setSysRoot(const QString &sysRoot); void setSysRoot(const QString &sysRoot);
void setSymbolFile(const QString &symbolFile); void setSymbolFile(const QString &symbolFile);
void setGdbServerChannel(const QString &channel); void setRemoteChannel(const QString &channel);
void setUseExtendedRemote(bool on); void setUseExtendedRemote(bool on);
void setUseContinueInsteadOfRun(bool on); void setUseContinueInsteadOfRun(bool on);
void setUseTargetAsync(bool on); void setUseTargetAsync(bool on);
void setContinueAfterAttach(bool on);
void setSkipExecutableValidation(bool on); void setSkipExecutableValidation(bool on);
void setCommandsAfterConnect(const QString &commands); void setCommandsAfterConnect(const QString &commands);
@@ -109,6 +111,9 @@ public:
void setQmlServer(const QUrl &qmlServer); void setQmlServer(const QUrl &qmlServer);
void setIosPlatform(const QString &platform);
void setDeviceSymbolsRoot(const QString &deviceSymbolsRoot);
signals: signals:
void aboutToNotifyInferiorSetupOk(); void aboutToNotifyInferiorSetupOk();
+16 -18
View File
@@ -440,11 +440,10 @@ void IosDebugSupport::start()
RunConfiguration *runConfig = runControl()->runConfiguration(); RunConfiguration *runConfig = runControl()->runConfiguration();
DebuggerStartParameters params;
if (device()->type() == Ios::Constants::IOS_DEVICE_TYPE) { if (device()->type() == Ios::Constants::IOS_DEVICE_TYPE) {
IosDevice::ConstPtr dev = device().dynamicCast<const IosDevice>(); IosDevice::ConstPtr dev = device().dynamicCast<const IosDevice>();
params.startMode = AttachToRemoteProcess; setStartMode(AttachToRemoteProcess);
params.platform = "remote-ios"; setIosPlatform("remote-ios");
QString osVersion = dev->osVersion(); QString osVersion = dev->osVersion();
FileName deviceSdk1 = FileName::fromString(QDir::homePath() FileName deviceSdk1 = FileName::fromString(QDir::homePath()
+ "/Library/Developer/Xcode/iOS DeviceSupport/" + "/Library/Developer/Xcode/iOS DeviceSupport/"
@@ -467,25 +466,25 @@ void IosDebugSupport::start()
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT); ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
} }
} }
params.deviceSymbolsRoot = deviceSdk; setDeviceSymbolsRoot(deviceSdk);
} else { } else {
params.startMode = AttachExternal; setStartMode(AttachExternal);
params.platform = "ios-simulator"; setIosPlatform("ios-simulator");
} }
auto iosRunConfig = qobject_cast<IosRunConfiguration *>(runConfig); auto iosRunConfig = qobject_cast<IosRunConfiguration *>(runConfig);
params.displayName = iosRunConfig->applicationName(); setRunControlName(iosRunConfig->applicationName());
params.continueAfterAttach = true; setContinueAfterAttach(true);
Utils::Port gdbServerPort = m_runner->gdbServerPort(); Utils::Port gdbServerPort = m_runner->gdbServerPort();
Utils::Port qmlServerPort = m_runner->qmlServerPort(); Utils::Port qmlServerPort = m_runner->qmlServerPort();
params.attachPID = ProcessHandle(m_runner->pid()); setAttachPid(ProcessHandle(m_runner->pid()));
const bool cppDebug = isCppDebugging(); const bool cppDebug = isCppDebugging();
const bool qmlDebug = isQmlDebugging(); const bool qmlDebug = isQmlDebugging();
if (cppDebug) { if (cppDebug) {
params.inferior.executable = iosRunConfig->localExecutable().toString(); setInferiorExecutable(iosRunConfig->localExecutable().toString());
params.remoteChannel = "connect://localhost:" + gdbServerPort.toString(); setRemoteChannel("connect://localhost:" + gdbServerPort.toString());
FileName xcodeInfo = IosConfigurations::developerPath().parentDir().appendPath("Info.plist"); FileName xcodeInfo = IosConfigurations::developerPath().parentDir().appendPath("Info.plist");
bool buggyLldb = false; bool buggyLldb = false;
@@ -514,21 +513,20 @@ void IosDebugSupport::start()
} }
} }
QUrl qmlServer;
if (qmlDebug) { if (qmlDebug) {
QTcpServer server; QTcpServer server;
QTC_ASSERT(server.listen(QHostAddress::LocalHost) QTC_ASSERT(server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6), return); || server.listen(QHostAddress::LocalHostIPv6), return);
params.qmlServer.setHost(server.serverAddress().toString()); qmlServer.setHost(server.serverAddress().toString());
if (!cppDebug) if (!cppDebug)
params.startMode = AttachToRemoteServer; setStartMode(AttachToRemoteServer);
} }
if (qmlServerPort.isValid()) { if (qmlServerPort.isValid())
params.qmlServer.setPort(qmlServerPort.number()); qmlServer.setPort(qmlServerPort.number());
params.inferior.commandLineArguments.replace("%qml_port%", qmlServerPort.toString());
}
setStartParameters(params); setQmlServer(qmlServer);
DebuggerRunTool::start(); DebuggerRunTool::start();
} }
@@ -60,7 +60,7 @@ LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunControl *runControl)
void LinuxDeviceDebugSupport::start() void LinuxDeviceDebugSupport::start()
{ {
setGdbServerChannel(m_portsGatherer->gdbServerChannel()); setRemoteChannel(m_portsGatherer->gdbServerChannel());
setQmlServer(m_portsGatherer->qmlServer()); setQmlServer(m_portsGatherer->qmlServer());
addQmlServerInferiorCommandLineArgumentIfNeeded(); addQmlServerInferiorCommandLineArgumentIfNeeded();
+1 -1
View File
@@ -166,7 +166,7 @@ void MemcheckToolRunner::startDebugger(qint64 valgrindPid)
auto debugger = new Debugger::DebuggerRunTool(runControl()); auto debugger = new Debugger::DebuggerRunTool(runControl());
debugger->setStartMode(Debugger::AttachToRemoteServer); debugger->setStartMode(Debugger::AttachToRemoteServer);
debugger->setRunControlName(QString("VGdb %1").arg(valgrindPid)); debugger->setRunControlName(QString("VGdb %1").arg(valgrindPid));
debugger->setGdbServerChannel(QString("| vgdb --pid=%1").arg(valgrindPid)); debugger->setRemoteChannel(QString("| vgdb --pid=%1").arg(valgrindPid));
debugger->setUseContinueInsteadOfRun(true); debugger->setUseContinueInsteadOfRun(true);
debugger->addExpectedSignal("SIGTRAP"); debugger->addExpectedSignal("SIGTRAP");