diff --git a/src/plugins/debugger/gdb/tcftrkgdbadapter.cpp b/src/plugins/debugger/gdb/tcftrkgdbadapter.cpp index e6ab8354933d65046734c464b50731c75e07520c..c47880f98c4dd7137d0e35377d341c8b71bb00aa 100644 --- a/src/plugins/debugger/gdb/tcftrkgdbadapter.cpp +++ b/src/plugins/debugger/gdb/tcftrkgdbadapter.cpp @@ -1128,19 +1128,27 @@ void TcfTrkGdbAdapter::write(const QByteArray &data) m_gdbProc.write(data); } - void TcfTrkGdbAdapter::cleanup() { delete m_gdbServer; m_gdbServer = 0; if (!m_trkIODevice.isNull()) { - if (QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(m_trkIODevice.data())) { - if (socket->state() == QAbstractSocket::ConnectedState) + QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(m_trkIODevice.data()); + const bool isOpen = socket ? socket->state() == QAbstractSocket::ConnectedState : m_trkIODevice->isOpen(); + if (isOpen) { // Not sure if that is required: Remove Trk's context? + if (!m_remoteExecutable.isEmpty() && m_uid) { + m_trkDevice->sendSettingsRemoveExecutableCommand(m_remoteExecutable, m_uid); + m_uid = 0; + } + } + if (isOpen) { + if (socket) { socket->disconnect(); - } else { - m_trkIODevice->close(); + } else { + m_trkIODevice->close(); + } } - } + } //!m_trkIODevice.isNull() } void TcfTrkGdbAdapter::shutdown() diff --git a/src/shared/symbianutils/tcftrkdevice.cpp b/src/shared/symbianutils/tcftrkdevice.cpp index 9f646e3ec8348ceef23613b75ffe503cafeae379..4dfb41637f84c74ce31a8e37b920f51f7b4ac47f 100644 --- a/src/shared/symbianutils/tcftrkdevice.cpp +++ b/src/shared/symbianutils/tcftrkdevice.cpp @@ -36,6 +36,7 @@ #include <QtCore/QQueue> #include <QtCore/QTextStream> #include <QtCore/QDateTime> +#include <QtCore/QFileInfo> enum { debug = 0 }; @@ -688,6 +689,23 @@ void TcfTrkDevice::sendProcessTerminateCommand(const TcfTrkCallback &callBack, sendTcfTrkMessage(MessageWithReply, ProcessesService, "terminate", data, callBack, cookie); } +// Non-standard: Remove executable from settings +void TcfTrkDevice::sendSettingsRemoveExecutableCommand(const QString &binaryIn, + unsigned uid, + const QStringList &additionalLibraries, + const QVariant &cookie) +{ + QByteArray setData; + JsonInputStream setStr(setData); + setStr << "" << '\0' + << '[' << "removedExecutables" << ',' << "removedLibraries" << ']' + << '\0' << '[' + << '{' << QFileInfo(binaryIn).fileName() << ':' << QString::number(uid, 16) << '}' << ',' + << additionalLibraries + << ']'; + sendTcfTrkMessage(MessageWithoutReply, SettingsService, "set", setData, TcfTrkCallback(), cookie); +} + void TcfTrkDevice::sendRunControlResumeCommand(const TcfTrkCallback &callBack, const QByteArray &id, RunControlResumeMode mode, diff --git a/src/shared/symbianutils/tcftrkdevice.h b/src/shared/symbianutils/tcftrkdevice.h index be5077b2a0823895814eecab282603d031c2e1d1..bfe8bbbbf3faaaa24dd461452054700649b194d0 100644 --- a/src/shared/symbianutils/tcftrkdevice.h +++ b/src/shared/symbianutils/tcftrkdevice.h @@ -162,6 +162,13 @@ public: const QByteArray &id, const QVariant &cookie = QVariant()); + // Non-standard: Remove executable from settings. + // Probably needs to be called after stopping. This command has no response. + void sendSettingsRemoveExecutableCommand(const QString &binaryIn, + unsigned uid, + const QStringList &additionalLibraries = QStringList(), + const QVariant &cookie = QVariant()); + void sendRunControlSuspendCommand(const TcfTrkCallback &callBack, const QByteArray &id, const QVariant &cookie = QVariant());