forked from qt-creator/qt-creator
Debugger: Cleanup remote server engine
There was duplicated data hanging around, with the potential of getting out-of-sync. Change-Id: Ib4927a098b4905347faa203af323234b464be9cd Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -60,8 +60,6 @@ namespace Internal {
|
|||||||
GdbRemoteServerEngine::GdbRemoteServerEngine(const DebuggerStartParameters &startParameters)
|
GdbRemoteServerEngine::GdbRemoteServerEngine(const DebuggerStartParameters &startParameters)
|
||||||
: GdbEngine(startParameters)
|
: GdbEngine(startParameters)
|
||||||
{
|
{
|
||||||
m_isMulti = false;
|
|
||||||
m_targetPid = -1;
|
|
||||||
if (Utils::HostOsInfo::isWindowsHost())
|
if (Utils::HostOsInfo::isWindowsHost())
|
||||||
m_gdbProc->setUseCtrlCStub(startParameters.useCtrlCStub); // This is only set for QNX/BlackBerry
|
m_gdbProc->setUseCtrlCStub(startParameters.useCtrlCStub); // This is only set for QNX/BlackBerry
|
||||||
connect(&m_uploadProc, SIGNAL(error(QProcess::ProcessError)),
|
connect(&m_uploadProc, SIGNAL(error(QProcess::ProcessError)),
|
||||||
@@ -152,8 +150,7 @@ void GdbRemoteServerEngine::readUploadStandardError()
|
|||||||
|
|
||||||
void GdbRemoteServerEngine::uploadProcFinished()
|
void GdbRemoteServerEngine::uploadProcFinished()
|
||||||
{
|
{
|
||||||
if (m_uploadProc.exitStatus() == QProcess::NormalExit
|
if (m_uploadProc.exitStatus() == QProcess::NormalExit && m_uploadProc.exitCode() == 0) {
|
||||||
&& m_uploadProc.exitCode() == 0) {
|
|
||||||
startGdb();
|
startGdb();
|
||||||
} else {
|
} else {
|
||||||
RemoteSetupResult result;
|
RemoteSetupResult result;
|
||||||
@@ -268,8 +265,8 @@ void GdbRemoteServerEngine::callTargetRemote()
|
|||||||
|
|
||||||
if (m_isQnxGdb)
|
if (m_isQnxGdb)
|
||||||
postCommand("target qnx " + channel, CB(handleTargetQnx));
|
postCommand("target qnx " + channel, CB(handleTargetQnx));
|
||||||
else if (m_isMulti)
|
else if (startParameters().multiProcess)
|
||||||
postCommand("target extended-remote " + m_serverChannel, CB(handleTargetExtendedRemote));
|
postCommand("target extended-remote " + channel, CB(handleTargetExtendedRemote));
|
||||||
else
|
else
|
||||||
postCommand("target remote " + channel, CB(handleTargetRemote), 10);
|
postCommand("target remote " + channel, CB(handleTargetRemote), 10);
|
||||||
}
|
}
|
||||||
@@ -306,9 +303,10 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const GdbResponse &respon
|
|||||||
foreach (const QString &cmd, postAttachCommands.split(QLatin1Char('\n')))
|
foreach (const QString &cmd, postAttachCommands.split(QLatin1Char('\n')))
|
||||||
postCommand(cmd.toLatin1());
|
postCommand(cmd.toLatin1());
|
||||||
}
|
}
|
||||||
if (m_targetPid > 0) { // attach to pid if valid
|
if (startParameters().attachPID > 0) { // attach to pid if valid
|
||||||
// gdb server will stop the remote application itself.
|
// gdb server will stop the remote application itself.
|
||||||
postCommand("attach " + QByteArray::number(m_targetPid), CB(handleTargetExtendedAttach));
|
postCommand("attach " + QByteArray::number(startParameters().attachPID),
|
||||||
|
CB(handleTargetExtendedAttach));
|
||||||
} else {
|
} else {
|
||||||
postCommand("-gdb-set remote exec-file " + startParameters().remoteExecutable.toLatin1(),
|
postCommand("-gdb-set remote exec-file " + startParameters().remoteExecutable.toLatin1(),
|
||||||
CB(handleTargetExtendedAttach));
|
CB(handleTargetExtendedAttach));
|
||||||
@@ -472,10 +470,11 @@ void GdbRemoteServerEngine::shutdownEngine()
|
|||||||
void GdbRemoteServerEngine::notifyEngineRemoteServerRunning
|
void GdbRemoteServerEngine::notifyEngineRemoteServerRunning
|
||||||
(const QByteArray &serverChannel, int inferiorPid)
|
(const QByteArray &serverChannel, int inferiorPid)
|
||||||
{
|
{
|
||||||
|
// Currently only used by Android support.
|
||||||
|
startParameters().attachPID = inferiorPid;
|
||||||
|
startParameters().remoteChannel = QString::fromLatin1(serverChannel);
|
||||||
|
startParameters().multiProcess = true;
|
||||||
showMessage(_("NOTE: REMOTE SERVER RUNNING IN MULTIMODE"));
|
showMessage(_("NOTE: REMOTE SERVER RUNNING IN MULTIMODE"));
|
||||||
m_isMulti = true;
|
|
||||||
m_targetPid = inferiorPid;
|
|
||||||
m_serverChannel = serverChannel;
|
|
||||||
m_startAttempted = true;
|
m_startAttempted = true;
|
||||||
startGdb();
|
startGdb();
|
||||||
}
|
}
|
||||||
@@ -485,18 +484,12 @@ void GdbRemoteServerEngine::notifyEngineRemoteSetupFinished(const RemoteSetupRes
|
|||||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||||
DebuggerEngine::notifyEngineRemoteSetupFinished(result);
|
DebuggerEngine::notifyEngineRemoteSetupFinished(result);
|
||||||
|
|
||||||
if (!result.success) {
|
if (result.success) {
|
||||||
|
if (!m_startAttempted)
|
||||||
|
startGdb();
|
||||||
|
} else {
|
||||||
handleAdapterStartFailed(result.reason);
|
handleAdapterStartFailed(result.reason);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Aren't these redundant?
|
|
||||||
m_isMulti = startParameters().multiProcess;
|
|
||||||
m_targetPid = -1;
|
|
||||||
m_serverChannel = startParameters().remoteChannel.toLatin1();
|
|
||||||
|
|
||||||
if (!m_startAttempted)
|
|
||||||
startGdb();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -90,10 +90,7 @@ private:
|
|||||||
void handleExecRun(const GdbResponse &response);
|
void handleExecRun(const GdbResponse &response);
|
||||||
|
|
||||||
QProcess m_uploadProc;
|
QProcess m_uploadProc;
|
||||||
bool m_isMulti;
|
|
||||||
bool m_startAttempted;
|
bool m_startAttempted;
|
||||||
int m_targetPid;
|
|
||||||
QByteArray m_serverChannel;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user