Changeset 651 for trunk/tools/runonphone
- Timestamp:
- Mar 8, 2010, 12:52:58 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.2 (added) merged: 650 /branches/vendor/nokia/qt/current merged: 649 /branches/vendor/nokia/qt/4.6.1 removed
- Property svn:mergeinfo changed
-
trunk/tools/runonphone/main.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 73 73 QString sisFile; 74 74 QString exeFile; 75 QString cmdLine;75 QStringList cmdLine; 76 76 QStringList args = QCoreApplication::arguments(); 77 77 QTextStream outstream(stdout); … … 125 125 for(;i<args.size();i++) { 126 126 cmdLine.append(args.at(i)); 127 if(i + 1 < args.size()) cmdLine.append(' ');128 127 } 129 128 } … … 176 175 if(loglevel > 0) 177 176 outstream << "Connecting to target via " << serialPortName << endl; 177 #ifdef Q_OS_WIN 178 178 launcher->setTrkServerName(QString("\\\\.\\") + serialPortName); 179 #else 180 launcher->setTrkServerName(serialPortName); 181 #endif 179 182 180 183 launcher->setFileName(QString("c:\\sys\\bin\\") + exeFile); … … 201 204 QObject::connect(launcher.data(), SIGNAL(copyProgress(int)), &handler, SLOT(copyProgress(int))); 202 205 QObject::connect(launcher.data(), SIGNAL(stateChanged(int)), &handler, SLOT(stateChanged(int))); 203 QObject::connect(launcher.data(), SIGNAL( stopped(uint,uint,uint,QString)), &handler, SLOT(stopped(uint,uint,uint,QString)));204 QObject::connect(&handler, SIGNAL(resume(uint,uint)), launcher.data(), SLOT(resume (uint,uint)));206 QObject::connect(launcher.data(), SIGNAL(processStopped(uint,uint,uint,QString)), &handler, SLOT(stopped(uint,uint,uint,QString))); 207 QObject::connect(&handler, SIGNAL(resume(uint,uint)), launcher.data(), SLOT(resumeProcess(uint,uint))); 205 208 QObject::connect(&handler, SIGNAL(terminate()), launcher.data(), SLOT(terminate())); 206 209 QObject::connect(launcher.data(), SIGNAL(finished()), &handler, SLOT(finished())); -
trunk/tools/runonphone/runonphone.pro
r561 r651 19 19 -ladvapi32 20 20 } 21 else:unix:!symbian { 22 SOURCES += serenum_unix.cpp 23 } 24 else { 25 SOURCES += serenum_stub.cpp 26 } -
trunk/tools/runonphone/serenum.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/serenum_win.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/trk/bluetoothlistener.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/trk/bluetoothlistener.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/trk/bluetoothlistener_gui.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/trk/bluetoothlistener_gui.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/trk/callback.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/trk/communicationstarter.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/trk/communicationstarter.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/trk/launcher.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 77 77 CopyState m_copyState; 78 78 QString m_fileName; 79 QString m_commandLineArgs;79 QStringList m_commandLineArgs; 80 80 QString m_installFileName; 81 81 int m_verbose; … … 160 160 } 161 161 162 void Launcher::setCommandLineArgs(const QString &args)162 void Launcher::setCommandLineArgs(const QStringList &args) 163 163 { 164 164 d->m_commandLineArgs = args; … … 190 190 errorMessage->clear(); 191 191 if (d->m_verbose) { 192 const QString msg = QString::fromLatin1("Port=%1 Executable=%2 Package=%3 Remote Package=%4 Install file=%5") 193 .arg(d->m_trkServerName, d->m_fileName, d->m_copyState.sourceFileName, d->m_copyState.destinationFileName, d->m_installFileName); 192 const QString msg = QString::fromLatin1("Port=%1 Executable=%2 Arguments=%3 Package=%4 Remote Package=%5 Install file=%6") 193 .arg(d->m_trkServerName, d->m_fileName, 194 d->m_commandLineArgs.join(QString(QLatin1Char(' '))), 195 d->m_copyState.sourceFileName, d->m_copyState.destinationFileName, d->m_installFileName); 194 196 logMessage(msg); 195 197 } … … 297 299 } 298 300 301 QString Launcher::msgStopped(uint pid, uint tid, uint address, const QString &why) 302 { 303 return QString::fromLatin1("Process %1, thread %2 stopped at 0x%3: %4"). 304 arg(pid).arg(tid).arg(address, 0, 16). 305 arg(why.isEmpty() ? QString::fromLatin1("<Unknown reason>") : why); 306 } 307 308 bool Launcher::parseNotifyStopped(const QByteArray &dataBA, 309 uint *pid, uint *tid, uint *address, 310 QString *why /* = 0 */) 311 { 312 if (why) 313 why->clear(); 314 *address = *pid = *tid = 0; 315 if (dataBA.size() < 12) 316 return false; 317 const char *data = dataBA.data(); 318 *address = extractInt(data); 319 *pid = extractInt(data + 4); 320 *tid = extractInt(data + 8); 321 if (why && dataBA.size() >= 14) { 322 const unsigned short len = extractShort(data + 12); 323 if (len > 0) 324 *why = QString::fromLatin1(data + 14, len); 325 } 326 return true; 327 } 328 299 329 void Launcher::handleResult(const TrkResult &result) 300 330 { … … 316 346 } 317 347 case TrkNotifyStopped: { // Notified Stopped 318 logMessage(prefix + "NOTE: STOPPED " + str);319 // 90 01 78 6a 40 40 00 00 07 23 00 00 07 24 00 00320 348 QString reason; 321 if (result.data.size() >= 14) { 322 uint pc = extractInt(result.data.mid(0,4).constData()); 323 uint pid = extractInt(result.data.mid(4,4).constData()); 324 uint tid = extractInt(result.data.mid(8,4).constData()); 325 ushort len = extractShort(result.data.mid(12,2).constData()); 326 if(len > 0) 327 reason = result.data.mid(14, len); 328 emit(stopped(pc, pid, tid, reason)); 329 } else { 330 emit(stopped(0, 0, 0, reason)); 331 } 332 //const char *data = result.data.data(); 333 // uint addr = extractInt(data); //code address: 4 bytes; code base address for the library 334 // uint pid = extractInt(data + 4); // ProcessID: 4 bytes; 335 // uint tid = extractInt(data + 8); // ThreadID: 4 bytes 336 //logMessage(prefix << " ADDR: " << addr << " PID: " << pid << " TID: " << tid); 349 uint pc; 350 uint pid; 351 uint tid; 352 parseNotifyStopped(result.data, &pid, &tid, &pc, &reason); 353 logMessage(prefix + msgStopped(pid, tid, pc, reason)); 354 emit(processStopped(pc, pid, tid, reason)); 337 355 d->m_device->sendTrkAck(result.token); 338 356 break; … … 682 700 } 683 701 684 void Launcher::startInferiorIfNeeded() 685 { 686 emit startingApplication(); 687 if (d->m_session.pid != 0) { 688 logMessage("Process already 'started'"); 689 return; 690 } 702 QByteArray Launcher::startProcessMessage(const QString &executable, 703 const QStringList &arguments) 704 { 691 705 // It's not started yet 692 706 QByteArray ba; 693 707 appendShort(&ba, 0, TargetByteOrder); // create new process 694 708 appendByte(&ba, 0); // options - currently unused 695 696 if(d->m_commandLineArgs.isEmpty()) { 697 appendString(&ba, d->m_fileName.toLocal8Bit(), TargetByteOrder); 698 } else { 699 QByteArray ba2; 700 ba2.append(d->m_fileName.toLocal8Bit()); 701 ba2.append('\0'); 702 ba2.append(d->m_commandLineArgs.toLocal8Bit()); 703 appendString(&ba, ba2, TargetByteOrder); 704 } 705 d->m_device->sendTrkMessage(TrkCreateItem, TrkCallback(this, &Launcher::handleCreateProcess), ba); // Create Item 706 } 707 708 void Launcher::resume(uint pid, uint tid) 709 if(arguments.isEmpty()) { 710 appendString(&ba, executable.toLocal8Bit(), TargetByteOrder); 711 return ba; 712 } 713 // Append full command line as one string (leading length information). 714 QByteArray commandLineBa; 715 commandLineBa.append(executable.toLocal8Bit()); 716 commandLineBa.append('\0'); 717 commandLineBa.append(arguments.join(QString(QLatin1Char(' '))).toLocal8Bit()); 718 appendString(&ba, commandLineBa, TargetByteOrder); 719 return ba; 720 } 721 722 void Launcher::startInferiorIfNeeded() 723 { 724 emit startingApplication(); 725 if (d->m_session.pid != 0) { 726 logMessage("Process already 'started'"); 727 return; 728 } 729 d->m_device->sendTrkMessage(TrkCreateItem, TrkCallback(this, &Launcher::handleCreateProcess), 730 startProcessMessage(d->m_fileName, d->m_commandLineArgs)); // Create Item 731 } 732 733 void Launcher::resumeProcess(uint pid, uint tid) 709 734 { 710 735 QByteArray ba; -
trunk/tools/runonphone/trk/launcher.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 96 96 void setCopyFileName(const QString &srcName, const QString &dstName); 97 97 void setInstallFileName(const QString &name); 98 void setCommandLineArgs(const QString &args);98 void setCommandLineArgs(const QStringList &args); 99 99 bool startServer(QString *errorMessage); 100 100 void setVerbose(int v); … … 109 109 // becomes valid after successful execution of ActionPingOnly 110 110 QString deviceDescription(unsigned verbose = 0u) const; 111 112 static QByteArray startProcessMessage(const QString &executable, 113 const QStringList &arguments); 114 // Parse a TrkNotifyStopped message 115 static bool parseNotifyStopped(const QByteArray &a, 116 uint *pid, uint *tid, uint *address, 117 QString *why = 0); 118 // Helper message 119 static QString msgStopped(uint pid, uint tid, uint address, const QString &why); 111 120 112 121 signals: … … 126 135 void copyProgress(int percent); 127 136 void stateChanged(int); 128 void stopped(uint pc, uint pid, uint tid, const QString& reason);137 void processStopped(uint pc, uint pid, uint tid, const QString& reason); 129 138 130 139 public slots: 131 140 void terminate(); 132 void resume (uint pid, uint tid);141 void resumeProcess(uint pid, uint tid); 133 142 134 143 private slots: -
trunk/tools/runonphone/trk/trkdevice.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 100 100 #endif 101 101 102 enum { verboseTrk = 0 }; 103 102 104 namespace trk { 103 105 … … 127 129 callback(cb) 128 130 { 131 } 132 133 QDebug operator<<(QDebug d, const TrkMessage &msg) 134 { 135 return d << "Message: Code: " << msg.code 136 << " Token: " << msg.token << " " << msg.data.toHex(); 129 137 } 130 138 … … 205 213 if (m_trkWriteToken == 0) 206 214 ++m_trkWriteToken; 215 if (verboseTrk) 216 qDebug() << "Write token: " << m_trkWriteToken; 207 217 return m_trkWriteToken; 208 218 } … … 335 345 /////////////////////////////////////////////////////////////////////// 336 346 337 class WriterThread : public QThread { 347 class WriterThread : public QThread 348 { 338 349 Q_OBJECT 339 350 Q_DISABLE_COPY(WriterThread) … … 401 412 if (m_terminate) 402 413 return 1; 414 403 415 // Send off message 404 416 m_dataMutex.lock(); … … 406 418 const TrkWriteQueue::PendingMessageResult pr = m_queue.pendingMessage(&message); 407 419 m_dataMutex.unlock(); 420 408 421 switch (pr) { 409 422 case TrkWriteQueue::NoMessage: 410 423 break; 411 424 case TrkWriteQueue::PendingMessage: { 425 //qDebug() << "Write pending message " << message; 412 426 // Untested: try to re-send a few times 413 427 bool success = false; … … 429 443 case TrkWriteQueue::NoopMessageDequeued: 430 444 // Sync with thread that owns us via a blocking signal 445 if (verboseTrk) 446 qDebug() << "Noop message dequeued" << message; 431 447 emit internalNoopMessageDequeued(message); 432 448 break; … … 500 516 bool WriterThread::write(const QByteArray &data, QString *errorMessage) 501 517 { 518 if (verboseTrk) 519 qDebug() << "Write raw data: " << data.toHex(); 502 520 QMutexLocker locker(&m_context->mutex); 503 521 #ifdef Q_OS_WIN … … 558 576 } 559 577 578 560 579 /////////////////////////////////////////////////////////////////////// 561 580 // … … 567 586 /////////////////////////////////////////////////////////////////////// 568 587 569 class ReaderThreadBase : public QThread { 588 class ReaderThreadBase : public QThread 589 { 570 590 Q_OBJECT 571 591 Q_DISABLE_COPY(ReaderThreadBase) … … 626 646 /////////////////////////////////////////////////////////////////////// 627 647 628 class WinReaderThread : public ReaderThreadBase { 648 class WinReaderThread : public ReaderThreadBase 649 { 629 650 Q_OBJECT 630 651 Q_DISABLE_COPY(WinReaderThread) … … 836 857 // Trigger select() by writing to the pipe 837 858 char c = 0; 838 write(m_terminatePipeFileDescriptors[1], &c, 1); 859 int written = write(m_terminatePipeFileDescriptors[1], &c, 1); 860 // FIXME: Use result. 839 861 wait(); 840 862 } … … 1022 1044 { 1023 1045 d->writerThread->slotHandleResult(result); 1046 if (d->verbose > 1) 1047 qDebug() << "Received: " << result.toString(); 1024 1048 emit messageReceived(result); 1025 1049 if (!rawData.isEmpty()) … … 1058 1082 msg.token = token; 1059 1083 msg.data.append('\0'); 1084 if (verboseTrk) 1085 qDebug() << "Write synchroneous message: " << msg; 1060 1086 return d->writerThread->trkWriteRawMessage(msg); 1061 1087 // 01 90 00 07 7e 80 01 00 7d 5e 7e -
trunk/tools/runonphone/trk/trkdevice.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/trk/trkutils.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/trk/trkutils.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 120 120 }; 121 121 122 struct TrkAppVersion { 122 struct TrkAppVersion 123 { 123 124 TrkAppVersion(); 124 125 void reset(); … … 153 154 typedef QList<Library> Libraries; 154 155 Libraries libraries; 156 157 typedef uint Thread; 158 typedef QList<Thread> Threads; 159 Threads threads; 155 160 156 161 // Gdb request -
trunk/tools/runonphone/trksignalhandler.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/tools/runonphone/trksignalhandler.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com)
Note:
See TracChangeset
for help on using the changeset viewer.