Commit c6a8b39a authored by hjk's avatar hjk Committed by hjk
Browse files

debugger: hard-code some qt5 related paths

This is not a final solution.

Change-Id: I19e7a99e1b056704864d27855197678a0d3fd10b
Reviewed-on: http://codereview.qt-project.org/5073

Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 54f7489e
......@@ -741,7 +741,7 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
const QString extensionFileName = extensionFi.fileName();
// Prepare arguments
QStringList arguments;
const bool isRemote = sp.startMode == AttachToRemote;
const bool isRemote = sp.startMode == AttachToRemoteServer;
if (isRemote) { // Must be first
arguments << QLatin1String("-remote") << sp.remoteChannel;
} else {
......@@ -767,7 +767,7 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
nativeArguments.push_back(blank);
nativeArguments += QDir::toNativeSeparators(sp.executable);
break;
case AttachToRemote:
case AttachToRemoteServer:
break;
case AttachExternal:
case AttachCrashedExternal:
......@@ -942,7 +942,7 @@ void CdbEngine::shutdownEngine()
if (startParameters().startMode == AttachExternal || startParameters().startMode == AttachCrashedExternal)
detachDebugger();
// Remote requires a bit more force to quit.
if (m_effectiveStartMode == AttachToRemote) {
if (m_effectiveStartMode == AttachToRemoteServer) {
postCommand(m_extensionCommandPrefixBA + "shutdownex", 0);
postCommand("qq", 0);
} else {
......@@ -1152,7 +1152,7 @@ void CdbEngine::doContinueInferior()
bool CdbEngine::canInterruptInferior() const
{
return m_effectiveStartMode != AttachToRemote && inferiorPid();
return m_effectiveStartMode != AttachToRemoteServer && inferiorPid();
}
void CdbEngine::interruptInferior()
......
......@@ -125,7 +125,8 @@ enum DebuggerStartMode
AttachExternal, // Attach to running process by process id
AttachCrashedExternal, // Attach to crashed process by process id
AttachCore, // Attach to a core file
AttachToRemote, // Start and attach to a remote process
AttachToRemoteServer, // Attach to a running remote server
StartRemote, // Start and attach to a remote process
AttachToQmlPort, // Attach to QML debugging port
StartRemoteGdb, // Start gdb itself remotely
StartRemoteEngine // Start ipc guest engine on other machine
......
......@@ -1215,7 +1215,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
sp.startMessage = tr("Attaching to local process %1.").arg(sp.attachPID);
sp.toolChainAbi = Abi::hostAbi();
} else if (port) {
sp.startMode = AttachToRemote;
sp.startMode = AttachToRemoteServer;
sp.remoteChannel = remoteChannel;
sp.executable = it->section('@', 1, 1);
if (sp.remoteChannel.isEmpty()) {
......@@ -1521,7 +1521,7 @@ void DebuggerPluginPrivate::attachRemote(const QString &spec)
sp.executable = spec.section('@', 1, 1);
sp.remoteArchitecture = spec.section('@', 2, 2);
sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel);
sp.startMode = AttachToRemote;
sp.startMode = AttachToRemoteServer;
sp.toolChainAbi = anyAbiOfBinary(sp.executable);
if (DebuggerRunControl *rc = createDebugger(sp))
startDebugger(rc);
......@@ -1537,7 +1537,7 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
ProjectExplorer::Abi::WindowsMsvc2010Flavor,
ProjectExplorer::Abi::PEFormat,
hostAbi.wordWidth());
sp.startMode = AttachToRemote;
sp.startMode = AttachToRemoteServer;
StartRemoteCdbDialog dlg(mainWindow());
QString previousConnection = configValue(connectionKey).toString();
if (previousConnection.isEmpty())
......@@ -1606,7 +1606,6 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b
sp.debuggerCommand = dlg.debugger(); // Override toolchain-detection.
if (!sp.debuggerCommand.isEmpty())
sp.toolChainAbi = ProjectExplorer::Abi();
sp.startMode = AttachToRemote;
sp.overrideStartScript = dlg.overrideStartScript();
sp.useServerStartScript = dlg.useServerStartScript();
sp.serverStartScript = dlg.serverStartScript();
......@@ -1614,12 +1613,21 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b
sp.debugInfoLocation = dlg.debugInfoLocation();
if (sp.debugInfoLocation.isEmpty())
sp.debugInfoLocation = sp.sysroot + "/usr/lib/debug";
if (sp.debugSourceLocation.isEmpty()) {
QString base = sp.sysroot + "/usr/src/debug/";
sp.debugSourceLocation.append(base + "qt5base/src/corelib");
sp.debugSourceLocation.append(base + "qt5base/src/gui");
sp.debugSourceLocation.append(base + "qt5base/src/network");
sp.debugSourceLocation.append(base + "qt5base/src/v8");
sp.debugSourceLocation.append(base + "qtdeclarative/src/declarative/qml");
}
return true;
}
void DebuggerPluginPrivate::startRemoteApplication()
{
DebuggerStartParameters sp;
sp.startMode = StartRemote;
if (queryRemoteParameters(sp, true))
if (RunControl *rc = createDebugger(sp))
startDebugger(rc);
......@@ -1630,6 +1638,7 @@ void DebuggerPluginPrivate::attachRemoteApplication()
DebuggerStartParameters sp;
if (!queryRemoteParameters(sp, false))
return;
sp.startMode = AttachToRemoteServer;
sp.useServerStartScript = false;
sp.serverStartScript.clear();
if (RunControl *rc = createDebugger(sp))
......
......@@ -459,7 +459,7 @@ static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode,
case StartRemoteGdb:
result.push_back(GdbEngineType);
break;
case AttachToRemote:
case AttachToRemoteServer:
if (!hardConstraintsOnly) {
#ifdef Q_OS_WIN
result.push_back(CdbEngineType);
......@@ -509,7 +509,7 @@ static QList<DebuggerEngineType> engineTypes(const DebuggerStartParameters &sp)
return result;
}
if (sp.startMode != AttachToRemote && !sp.executable.isEmpty())
if (sp.startMode != AttachToRemoteServer && !sp.executable.isEmpty())
result = enginesForExecutable(sp.executable);
if (!result.isEmpty())
return result;
......
......@@ -109,6 +109,7 @@ public:
QString serverStartScript;
QString sysroot;
QString debugInfoLocation;
QStringList debugSourceLocation;
QByteArray remoteDumperLib;
QByteArray remoteSourcesDir;
QString remoteMountPoint;
......
......@@ -1099,7 +1099,7 @@ void GdbEngine::tryLoadDebuggingHelpersClassic()
m_debuggingHelperState = DebuggingHelperLoadTried;
QByteArray dlopenLib;
const DebuggerStartMode startMode = startParameters().startMode;
if (startMode == AttachToRemote || startMode == StartRemoteGdb)
if (startMode == AttachToRemoteServer || startMode == StartRemoteGdb)
dlopenLib = startParameters().remoteDumperLib;
else
dlopenLib = qtDumperLibraryName().toLocal8Bit();
......
......@@ -1955,7 +1955,7 @@ AbstractGdbAdapter *GdbEngine::createAdapter()
switch (sp.startMode) {
case AttachCore:
return new CoreGdbAdapter(this);
case AttachToRemote:
case AttachToRemoteServer:
return new RemoteGdbServerAdapter(this);
case StartRemoteGdb:
return new RemotePlainGdbAdapter(this);
......@@ -4774,29 +4774,29 @@ void GdbEngine::handleInferiorPrepared()
{
typedef GlobalDebuggerOptions::SourcePathMap SourcePathMap;
typedef SourcePathMap::const_iterator SourcePathMapIterator;
const DebuggerStartParameters &sp = startParameters();
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
// Apply source path mappings from global options.
const SourcePathMap sourcePathMap =
DebuggerSourcePathMappingWidget::mergePlatformQtPath(
startParameters().qtInstallPath,
DebuggerSourcePathMappingWidget::mergePlatformQtPath(sp.qtInstallPath,
debuggerCore()->globalDebuggerOptions()->sourcePathMap);
if (!sourcePathMap.isEmpty()) {
const SourcePathMapIterator cend = sourcePathMap.constEnd();
for (SourcePathMapIterator it = sourcePathMap.constBegin(); it != cend; ++it) {
QByteArray command = "set substitute-path ";
command += it.key().toLocal8Bit();
command += ' ';
command += it.value().toLocal8Bit();
postCommand(command);
}
const SourcePathMapIterator cend = sourcePathMap.constEnd();
SourcePathMapIterator it = sourcePathMap.constBegin();
for ( ; it != cend; ++it) {
QByteArray command = "set substitute-path ";
command += it.key().toLocal8Bit();
command += ' ';
command += it.value().toLocal8Bit();
postCommand(command);
}
if (!sp.sysroot.isEmpty())
postCommand("set substitute-path / " + sp.sysroot.toLocal8Bit());
// Initial attempt to set breakpoints.
if (startParameters().startMode != AttachCore
&& !isSlaveEngine()) {
if (sp.startMode != AttachCore && !isSlaveEngine()) {
showStatusMessage(tr("Setting breakpoints..."));
showMessage(tr("Setting breakpoints..."));
attemptBreakpointSynchronization();
......
......@@ -181,8 +181,10 @@ void RemoteGdbServerAdapter::setupInferior()
m_engine->postCommand("set gnutarget " + gnuTarget);
if (!sysroot.isEmpty())
m_engine->postCommand("set sysroot " + sysroot);
if (!sysroot.isEmpty())
if (!debugInfoLocation.isEmpty())
m_engine->postCommand("set debug-file-directory " + debugInfoLocation);
foreach (const QString &src, sp.debugSourceLocation)
m_engine->postCommand("directory " + src.toLocal8Bit());
if (!solibPath.isEmpty())
m_engine->postCommand("set solib-search-path " + solibPath);
if (!args.isEmpty())
......@@ -291,7 +293,10 @@ void RemoteGdbServerAdapter::handleInterruptInferior(const GdbResponse &response
void RemoteGdbServerAdapter::shutdownInferior()
{
m_engine->defaultInferiorShutdown("kill");
if (m_engine->startParameters().startMode == AttachToRemoteServer)
m_engine->defaultInferiorShutdown("detach");
else
m_engine->defaultInferiorShutdown("kill");
}
void RemoteGdbServerAdapter::shutdownAdapter()
......
......@@ -163,7 +163,7 @@ void QmlEngine::setupInferior()
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
if (startParameters().startMode == AttachToRemote) {
if (startParameters().startMode == AttachToRemoteServer) {
emit requestRemoteSetup();
if (startParameters().qmlServerPort != quint16(-1))
notifyInferiorSetupOk();
......@@ -330,7 +330,7 @@ void QmlEngine::runEngine()
{
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
if (!isSlaveEngine() && startParameters().startMode != AttachToRemote
if (!isSlaveEngine() && startParameters().startMode != AttachToRemoteServer
&& startParameters().startMode != AttachToQmlPort)
startApplicationLauncher();
d->m_noDebugOutputTimer.start();
......
......@@ -85,7 +85,7 @@ static Debugger::DebuggerStartParameters s60DebuggerStartParams(const S60DeviceR
sp.remoteChannel = activeDeployConf->serialPortName();
sp.processArgs = rc->commandLineArguments();
if (rc->useQmlDebugger() && !rc->useCppDebugger())
sp.startMode = Debugger::AttachToRemote;
sp.startMode = Debugger::AttachToRemoteServer;
else
sp.startMode = Debugger::StartInternal;
......
......@@ -105,7 +105,7 @@ DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const R
if (runConfig->activeQt4BuildConfiguration()->qtVersion())
params.sysroot = runConfig->activeQt4BuildConfiguration()->qtVersion()->systemRoot();
params.toolChainAbi = runConfig->abi();
params.startMode = AttachToRemote;
params.startMode = AttachToRemoteServer;
params.executable = runConfig->localExecutableFilePath();
params.debuggerCommand = runConfig->gdbCmd();
params.remoteChannel = devConf->sshParameters().host + QLatin1String(":-1");
......@@ -118,7 +118,7 @@ DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const R
params.gnuTarget = QLatin1String(abi.architecture() == ProjectExplorer::Abi::ArmArchitecture
? "arm-none-linux-gnueabi": "i386-unknown-linux-gnu");
} else {
params.startMode = AttachToRemote;
params.startMode = AttachToRemoteServer;
}
params.displayName = runConfig->displayName();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment