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: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
hjk
2016-04-21 12:44:11 +02:00
parent ca4076c839
commit b3c1da03e8
4 changed files with 20 additions and 19 deletions

View File

@@ -80,6 +80,7 @@ public:
QString remoteChannel; QString remoteChannel;
QSsh::SshConnectionParameters connParams; QSsh::SshConnectionParameters connParams;
bool remoteSetupNeeded = false; bool remoteSetupNeeded = false;
QString symbolFile;
// Used by Mer plugin (3rd party) // Used by Mer plugin (3rd party)
QMap<QString, QString> sourcePathMap; QMap<QString, QString> sourcePathMap;
@@ -93,7 +94,6 @@ public:
QVector<QByteArray> expectedSignals; QVector<QByteArray> expectedSignals;
// For QNX debugging // For QNX debugging
QString remoteExecutable;
bool useCtrlCStub = false; bool useCtrlCStub = false;
// Used by Android to avoid false positives on warnOnRelease // Used by Android to avoid false positives on warnOnRelease

View File

@@ -164,10 +164,10 @@ void GdbRemoteServerEngine::setupInferior()
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
setLinuxOsAbi(); setLinuxOsAbi();
const DebuggerRunParameters &rp = runParameters(); const DebuggerRunParameters &rp = runParameters();
QString executableFileName; QString symbolFile;
if (!rp.inferior.executable.isEmpty()) { if (!rp.symbolFile.isEmpty()) {
QFileInfo fi(rp.inferior.executable); QFileInfo fi(rp.symbolFile);
executableFileName = fi.absoluteFilePath(); symbolFile = fi.absoluteFilePath();
} }
//const QByteArray sysroot = sp.sysroot.toLocal8Bit(); //const QByteArray sysroot = sp.sysroot.toLocal8Bit();
@@ -208,14 +208,14 @@ void GdbRemoteServerEngine::setupInferior()
if (boolSetting(TargetAsync)) if (boolSetting(TargetAsync))
runCommand({"set target-async on", NoFlags, CB(handleSetTargetAsync)}); runCommand({"set target-async on", NoFlags, CB(handleSetTargetAsync)});
if (executableFileName.isEmpty()) { if (symbolFile.isEmpty()) {
showMessage(tr("No symbol file given."), StatusBar); showMessage(tr("No symbol file given."), StatusBar);
callTargetRemote(); callTargetRemote();
return; return;
} }
if (!executableFileName.isEmpty()) { if (!symbolFile.isEmpty()) {
runCommand({"-file-exec-and-symbols \"" + executableFileName.toLocal8Bit() + '"', runCommand({"-file-exec-and-symbols \"" + symbolFile.toLocal8Bit() + '"',
NoFlags, CB(handleFileExecAndSymbols)}); NoFlags, CB(handleFileExecAndSymbols)});
} }
} }
@@ -310,7 +310,7 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const DebuggerResponse &r
runCommand({"attach " + QByteArray::number(runParameters().attachPID), runCommand({"attach " + QByteArray::number(runParameters().attachPID),
NoFlags, CB(handleTargetExtendedAttach)}); NoFlags, CB(handleTargetExtendedAttach)});
} else { } else {
runCommand({"-gdb-set remote exec-file " + runParameters().remoteExecutable.toLatin1(), runCommand({"-gdb-set remote exec-file " + runParameters().inferior.executable.toLatin1(),
NoFlags, CB(handleTargetExtendedAttach)}); NoFlags, CB(handleTargetExtendedAttach)});
} }
} else { } else {
@@ -342,8 +342,9 @@ void GdbRemoteServerEngine::handleTargetQnx(const DebuggerResponse &response)
showMessage(_("INFERIOR STARTED")); showMessage(_("INFERIOR STARTED"));
showMessage(msgAttachedToStoppedInferior(), StatusBar); showMessage(msgAttachedToStoppedInferior(), StatusBar);
const qint64 pid = isMasterEngine() ? runParameters().attachPID : masterEngine()->runParameters().attachPID; const DebuggerRunParameters &rp = isMasterEngine() ? runParameters() : masterEngine()->runParameters();
const QString remoteExecutable = isMasterEngine() ? runParameters().remoteExecutable : masterEngine()->runParameters().remoteExecutable; const qint64 pid = rp.attachPID;
const QString remoteExecutable = rp.inferior.executable;
if (pid > -1) if (pid > -1)
runCommand({"attach " + QByteArray::number(pid), NoFlags, CB(handleAttach)}); runCommand({"attach " + QByteArray::number(pid), NoFlags, CB(handleAttach)});
else if (!remoteExecutable.isEmpty()) else if (!remoteExecutable.isEmpty())
@@ -403,7 +404,7 @@ void GdbRemoteServerEngine::runEngine()
{ {
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
const QString remoteExecutable = runParameters().remoteExecutable; const QString remoteExecutable = runParameters().inferior.executable;
if (!remoteExecutable.isEmpty()) { if (!remoteExecutable.isEmpty()) {
runCommand({"-exec-run", RunRequest, CB(handleExecRun)}); runCommand({"-exec-run", RunRequest, CB(handleExecRun)});
} else { } else {

View File

@@ -65,8 +65,8 @@ static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration
params.startMode = AttachToRemoteServer; params.startMode = AttachToRemoteServer;
params.useCtrlCStub = true; params.useCtrlCStub = true;
params.inferior.executable = runConfig->localExecutableFilePath(); params.inferior.executable = runConfig->remoteExecutableFilePath();
params.remoteExecutable = runConfig->remoteExecutableFilePath(); params.symbolFile = runConfig->localExecutableFilePath();
params.remoteChannel = device->sshParameters().host + QLatin1String(":-1"); params.remoteChannel = device->sshParameters().host + QLatin1String(":-1");
params.remoteSetupNeeded = true; params.remoteSetupNeeded = true;
params.closeMode = KillAtClose; params.closeMode = KillAtClose;

View File

@@ -101,10 +101,10 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
return 0; return 0;
} }
QString localExecutable; QString symbolFile;
if (auto rlrc = qobject_cast<RemoteLinuxRunConfiguration *>(runConfig)) if (auto rlrc = qobject_cast<RemoteLinuxRunConfiguration *>(runConfig))
localExecutable = rlrc->localExecutableFilePath(); symbolFile = rlrc->localExecutableFilePath();
if (localExecutable.isEmpty()) { if (symbolFile.isEmpty()) {
*errorMessage = tr("Cannot debug: Local executable is not set."); *errorMessage = tr("Cannot debug: Local executable is not set.");
return 0; return 0;
} }
@@ -120,14 +120,14 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
} }
if (aspect->useCppDebugger()) { if (aspect->useCppDebugger()) {
aspect->setUseMultiProcess(true); aspect->setUseMultiProcess(true);
params.inferior.executable = stdRunnable.executable;
params.inferior.commandLineArguments = stdRunnable.commandLineArguments; params.inferior.commandLineArguments = stdRunnable.commandLineArguments;
if (aspect->useQmlDebugger()) { if (aspect->useQmlDebugger()) {
params.inferior.commandLineArguments.prepend(QLatin1Char(' ')); params.inferior.commandLineArguments.prepend(QLatin1Char(' '));
params.inferior.commandLineArguments.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices)); params.inferior.commandLineArguments.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices));
} }
params.inferior.commandLineArguments = localExecutable;
params.remoteChannel = dev->sshParameters().host + QLatin1String(":-1"); params.remoteChannel = dev->sshParameters().host + QLatin1String(":-1");
params.remoteExecutable = stdRunnable.executable; params.symbolFile = symbolFile;
} }
DebuggerRunControl * const runControl = createDebuggerRunControl(params, runConfig, errorMessage, mode); DebuggerRunControl * const runControl = createDebuggerRunControl(params, runConfig, errorMessage, mode);