Commit b3c1da03 authored by hjk's avatar hjk

Debugger: Switch meaning of inferior.executable and a symbol file

This essentially uses inferior.executable as the actually executed
binary (formerly remoteExecutable) and a new symbolFile as
source of debug info (formerly inferior.executable).

Change-Id: Ib129fa1dd4af2446129ab42eb5ba42154e92ab20
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
parent ca4076c8
......@@ -80,6 +80,7 @@ public:
QString remoteChannel;
QSsh::SshConnectionParameters connParams;
bool remoteSetupNeeded = false;
QString symbolFile;
// Used by Mer plugin (3rd party)
QMap<QString, QString> sourcePathMap;
......@@ -93,7 +94,6 @@ public:
QVector<QByteArray> expectedSignals;
// For QNX debugging
QString remoteExecutable;
bool useCtrlCStub = false;
// Used by Android to avoid false positives on warnOnRelease
......
......@@ -164,10 +164,10 @@ void GdbRemoteServerEngine::setupInferior()
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
setLinuxOsAbi();
const DebuggerRunParameters &rp = runParameters();
QString executableFileName;
if (!rp.inferior.executable.isEmpty()) {
QFileInfo fi(rp.inferior.executable);
executableFileName = fi.absoluteFilePath();
QString symbolFile;
if (!rp.symbolFile.isEmpty()) {
QFileInfo fi(rp.symbolFile);
symbolFile = fi.absoluteFilePath();
}
//const QByteArray sysroot = sp.sysroot.toLocal8Bit();
......@@ -208,14 +208,14 @@ void GdbRemoteServerEngine::setupInferior()
if (boolSetting(TargetAsync))
runCommand({"set target-async on", NoFlags, CB(handleSetTargetAsync)});
if (executableFileName.isEmpty()) {
if (symbolFile.isEmpty()) {
showMessage(tr("No symbol file given."), StatusBar);
callTargetRemote();
return;
}
if (!executableFileName.isEmpty()) {
runCommand({"-file-exec-and-symbols \"" + executableFileName.toLocal8Bit() + '"',
if (!symbolFile.isEmpty()) {
runCommand({"-file-exec-and-symbols \"" + symbolFile.toLocal8Bit() + '"',
NoFlags, CB(handleFileExecAndSymbols)});
}
}
......@@ -310,7 +310,7 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const DebuggerResponse &r
runCommand({"attach " + QByteArray::number(runParameters().attachPID),
NoFlags, CB(handleTargetExtendedAttach)});
} else {
runCommand({"-gdb-set remote exec-file " + runParameters().remoteExecutable.toLatin1(),
runCommand({"-gdb-set remote exec-file " + runParameters().inferior.executable.toLatin1(),
NoFlags, CB(handleTargetExtendedAttach)});
}
} else {
......@@ -342,8 +342,9 @@ void GdbRemoteServerEngine::handleTargetQnx(const DebuggerResponse &response)
showMessage(_("INFERIOR STARTED"));
showMessage(msgAttachedToStoppedInferior(), StatusBar);
const qint64 pid = isMasterEngine() ? runParameters().attachPID : masterEngine()->runParameters().attachPID;
const QString remoteExecutable = isMasterEngine() ? runParameters().remoteExecutable : masterEngine()->runParameters().remoteExecutable;
const DebuggerRunParameters &rp = isMasterEngine() ? runParameters() : masterEngine()->runParameters();
const qint64 pid = rp.attachPID;
const QString remoteExecutable = rp.inferior.executable;
if (pid > -1)
runCommand({"attach " + QByteArray::number(pid), NoFlags, CB(handleAttach)});
else if (!remoteExecutable.isEmpty())
......@@ -403,7 +404,7 @@ void GdbRemoteServerEngine::runEngine()
{
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
const QString remoteExecutable = runParameters().remoteExecutable;
const QString remoteExecutable = runParameters().inferior.executable;
if (!remoteExecutable.isEmpty()) {
runCommand({"-exec-run", RunRequest, CB(handleExecRun)});
} else {
......
......@@ -65,8 +65,8 @@ static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration
params.startMode = AttachToRemoteServer;
params.useCtrlCStub = true;
params.inferior.executable = runConfig->localExecutableFilePath();
params.remoteExecutable = runConfig->remoteExecutableFilePath();
params.inferior.executable = runConfig->remoteExecutableFilePath();
params.symbolFile = runConfig->localExecutableFilePath();
params.remoteChannel = device->sshParameters().host + QLatin1String(":-1");
params.remoteSetupNeeded = true;
params.closeMode = KillAtClose;
......
......@@ -101,10 +101,10 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
return 0;
}
QString localExecutable;
QString symbolFile;
if (auto rlrc = qobject_cast<RemoteLinuxRunConfiguration *>(runConfig))
localExecutable = rlrc->localExecutableFilePath();
if (localExecutable.isEmpty()) {
symbolFile = rlrc->localExecutableFilePath();
if (symbolFile.isEmpty()) {
*errorMessage = tr("Cannot debug: Local executable is not set.");
return 0;
}
......@@ -120,14 +120,14 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
}
if (aspect->useCppDebugger()) {
aspect->setUseMultiProcess(true);
params.inferior.executable = stdRunnable.executable;
params.inferior.commandLineArguments = stdRunnable.commandLineArguments;
if (aspect->useQmlDebugger()) {
params.inferior.commandLineArguments.prepend(QLatin1Char(' '));
params.inferior.commandLineArguments.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices));
}
params.inferior.commandLineArguments = localExecutable;
params.remoteChannel = dev->sshParameters().host + QLatin1String(":-1");
params.remoteExecutable = stdRunnable.executable;
params.symbolFile = symbolFile;
}
DebuggerRunControl * const runControl = createDebuggerRunControl(params, runConfig, errorMessage, mode);
......
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