Commit e110a88c authored by hjk's avatar hjk

Debugger: remove platform ifdefs in terminal adapter

The code still assumes host == target in some places...

Change-Id: Ief495df6ff5fbff890fc46d42a6b29eee3a1ed2c
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
Reviewed-by: default avatarRobert Loehning <robert.loehning@digia.com>
parent 384fc409
...@@ -71,9 +71,8 @@ public: ...@@ -71,9 +71,8 @@ public:
void killProcess(); void killProcess();
void killStub(); void killStub();
#ifdef Q_OS_WIN
qint64 applicationMainThreadID() const; qint64 applicationMainThreadID() const;
#else #ifndef Q_OS_WIN
void detachStub(); void detachStub();
#endif #endif
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "qtcprocess.h" #include "qtcprocess.h"
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QTimer> #include <QTimer>
...@@ -64,6 +65,12 @@ ConsoleProcess::ConsoleProcess(QObject *parent) : ...@@ -64,6 +65,12 @@ ConsoleProcess::ConsoleProcess(QObject *parent) :
d->m_process.setProcessChannelMode(QProcess::ForwardedChannels); d->m_process.setProcessChannelMode(QProcess::ForwardedChannels);
} }
qint64 ConsoleProcess::applicationMainThreadID() const
{
QTC_CHECK(false);
return -1;
}
void ConsoleProcess::setSettings(QSettings *settings) void ConsoleProcess::setSettings(QSettings *settings)
{ {
d->m_settings = settings; d->m_settings = settings;
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include <QMessageBox> #include <QMessageBox>
using namespace Utils;
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
...@@ -120,12 +122,11 @@ void GdbTermEngine::setupInferior() ...@@ -120,12 +122,11 @@ void GdbTermEngine::setupInferior()
{ {
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
const qint64 attachedPID = m_stubProc.applicationPID(); const qint64 attachedPID = m_stubProc.applicationPID();
#ifdef Q_OS_WIN
const qint64 attachedMainThreadID = m_stubProc.applicationMainThreadID(); const qint64 attachedMainThreadID = m_stubProc.applicationMainThreadID();
showMessage(QString::fromLatin1("Attaching to %1 (%2)").arg(attachedPID).arg(attachedMainThreadID), LogMisc); const QString msg = (attachedMainThreadID != -1)
#else ? QString::fromLatin1("Attaching to %1 (%2)").arg(attachedPID).arg(attachedMainThreadID)
showMessage(QString::fromLatin1("Attaching to %1").arg(attachedPID), LogMisc); : QString::fromLatin1("Attaching to %1").arg(attachedPID);
#endif showMessage(msg, LogMisc);
notifyInferiorPid(attachedPID); notifyInferiorPid(attachedPID);
postCommand("attach " + QByteArray::number(attachedPID), postCommand("attach " + QByteArray::number(attachedPID),
CB(handleStubAttached)); CB(handleStubAttached));
...@@ -143,11 +144,7 @@ void GdbTermEngine::handleStubAttached(const GdbResponse &response) ...@@ -143,11 +144,7 @@ void GdbTermEngine::handleStubAttached(const GdbResponse &response)
} else { } else {
QString errorMessage; QString errorMessage;
// Resume thread that was suspended by console stub process (see stub code). // Resume thread that was suspended by console stub process (see stub code).
#ifdef Q_OS_WIN
const qint64 mainThreadId = m_stubProc.applicationMainThreadID(); const qint64 mainThreadId = m_stubProc.applicationMainThreadID();
#else
const qint64 mainThreadId = -1;
#endif
if (winResumeThread(mainThreadId, &errorMessage)) { if (winResumeThread(mainThreadId, &errorMessage)) {
showMessage(QString::fromLatin1("Inferior attached, thread %1 resumed"). showMessage(QString::fromLatin1("Inferior attached, thread %1 resumed").
arg(mainThreadId), LogMisc); arg(mainThreadId), LogMisc);
......
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