summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-01-21 18:28:49 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-01-21 18:28:49 (GMT)
commite575816cd618841e90e8933ff52e40a8581d3328 (patch)
tree28bc5c60b165be6986bc73e10c3b089f3468f62b
parent2ae6b44e4242c60bd882661e104bb53fa6670556 (diff)
parent6ff74c0d058b88dca30261158deaad49a8b981cb (diff)
downloadQt-e575816cd618841e90e8933ff52e40a8581d3328.zip
Qt-e575816cd618841e90e8933ff52e40a8581d3328.tar.gz
Qt-e575816cd618841e90e8933ff52e40a8581d3328.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public: Update symbian def files Merge from upstream Merge from upstream Fix pro file error affecting windows builds Merge TRK client changes from upstream (QtCreator)
-rw-r--r--src/s60installs/bwins/QtCoreu.def1
-rw-r--r--src/s60installs/bwins/QtGuiu.def14
-rw-r--r--src/s60installs/bwins/QtScriptu.def1
-rw-r--r--src/s60installs/eabi/QtCoreu.def1
-rw-r--r--src/s60installs/eabi/QtGuiu.def14
-rw-r--r--src/s60installs/eabi/QtScriptu.def1
-rw-r--r--tools/runonphone/main.cpp7
-rw-r--r--tools/runonphone/runonphone.pro2
-rw-r--r--tools/runonphone/trk/launcher.cpp101
-rw-r--r--tools/runonphone/trk/launcher.h15
-rw-r--r--tools/runonphone/trk/trkdevice.cpp34
-rw-r--r--tools/runonphone/trk/trkutils.h7
12 files changed, 141 insertions, 57 deletions
diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def
index fe752c8..e7e890c 100644
--- a/src/s60installs/bwins/QtCoreu.def
+++ b/src/s60installs/bwins/QtCoreu.def
@@ -4398,4 +4398,5 @@ EXPORTS
?object@WrappedEvent@QStateMachine@@QBEPAVQObject@@XZ @ 4397 NONAME ; class QObject * QStateMachine::WrappedEvent::object(void) const
?sender@SignalEvent@QStateMachine@@QBEPAVQObject@@XZ @ 4398 NONAME ; class QObject * QStateMachine::SignalEvent::sender(void) const
?signalIndex@SignalEvent@QStateMachine@@QBEHXZ @ 4399 NONAME ; int QStateMachine::SignalEvent::signalIndex(void) const
+ ?disconnectOne@QMetaObject@@SA_NPBVQObject@@H0H@Z @ 4400 NONAME ; bool QMetaObject::disconnectOne(class QObject const *, int, class QObject const *, int)
diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def
index 7a629d7..da65230 100644
--- a/src/s60installs/bwins/QtGuiu.def
+++ b/src/s60installs/bwins/QtGuiu.def
@@ -10694,10 +10694,10 @@ EXPORTS
?swipeAngle@QSwipeGesture@@QBEMXZ @ 10693 NONAME ; float QSwipeGesture::swipeAngle(void) const
?symbianEventFilter@QApplication@@UAE_NPBVQSymbianEvent@@@Z @ 10694 NONAME ; bool QApplication::symbianEventFilter(class QSymbianEvent const *)
?symbianFilterEvent@QInputContext@@UAE_NPAVQWidget@@PBVQSymbianEvent@@@Z @ 10695 NONAME ; bool QInputContext::symbianFilterEvent(class QWidget *, class QSymbianEvent const *)
- ?symbianHandleCommand@QApplicationPrivate@@QAEHH@Z @ 10696 NONAME ; int QApplicationPrivate::symbianHandleCommand(int)
+ ?symbianHandleCommand@QApplicationPrivate@@QAEHH@Z @ 10696 NONAME ABSENT ; int QApplicationPrivate::symbianHandleCommand(int)
?symbianProcessEvent@QApplication@@QAEHPBVQSymbianEvent@@@Z @ 10697 NONAME ; int QApplication::symbianProcessEvent(class QSymbianEvent const *)
- ?symbianProcessWsEvent@QApplicationPrivate@@QAEHPBVTWsEvent@@@Z @ 10698 NONAME ; int QApplicationPrivate::symbianProcessWsEvent(class TWsEvent const *)
- ?symbianResourceChange@QApplicationPrivate@@QAEHH@Z @ 10699 NONAME ; int QApplicationPrivate::symbianResourceChange(int)
+ ?symbianProcessWsEvent@QApplicationPrivate@@QAEHPBVTWsEvent@@@Z @ 10698 NONAME ABSENT ; int QApplicationPrivate::symbianProcessWsEvent(class TWsEvent const *)
+ ?symbianResourceChange@QApplicationPrivate@@QAEHH@Z @ 10699 NONAME ABSENT ; int QApplicationPrivate::symbianResourceChange(int)
?symbol@Parser@QCss@@QBEABUSymbol@2@XZ @ 10700 NONAME ; struct QCss::Symbol const & QCss::Parser::symbol(void) const
?sync@QPaintEngineEx@@UAEXXZ @ 10701 NONAME ; void QPaintEngineEx::sync(void)
?syncBackingStore@QWidgetPrivate@@QAEXABVQRegion@@@Z @ 10702 NONAME ; void QWidgetPrivate::syncBackingStore(class QRegion const &)
@@ -12525,4 +12525,12 @@ EXPORTS
??0Tab@QTextOption@@QAE@ABU01@@Z @ 12524 NONAME ; QTextOption::Tab::Tab(struct QTextOption::Tab const &)
?effectiveBoundingRect@QGraphicsItemPrivate@@QBE?AVQRectF@@ABV2@@Z @ 12525 NONAME ; class QRectF QGraphicsItemPrivate::effectiveBoundingRect(class QRectF const &) const
?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@PAXW4Type@2@ABVQTransform@@@Z @ 12526 NONAME ; class QFontEngineGlyphCache * QFontEngine::glyphCache(void *, enum QFontEngineGlyphCache::Type, class QTransform const &) const
+ ?qt_blurImage@@YAXAAVQImage@@M_NH@Z @ 12527 NONAME ; void qt_blurImage(class QImage &, float, bool, int)
+ ?qt_blurImage@@YAXPAVQPainter@@AAVQImage@@M_N2H@Z @ 12528 NONAME ; void qt_blurImage(class QPainter *, class QImage &, float, bool, bool, int)
+ ?qt_halfScaled@@YA?AVQImage@@ABV1@@Z @ 12529 NONAME ; class QImage qt_halfScaled(class QImage const &)
+ ?qt_memrotate90@@YAXPBIHHHPAIH@Z @ 12530 NONAME ; void qt_memrotate90(unsigned int const *, int, int, int, unsigned int *, int)
+ ?qt_memrotate90_gl@@YAXPBIHHHPAIH@Z @ 12531 NONAME ; void qt_memrotate90_gl(unsigned int const *, int, int, int, unsigned int *, int)
+ ?symbianHandleCommand@QApplicationPrivate@@QAEHPBVQSymbianEvent@@@Z @ 12532 NONAME ; int QApplicationPrivate::symbianHandleCommand(class QSymbianEvent const *)
+ ?symbianProcessWsEvent@QApplicationPrivate@@QAEHPBVQSymbianEvent@@@Z @ 12533 NONAME ; int QApplicationPrivate::symbianProcessWsEvent(class QSymbianEvent const *)
+ ?symbianResourceChange@QApplicationPrivate@@QAEHPBVQSymbianEvent@@@Z @ 12534 NONAME ; int QApplicationPrivate::symbianResourceChange(class QSymbianEvent const *)
diff --git a/src/s60installs/bwins/QtScriptu.def b/src/s60installs/bwins/QtScriptu.def
index 8b53524..19f7037 100644
--- a/src/s60installs/bwins/QtScriptu.def
+++ b/src/s60installs/bwins/QtScriptu.def
@@ -369,4 +369,5 @@ EXPORTS
?willExecuteProgram@QScriptEngineAgentPrivate@@UAEXABVDebuggerCallFrame@QTJSC@@HH@Z @ 368 NONAME ; void QScriptEngineAgentPrivate::willExecuteProgram(class QTJSC::DebuggerCallFrame const &, int, int)
?staticMetaObject@QScriptExtensionPlugin@@2UQMetaObject@@B @ 369 NONAME ; struct QMetaObject const QScriptExtensionPlugin::staticMetaObject
?staticMetaObject@QScriptEngine@@2UQMetaObject@@B @ 370 NONAME ; struct QMetaObject const QScriptEngine::staticMetaObject
+ ?isQObject@QScriptDeclarativeClass@@UBE_NXZ @ 371 NONAME ; bool QScriptDeclarativeClass::isQObject(void) const
diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def
index 89fa76f..a427ff9 100644
--- a/src/s60installs/eabi/QtCoreu.def
+++ b/src/s60installs/eabi/QtCoreu.def
@@ -3633,4 +3633,5 @@ EXPORTS
_ZTIN13QStateMachine12WrappedEventE @ 3632 NONAME
_ZTVN13QStateMachine11SignalEventE @ 3633 NONAME
_ZTVN13QStateMachine12WrappedEventE @ 3634 NONAME
+ _ZN11QMetaObject13disconnectOneEPK7QObjectiS2_i @ 3635 NONAME
diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def
index b6862e5..05f620c 100644
--- a/src/s60installs/eabi/QtGuiu.def
+++ b/src/s60installs/eabi/QtGuiu.def
@@ -11629,9 +11629,9 @@ EXPORTS
_ZN18QTapAndHoldGestureC1EP7QObject @ 11628 NONAME
_ZN18QTapAndHoldGestureC2EP7QObject @ 11629 NONAME
_ZN19QAbstractScrollArea18setViewportMarginsERK8QMargins @ 11630 NONAME
- _ZN19QApplicationPrivate20symbianHandleCommandEi @ 11631 NONAME
- _ZN19QApplicationPrivate21symbianProcessWsEventEPK8TWsEvent @ 11632 NONAME
- _ZN19QApplicationPrivate21symbianResourceChangeEi @ 11633 NONAME
+ _ZN19QApplicationPrivate20symbianHandleCommandEi @ 11631 NONAME ABSENT
+ _ZN19QApplicationPrivate21symbianProcessWsEventEPK8TWsEvent @ 11632 NONAME ABSENT
+ _ZN19QApplicationPrivate21symbianResourceChangeEi @ 11633 NONAME ABSENT
_ZN19QGraphicsBlurEffect12setBlurHintsE6QFlagsINS_8BlurHintEE @ 11634 NONAME
_ZN19QGraphicsBlurEffect13setBlurRadiusEf @ 11635 NONAME
_ZN19QGraphicsBlurEffect16blurHintsChangedE6QFlagsINS_8BlurHintEE @ 11636 NONAME
@@ -11784,4 +11784,12 @@ EXPORTS
_ZNK14QEglProperties8toStringEv @ 11783 NONAME ABSENT
_ZNK11QFontEngine10glyphCacheEPvN21QFontEngineGlyphCache4TypeERK10QTransform @ 11784 NONAME
_ZNK20QGraphicsItemPrivate21effectiveBoundingRectERK6QRectF @ 11785 NONAME
+ _Z12qt_blurImageP8QPainterR6QImagefbbi @ 11786 NONAME
+ _Z12qt_blurImageR6QImagefbi @ 11787 NONAME
+ _Z13qt_halfScaledRK6QImage @ 11788 NONAME
+ _Z14qt_memrotate90PKjiiiPji @ 11789 NONAME
+ _Z17qt_memrotate90_glPKjiiiPji @ 11790 NONAME
+ _ZN19QApplicationPrivate20symbianHandleCommandEPK13QSymbianEvent @ 11791 NONAME
+ _ZN19QApplicationPrivate21symbianProcessWsEventEPK13QSymbianEvent @ 11792 NONAME
+ _ZN19QApplicationPrivate21symbianResourceChangeEPK13QSymbianEvent @ 11793 NONAME
diff --git a/src/s60installs/eabi/QtScriptu.def b/src/s60installs/eabi/QtScriptu.def
index 8df03c2..8a4be2c 100644
--- a/src/s60installs/eabi/QtScriptu.def
+++ b/src/s60installs/eabi/QtScriptu.def
@@ -393,4 +393,5 @@ EXPORTS
_ZNK23QScriptDeclarativeClass7contextEv @ 392 NONAME
_ZTI23QScriptDeclarativeClass @ 393 NONAME
_ZTV23QScriptDeclarativeClass @ 394 NONAME
+ _ZNK23QScriptDeclarativeClass9isQObjectEv @ 395 NONAME
diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp
index c7fc43f..a77e713 100644
--- a/tools/runonphone/main.cpp
+++ b/tools/runonphone/main.cpp
@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
QString serialPortFriendlyName;
QString sisFile;
QString exeFile;
- QString cmdLine;
+ QStringList cmdLine;
QStringList args = QCoreApplication::arguments();
QTextStream outstream(stdout);
QTextStream errstream(stderr);
@@ -124,7 +124,6 @@ int main(int argc, char *argv[])
i++;
for(;i<args.size();i++) {
cmdLine.append(args.at(i));
- if(i + 1 < args.size()) cmdLine.append(' ');
}
}
}
@@ -204,8 +203,8 @@ int main(int argc, char *argv[])
QObject::connect(launcher.data(), SIGNAL(applicationOutputReceived(const QString &)), &handler, SLOT(applicationOutputReceived(const QString &)));
QObject::connect(launcher.data(), SIGNAL(copyProgress(int)), &handler, SLOT(copyProgress(int)));
QObject::connect(launcher.data(), SIGNAL(stateChanged(int)), &handler, SLOT(stateChanged(int)));
- QObject::connect(launcher.data(), SIGNAL(stopped(uint,uint,uint,QString)), &handler, SLOT(stopped(uint,uint,uint,QString)));
- QObject::connect(&handler, SIGNAL(resume(uint,uint)), launcher.data(), SLOT(resume(uint,uint)));
+ QObject::connect(launcher.data(), SIGNAL(processStopped(uint,uint,uint,QString)), &handler, SLOT(stopped(uint,uint,uint,QString)));
+ QObject::connect(&handler, SIGNAL(resume(uint,uint)), launcher.data(), SLOT(resumeProcess(uint,uint)));
QObject::connect(&handler, SIGNAL(terminate()), launcher.data(), SLOT(terminate()));
QObject::connect(launcher.data(), SIGNAL(finished()), &handler, SLOT(finished()));
diff --git a/tools/runonphone/runonphone.pro b/tools/runonphone/runonphone.pro
index cb27d1b..2c1be98 100644
--- a/tools/runonphone/runonphone.pro
+++ b/tools/runonphone/runonphone.pro
@@ -18,7 +18,7 @@ windows {
-luuid \
-ladvapi32
}
-unix:!symbian {
+else:unix:!symbian {
SOURCES += serenum_unix.cpp
}
else {
diff --git a/tools/runonphone/trk/launcher.cpp b/tools/runonphone/trk/launcher.cpp
index 8f150c6..1796fc5 100644
--- a/tools/runonphone/trk/launcher.cpp
+++ b/tools/runonphone/trk/launcher.cpp
@@ -76,7 +76,7 @@ struct LauncherPrivate {
CopyState m_copyState;
QString m_fileName;
- QString m_commandLineArgs;
+ QStringList m_commandLineArgs;
QString m_installFileName;
int m_verbose;
Launcher::Actions m_startupActions;
@@ -159,7 +159,7 @@ void Launcher::setInstallFileName(const QString &name)
d->m_installFileName = name;
}
-void Launcher::setCommandLineArgs(const QString &args)
+void Launcher::setCommandLineArgs(const QStringList &args)
{
d->m_commandLineArgs = args;
}
@@ -189,8 +189,10 @@ bool Launcher::startServer(QString *errorMessage)
{
errorMessage->clear();
if (d->m_verbose) {
- const QString msg = QString::fromLatin1("Port=%1 Executable=%2 Package=%3 Remote Package=%4 Install file=%5")
- .arg(d->m_trkServerName, d->m_fileName, d->m_copyState.sourceFileName, d->m_copyState.destinationFileName, d->m_installFileName);
+ const QString msg = QString::fromLatin1("Port=%1 Executable=%2 Arguments=%3 Package=%4 Remote Package=%5 Install file=%6")
+ .arg(d->m_trkServerName, d->m_fileName,
+ d->m_commandLineArgs.join(QString(QLatin1Char(' '))),
+ d->m_copyState.sourceFileName, d->m_copyState.destinationFileName, d->m_installFileName);
logMessage(msg);
}
if (d->m_startupActions & ActionCopy) {
@@ -296,6 +298,34 @@ void Launcher::handleRemoteProcessKilled(const TrkResult &result)
disconnectTrk();
}
+QString Launcher::msgStopped(uint pid, uint tid, uint address, const QString &why)
+{
+ return QString::fromLatin1("Process %1, thread %2 stopped at 0x%3: %4").
+ arg(pid).arg(tid).arg(address, 0, 16).
+ arg(why.isEmpty() ? QString::fromLatin1("<Unknown reason>") : why);
+}
+
+bool Launcher::parseNotifyStopped(const QByteArray &dataBA,
+ uint *pid, uint *tid, uint *address,
+ QString *why /* = 0 */)
+{
+ if (why)
+ why->clear();
+ *address = *pid = *tid = 0;
+ if (dataBA.size() < 12)
+ return false;
+ const char *data = dataBA.data();
+ *address = extractInt(data);
+ *pid = extractInt(data + 4);
+ *tid = extractInt(data + 8);
+ if (why && dataBA.size() >= 14) {
+ const unsigned short len = extractShort(data + 12);
+ if (len > 0)
+ *why = QString::fromLatin1(data + 14, len);
+ }
+ return true;
+}
+
void Launcher::handleResult(const TrkResult &result)
{
QByteArray prefix = "READ BUF: ";
@@ -315,25 +345,13 @@ void Launcher::handleResult(const TrkResult &result)
break;
}
case TrkNotifyStopped: { // Notified Stopped
- logMessage(prefix + "NOTE: STOPPED " + str);
- // 90 01 78 6a 40 40 00 00 07 23 00 00 07 24 00 00
QString reason;
- if (result.data.size() >= 14) {
- uint pc = extractInt(result.data.mid(0,4).constData());
- uint pid = extractInt(result.data.mid(4,4).constData());
- uint tid = extractInt(result.data.mid(8,4).constData());
- ushort len = extractShort(result.data.mid(12,2).constData());
- if(len > 0)
- reason = result.data.mid(14, len);
- emit(stopped(pc, pid, tid, reason));
- } else {
- emit(stopped(0, 0, 0, reason));
- }
- //const char *data = result.data.data();
-// uint addr = extractInt(data); //code address: 4 bytes; code base address for the library
-// uint pid = extractInt(data + 4); // ProcessID: 4 bytes;
-// uint tid = extractInt(data + 8); // ThreadID: 4 bytes
- //logMessage(prefix << " ADDR: " << addr << " PID: " << pid << " TID: " << tid);
+ uint pc;
+ uint pid;
+ uint tid;
+ parseNotifyStopped(result.data, &pid, &tid, &pc, &reason);
+ logMessage(prefix + msgStopped(pid, tid, pc, reason));
+ emit(processStopped(pc, pid, tid, reason));
d->m_device->sendTrkAck(result.token);
break;
}
@@ -681,31 +699,38 @@ void Launcher::handleInstallPackageFinished(const TrkResult &result)
}
}
-void Launcher::startInferiorIfNeeded()
+QByteArray Launcher::startProcessMessage(const QString &executable,
+ const QStringList &arguments)
{
- emit startingApplication();
- if (d->m_session.pid != 0) {
- logMessage("Process already 'started'");
- return;
- }
// It's not started yet
QByteArray ba;
appendShort(&ba, 0, TargetByteOrder); // create new process
appendByte(&ba, 0); // options - currently unused
+ if(arguments.isEmpty()) {
+ appendString(&ba, executable.toLocal8Bit(), TargetByteOrder);
+ return ba;
+ }
+ // Append full command line as one string (leading length information).
+ QByteArray commandLineBa;
+ commandLineBa.append(executable.toLocal8Bit());
+ commandLineBa.append('\0');
+ commandLineBa.append(arguments.join(QString(QLatin1Char(' '))).toLocal8Bit());
+ appendString(&ba, commandLineBa, TargetByteOrder);
+ return ba;
+}
- if(d->m_commandLineArgs.isEmpty()) {
- appendString(&ba, d->m_fileName.toLocal8Bit(), TargetByteOrder);
- } else {
- QByteArray ba2;
- ba2.append(d->m_fileName.toLocal8Bit());
- ba2.append('\0');
- ba2.append(d->m_commandLineArgs.toLocal8Bit());
- appendString(&ba, ba2, TargetByteOrder);
+void Launcher::startInferiorIfNeeded()
+{
+ emit startingApplication();
+ if (d->m_session.pid != 0) {
+ logMessage("Process already 'started'");
+ return;
}
- d->m_device->sendTrkMessage(TrkCreateItem, TrkCallback(this, &Launcher::handleCreateProcess), ba); // Create Item
+ d->m_device->sendTrkMessage(TrkCreateItem, TrkCallback(this, &Launcher::handleCreateProcess),
+ startProcessMessage(d->m_fileName, d->m_commandLineArgs)); // Create Item
}
-void Launcher::resume(uint pid, uint tid)
+void Launcher::resumeProcess(uint pid, uint tid)
{
QByteArray ba;
appendInt(&ba, pid, BigEndian);
diff --git a/tools/runonphone/trk/launcher.h b/tools/runonphone/trk/launcher.h
index 5dded53..8dc6ebe 100644
--- a/tools/runonphone/trk/launcher.h
+++ b/tools/runonphone/trk/launcher.h
@@ -95,7 +95,7 @@ public:
void setFileName(const QString &name);
void setCopyFileName(const QString &srcName, const QString &dstName);
void setInstallFileName(const QString &name);
- void setCommandLineArgs(const QString &args);
+ void setCommandLineArgs(const QStringList &args);
bool startServer(QString *errorMessage);
void setVerbose(int v);
void setSerialFrame(bool b);
@@ -109,6 +109,15 @@ public:
// becomes valid after successful execution of ActionPingOnly
QString deviceDescription(unsigned verbose = 0u) const;
+ static QByteArray startProcessMessage(const QString &executable,
+ const QStringList &arguments);
+ // Parse a TrkNotifyStopped message
+ static bool parseNotifyStopped(const QByteArray &a,
+ uint *pid, uint *tid, uint *address,
+ QString *why = 0);
+ // Helper message
+ static QString msgStopped(uint pid, uint tid, uint address, const QString &why);
+
signals:
void copyingStarted();
void canNotConnect(const QString &errorMessage);
@@ -125,11 +134,11 @@ signals:
void applicationOutputReceived(const QString &output);
void copyProgress(int percent);
void stateChanged(int);
- void stopped(uint pc, uint pid, uint tid, const QString& reason);
+ void processStopped(uint pc, uint pid, uint tid, const QString& reason);
public slots:
void terminate();
- void resume(uint pid, uint tid);
+ void resumeProcess(uint pid, uint tid);
private slots:
void handleResult(const trk::TrkResult &data);
diff --git a/tools/runonphone/trk/trkdevice.cpp b/tools/runonphone/trk/trkdevice.cpp
index 53f4490..fe3261b 100644
--- a/tools/runonphone/trk/trkdevice.cpp
+++ b/tools/runonphone/trk/trkdevice.cpp
@@ -99,6 +99,8 @@ QString winErrorMessage(unsigned long error)
#endif
+enum { verboseTrk = 0 };
+
namespace trk {
///////////////////////////////////////////////////////////////////////
@@ -128,6 +130,12 @@ TrkMessage::TrkMessage(byte c, byte t, TrkCallback cb) :
{
}
+QDebug operator<<(QDebug d, const TrkMessage &msg)
+{
+ return d << "Message: Code: " << msg.code
+ << " Token: " << msg.token << " " << msg.data.toHex();
+}
+
} // namespace trk
Q_DECLARE_METATYPE(trk::TrkMessage)
@@ -204,6 +212,8 @@ byte TrkWriteQueue::nextTrkWriteToken()
++m_trkWriteToken;
if (m_trkWriteToken == 0)
++m_trkWriteToken;
+ if (verboseTrk)
+ qDebug() << "Write token: " << m_trkWriteToken;
return m_trkWriteToken;
}
@@ -334,7 +344,8 @@ DeviceContext::DeviceContext() :
///////////////////////////////////////////////////////////////////////
-class WriterThread : public QThread {
+class WriterThread : public QThread
+{
Q_OBJECT
Q_DISABLE_COPY(WriterThread)
public:
@@ -400,15 +411,18 @@ int WriterThread::writePendingMessage()
m_waitMutex.unlock();
if (m_terminate)
return 1;
+
// Send off message
m_dataMutex.lock();
TrkMessage message;
const TrkWriteQueue::PendingMessageResult pr = m_queue.pendingMessage(&message);
m_dataMutex.unlock();
+
switch (pr) {
case TrkWriteQueue::NoMessage:
break;
case TrkWriteQueue::PendingMessage: {
+ //qDebug() << "Write pending message " << message;
// Untested: try to re-send a few times
bool success = false;
for (int r = 0; !success && (r < MaxAttempts); r++) {
@@ -428,6 +442,8 @@ int WriterThread::writePendingMessage()
break;
case TrkWriteQueue::NoopMessageDequeued:
// Sync with thread that owns us via a blocking signal
+ if (verboseTrk)
+ qDebug() << "Noop message dequeued" << message;
emit internalNoopMessageDequeued(message);
break;
} // switch
@@ -499,6 +515,8 @@ static inline bool overlappedSyncWrite(HANDLE file,
bool WriterThread::write(const QByteArray &data, QString *errorMessage)
{
+ if (verboseTrk)
+ qDebug() << "Write raw data: " << data.toHex();
QMutexLocker locker(&m_context->mutex);
#ifdef Q_OS_WIN
DWORD charsWritten;
@@ -557,6 +575,7 @@ void WriterThread::slotHandleResult(const TrkResult &result)
tryWrite(); // Have messages been enqueued in-between?
}
+
///////////////////////////////////////////////////////////////////////
//
// ReaderThreadBase: Base class for a thread that reads data from
@@ -566,7 +585,8 @@ void WriterThread::slotHandleResult(const TrkResult &result)
//
///////////////////////////////////////////////////////////////////////
-class ReaderThreadBase : public QThread {
+class ReaderThreadBase : public QThread
+{
Q_OBJECT
Q_DISABLE_COPY(ReaderThreadBase)
public:
@@ -625,7 +645,8 @@ void ReaderThreadBase::readMessages()
//
///////////////////////////////////////////////////////////////////////
-class WinReaderThread : public ReaderThreadBase {
+class WinReaderThread : public ReaderThreadBase
+{
Q_OBJECT
Q_DISABLE_COPY(WinReaderThread)
public:
@@ -835,7 +856,8 @@ void UnixReaderThread::terminate()
{
// Trigger select() by writing to the pipe
char c = 0;
- write(m_terminatePipeFileDescriptors[1], &c, 1);
+ int written = write(m_terminatePipeFileDescriptors[1], &c, 1);
+ // FIXME: Use result.
wait();
}
@@ -1021,6 +1043,8 @@ void TrkDevice::setVerbose(int b)
void TrkDevice::slotMessageReceived(const trk::TrkResult &result, const QByteArray &rawData)
{
d->writerThread->slotHandleResult(result);
+ if (d->verbose > 1)
+ qDebug() << "Received: " << result.toString();
emit messageReceived(result);
if (!rawData.isEmpty())
emit rawDataReceived(rawData);
@@ -1057,6 +1081,8 @@ bool TrkDevice::sendTrkAck(byte token)
TrkMessage msg(0x80, token);
msg.token = token;
msg.data.append('\0');
+ if (verboseTrk)
+ qDebug() << "Write synchroneous message: " << msg;
return d->writerThread->trkWriteRawMessage(msg);
// 01 90 00 07 7e 80 01 00 7d 5e 7e
}
diff --git a/tools/runonphone/trk/trkutils.h b/tools/runonphone/trk/trkutils.h
index c636ac0..328dd2b 100644
--- a/tools/runonphone/trk/trkutils.h
+++ b/tools/runonphone/trk/trkutils.h
@@ -119,7 +119,8 @@ struct Library
uint dataseg;
};
-struct TrkAppVersion {
+struct TrkAppVersion
+{
TrkAppVersion();
void reset();
@@ -153,6 +154,10 @@ struct Session
typedef QList<Library> Libraries;
Libraries libraries;
+ typedef uint Thread;
+ typedef QList<Thread> Threads;
+ Threads threads;
+
// Gdb request
uint currentThread;
QStringList modules;