Ignore:
Timestamp:
Mar 8, 2010, 12:52:58 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.2 sources.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/runonphone/trk/bluetoothlistener.cpp

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
  • trunk/tools/runonphone/trk/bluetoothlistener.h

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
  • trunk/tools/runonphone/trk/bluetoothlistener_gui.cpp

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
  • trunk/tools/runonphone/trk/bluetoothlistener_gui.h

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
  • trunk/tools/runonphone/trk/callback.h

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
  • trunk/tools/runonphone/trk/communicationstarter.cpp

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
  • trunk/tools/runonphone/trk/communicationstarter.h

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
  • trunk/tools/runonphone/trk/launcher.cpp

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    7777    CopyState m_copyState;
    7878    QString m_fileName;
    79     QString m_commandLineArgs;
     79    QString m_commandLineArgs;
    8080    QString m_installFileName;
    8181    int m_verbose;
     
    160160}
    161161
    162 void Launcher::setCommandLineArgs(const QString &args)
     162void Launcher::setCommandLineArgs(const QString &args)
    163163{
    164164    d->m_commandLineArgs = args;
     
    190190    errorMessage->clear();
    191191    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);
    194196        logMessage(msg);
    195197    }
     
    297299}
    298300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
    299329void Launcher::handleResult(const TrkResult &result)
    300330{
     
    316346        }
    317347        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 00
    320348            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));
    337355            d->m_device->sendTrkAck(result.token);
    338356            break;
     
    682700}
    683701
    684 void Launcher::startInferiorIfNeeded()
    685 {
    686     emit startingApplication();
    687     if (d->m_session.pid != 0) {
    688         logMessage("Process already 'started'");
    689         return;
    690     }
     702QByteArray Launcher::startProcessMessage(const QString &executable,
     703                                         const QStringList &arguments)
     704{
    691705    // It's not started yet
    692706    QByteArray ba;
    693707    appendShort(&ba, 0, TargetByteOrder); // create new process
    694708    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
     722void 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
     733void Launcher::resumeProcess(uint pid, uint tid)
    709734{
    710735    QByteArray ba;
  • trunk/tools/runonphone/trk/launcher.h

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    9696    void setCopyFileName(const QString &srcName, const QString &dstName);
    9797    void setInstallFileName(const QString &name);
    98     void setCommandLineArgs(const QString &args);
     98    void setCommandLineArgs(const QString &args);
    9999    bool startServer(QString *errorMessage);
    100100    void setVerbose(int v);   
     
    109109    // becomes valid after successful execution of ActionPingOnly
    110110    QString deviceDescription(unsigned verbose = 0u) const;
     111
     112
     113
     114
     115
     116
     117
     118
     119
    111120
    112121signals:
     
    126135    void copyProgress(int percent);
    127136    void stateChanged(int);
    128     void stopped(uint pc, uint pid, uint tid, const QString& reason);
     137    void topped(uint pc, uint pid, uint tid, const QString& reason);
    129138
    130139public slots:
    131140    void terminate();
    132     void resume(uint pid, uint tid);
     141    void resume(uint pid, uint tid);
    133142
    134143private slots:
  • trunk/tools/runonphone/trk/trkdevice.cpp

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    100100#endif
    101101
     102
     103
    102104namespace trk {
    103105
     
    127129    callback(cb)
    128130{
     131
     132
     133
     134
     135
     136
    129137}
    130138
     
    205213    if (m_trkWriteToken == 0)
    206214        ++m_trkWriteToken;
     215
     216
    207217    return m_trkWriteToken;
    208218}
     
    335345///////////////////////////////////////////////////////////////////////
    336346
    337 class WriterThread : public QThread {
     347class WriterThread : public QThread
     348{
    338349    Q_OBJECT
    339350    Q_DISABLE_COPY(WriterThread)
     
    401412    if (m_terminate)
    402413        return 1;
     414
    403415    // Send off message
    404416    m_dataMutex.lock();
     
    406418    const TrkWriteQueue::PendingMessageResult pr = m_queue.pendingMessage(&message);
    407419    m_dataMutex.unlock();
     420
    408421    switch (pr) {
    409422    case TrkWriteQueue::NoMessage:
    410423        break;
    411424    case TrkWriteQueue::PendingMessage: {
     425
    412426            // Untested: try to re-send a few times
    413427            bool success = false;
     
    429443    case TrkWriteQueue::NoopMessageDequeued:
    430444        // Sync with thread that owns us via a blocking signal
     445
     446
    431447        emit internalNoopMessageDequeued(message);
    432448        break;
     
    500516bool WriterThread::write(const QByteArray &data, QString *errorMessage)
    501517{
     518
     519
    502520    QMutexLocker locker(&m_context->mutex);
    503521#ifdef Q_OS_WIN
     
    558576}
    559577
     578
    560579///////////////////////////////////////////////////////////////////////
    561580//
     
    567586///////////////////////////////////////////////////////////////////////
    568587
    569 class ReaderThreadBase : public QThread {
     588class ReaderThreadBase : public QThread
     589{
    570590    Q_OBJECT
    571591    Q_DISABLE_COPY(ReaderThreadBase)
     
    626646///////////////////////////////////////////////////////////////////////
    627647
    628 class WinReaderThread : public ReaderThreadBase {
     648class WinReaderThread : public ReaderThreadBase
     649{
    629650    Q_OBJECT
    630651    Q_DISABLE_COPY(WinReaderThread)
     
    836857    // Trigger select() by writing to the pipe
    837858    char c = 0;
    838     write(m_terminatePipeFileDescriptors[1], &c, 1);
     859    int written = write(m_terminatePipeFileDescriptors[1], &c, 1);
     860    // FIXME: Use result.
    839861    wait();
    840862}
     
    10221044{
    10231045    d->writerThread->slotHandleResult(result);
     1046
     1047
    10241048    emit messageReceived(result);   
    10251049    if (!rawData.isEmpty())
     
    10581082    msg.token = token;
    10591083    msg.data.append('\0');
     1084
     1085
    10601086    return d->writerThread->trkWriteRawMessage(msg);
    10611087    // 01 90 00 07 7e 80 01 00 7d 5e 7e
  • trunk/tools/runonphone/trk/trkdevice.h

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
  • trunk/tools/runonphone/trk/trkutils.cpp

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
  • trunk/tools/runonphone/trk/trkutils.h

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    120120};
    121121
    122 struct TrkAppVersion {
     122struct TrkAppVersion
     123{
    123124    TrkAppVersion();
    124125    void reset();   
     
    153154    typedef QList<Library> Libraries;
    154155    Libraries libraries;
     156
     157
     158
     159
    155160
    156161    // Gdb request
Note: See TracChangeset for help on using the changeset viewer.