Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

This commit is contained in:
Roberto Raggi
2009-07-31 01:20:23 +02:00
13 changed files with 265 additions and 34 deletions

View File

@@ -183,7 +183,7 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Reload all unmodified files</string> <string>Reload all modified files</string>
</property> </property>
</item> </item>
<item> <item>

View File

@@ -30,7 +30,7 @@
<string>When checked, all files touched by a commit will be displayed when clicking on a revision number in the annotation view (retrieved via commit id). Otherwise, only the respective file will be displayed.</string> <string>When checked, all files touched by a commit will be displayed when clicking on a revision number in the annotation view (retrieved via commit id). Otherwise, only the respective file will be displayed.</string>
</property> </property>
<property name="text"> <property name="text">
<string>Describe by commit id</string> <string>Describe all files matching commit id:</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -136,10 +136,10 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
const int rowCount = itemModel->rowCount(); const int rowCount = itemModel->rowCount();
QAction *deleteAction = new QAction(tr("Delete breakpoint", 0, si.size()), &menu); QAction *deleteAction = new QAction(tr("Delete breakpoint"), &menu);
deleteAction->setEnabled(si.size() > 0); deleteAction->setEnabled(si.size() > 0);
QAction *deleteAllAction = new QAction(tr("Delete all breakpoints", 0, si.size()), &menu); QAction *deleteAllAction = new QAction(tr("Delete all breakpoints"), &menu);
deleteAllAction->setEnabled(si.size() > 0); deleteAllAction->setEnabled(si.size() > 0);
// Delete by file: Find indexes of breakpoints of the same file // Delete by file: Find indexes of breakpoints of the same file
@@ -168,7 +168,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
alwaysAdjustAction->setCheckable(true); alwaysAdjustAction->setCheckable(true);
alwaysAdjustAction->setChecked(m_alwaysResizeColumnsToContents); alwaysAdjustAction->setChecked(m_alwaysResizeColumnsToContents);
QAction *editConditionAction = new QAction(tr("Edit condition...", 0, si.size()), &menu); QAction *editConditionAction = new QAction(tr("Edit condition..."), &menu);
editConditionAction->setEnabled(si.size() > 0); editConditionAction->setEnabled(si.size() > 0);
QAction *synchronizeAction = new QAction(tr("Synchronize breakpoints"), &menu); QAction *synchronizeAction = new QAction(tr("Synchronize breakpoints"), &menu);

View File

@@ -1525,10 +1525,11 @@ QString DebuggerManager::qtDumperLibraryName() const
QStringList DebuggerManager::qtDumperLibraryLocations() const QStringList DebuggerManager::qtDumperLibraryLocations() const
{ {
if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool()) if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool()) {
return QStringList() << const QString customLocation = theDebuggerAction(CustomDebuggingHelperLocation)->value().toString();
( theDebuggerAction(CustomDebuggingHelperLocation)->value().toString() const QString location = tr("%1 (explicitly set in the Debugger Options)").arg(customLocation);
+ tr(" (explicitly set in the Debugger Options)")); return QStringList(location);
}
return m_dumperLibLocations; return m_dumperLibLocations;
} }

View File

@@ -68,7 +68,7 @@
<item> <item>
<widget class="QCheckBox" name="includeQtModuleCheckBox"> <widget class="QCheckBox" name="includeQtModuleCheckBox">
<property name="text"> <property name="text">
<string>Include Qt module name</string> <string>Use Qt module name in #include-directive</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -26,7 +26,6 @@
* auto-create run configurations the first time s60 qt is selected. * auto-create run configurations the first time s60 qt is selected.
* Run on device * Run on device
* Finish runner when application exits
* passphrase for signing * passphrase for signing
* time stamp of copied sisx is ridiculous * time stamp of copied sisx is ridiculous
* maybe don't copy the sisx all the time * maybe don't copy the sisx all the time

View File

@@ -8,14 +8,16 @@ SUPPORT_QT_S60 = $$(QTCREATOR_WITH_S60)
$$PWD/winscwtoolchain.cpp \ $$PWD/winscwtoolchain.cpp \
$$PWD/gccetoolchain.cpp \ $$PWD/gccetoolchain.cpp \
$$PWD/s60emulatorrunconfiguration.cpp \ $$PWD/s60emulatorrunconfiguration.cpp \
$$PWD/s60devicerunconfiguration.cpp $$PWD/s60devicerunconfiguration.cpp \
$$PWD/serialdevicelister.cpp
HEADERS += $$PWD/s60devices.h \ HEADERS += $$PWD/s60devices.h \
$$PWD/s60devicespreferencepane.h \ $$PWD/s60devicespreferencepane.h \
$$PWD/s60manager.h \ $$PWD/s60manager.h \
$$PWD/winscwtoolchain.h \ $$PWD/winscwtoolchain.h \
$$PWD/gccetoolchain.h \ $$PWD/gccetoolchain.h \
$$PWD/s60emulatorrunconfiguration.h \ $$PWD/s60emulatorrunconfiguration.h \
$$PWD/s60devicerunconfiguration.h $$PWD/s60devicerunconfiguration.h \
$$PWD/serialdevicelister.h
FORMS += $$PWD/s60devicespreferencepane.ui FORMS += $$PWD/s60devicespreferencepane.ui
OTHER_FILES += $$PWD/qt-s60-todo.txt OTHER_FILES += $$PWD/qt-s60-todo.txt

View File

@@ -34,6 +34,7 @@
#include "profilereader.h" #include "profilereader.h"
#include "s60manager.h" #include "s60manager.h"
#include "s60devices.h" #include "s60devices.h"
#include "serialdevicelister.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
@@ -52,6 +53,7 @@ S60DeviceRunConfiguration::S60DeviceRunConfiguration(Project *project, const QSt
: RunConfiguration(project), : RunConfiguration(project),
m_proFilePath(proFilePath), m_proFilePath(proFilePath),
m_cachedTargetInformationValid(false), m_cachedTargetInformationValid(false),
m_serialPortName("COM5"),
m_signingMode(SignSelf) m_signingMode(SignSelf)
{ {
if (!m_proFilePath.isEmpty()) if (!m_proFilePath.isEmpty())
@@ -95,6 +97,7 @@ void S60DeviceRunConfiguration::save(PersistentSettingsWriter &writer) const
writer.saveValue("SigningMode", (int)m_signingMode); writer.saveValue("SigningMode", (int)m_signingMode);
writer.saveValue("CustomSignaturePath", m_customSignaturePath); writer.saveValue("CustomSignaturePath", m_customSignaturePath);
writer.saveValue("CustomKeyPath", m_customKeyPath); writer.saveValue("CustomKeyPath", m_customKeyPath);
writer.saveValue("SerialPortName", m_serialPortName);
RunConfiguration::save(writer); RunConfiguration::save(writer);
} }
@@ -106,6 +109,17 @@ void S60DeviceRunConfiguration::restore(const PersistentSettingsReader &reader)
m_signingMode = (SigningMode)reader.restoreValue("SigningMode").toInt(); m_signingMode = (SigningMode)reader.restoreValue("SigningMode").toInt();
m_customSignaturePath = reader.restoreValue("CustomSignaturePath").toString(); m_customSignaturePath = reader.restoreValue("CustomSignaturePath").toString();
m_customKeyPath = reader.restoreValue("CustomKeyPath").toString(); m_customKeyPath = reader.restoreValue("CustomKeyPath").toString();
m_serialPortName = reader.restoreValue("SerialPortName").toString().trimmed();
}
QString S60DeviceRunConfiguration::serialPortName() const
{
return m_serialPortName;
}
void S60DeviceRunConfiguration::setSerialPortName(const QString &name)
{
m_serialPortName = name.trimmed();
} }
QString S60DeviceRunConfiguration::targetName() const QString S60DeviceRunConfiguration::targetName() const
@@ -216,7 +230,7 @@ void S60DeviceRunConfiguration::updateTarget()
if (projectBuildConfiguration & QtVersion::DebugBuild) if (projectBuildConfiguration & QtVersion::DebugBuild)
m_baseFileName += "_udeb"; m_baseFileName += "_udeb";
else else
m_baseFileName += "_rel"; m_baseFileName += "_urel";
delete reader; delete reader;
m_cachedTargetInformationValid = true; m_cachedTargetInformationValid = true;
@@ -251,6 +265,21 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(S60DeviceRunCon
m_sisxFileLabel = new QLabel(m_runConfiguration->basePackageFilePath() + ".sisx"); m_sisxFileLabel = new QLabel(m_runConfiguration->basePackageFilePath() + ".sisx");
formLayout->addRow(tr("Install File:"), m_sisxFileLabel); formLayout->addRow(tr("Install File:"), m_sisxFileLabel);
QString runConfigurationPortName = m_runConfiguration->serialPortName();
QList<SerialDeviceLister::SerialDevice> serialDevices = SerialDeviceLister().serialDevices();
m_serialPorts = new QComboBox;
for (int i = 0; i < serialDevices.size(); ++i) {
const SerialDeviceLister::SerialDevice &device = serialDevices.at(i);
m_serialPorts->addItem(device.friendlyName, device.portName);
if (device.portName == runConfigurationPortName)
m_serialPorts->setCurrentIndex(i);
}
QString selectedPortName = m_serialPorts->itemData(m_serialPorts->currentIndex()).toString();
if (m_serialPorts->count() > 0 && runConfigurationPortName != selectedPortName)
m_runConfiguration->setSerialPortName(selectedPortName);
connect(m_serialPorts, SIGNAL(activated(int)), this, SLOT(setSerialPort(int)));
formLayout->addRow(tr("Device on Serial Port:"), m_serialPorts);
QWidget *signatureWidget = new QWidget(); QWidget *signatureWidget = new QWidget();
QVBoxLayout *layout = new QVBoxLayout(); QVBoxLayout *layout = new QVBoxLayout();
signatureWidget->setLayout(layout); signatureWidget->setLayout(layout);
@@ -312,6 +341,11 @@ void S60DeviceRunConfigurationWidget::updateTargetInformation()
m_sisxFileLabel->setText(m_runConfiguration->basePackageFilePath() + ".sisx"); m_sisxFileLabel->setText(m_runConfiguration->basePackageFilePath() + ".sisx");
} }
void S60DeviceRunConfigurationWidget::setSerialPort(int index)
{
m_runConfiguration->setSerialPortName(m_serialPorts->itemData(index).toString());
}
void S60DeviceRunConfigurationWidget::selfSignToggled(bool toggle) void S60DeviceRunConfigurationWidget::selfSignToggled(bool toggle)
{ {
if (toggle) if (toggle)
@@ -411,7 +445,7 @@ RunControl* S60DeviceRunConfigurationRunner::run(QSharedPointer<RunConfiguration
// ======== S60DeviceRunControl // ======== S60DeviceRunControl
S60DeviceRunControl::S60DeviceRunControl(QSharedPointer<RunConfiguration> runConfiguration) S60DeviceRunControl::S60DeviceRunControl(QSharedPointer<RunConfiguration> runConfiguration)
: RunControl(runConfiguration) : RunControl(runConfiguration), m_adapter(0)
{ {
m_makesis = new QProcess(this); m_makesis = new QProcess(this);
connect(m_makesis, SIGNAL(readyReadStandardError()), connect(m_makesis, SIGNAL(readyReadStandardError()),
@@ -440,6 +474,7 @@ void S60DeviceRunControl::start()
Qt4Project *project = qobject_cast<Qt4Project *>(rc->project()); Qt4Project *project = qobject_cast<Qt4Project *>(rc->project());
m_serialPortName = rc->serialPortName();
m_targetName = rc->targetName(); m_targetName = rc->targetName();
m_baseFileName = rc->basePackageFilePath(); m_baseFileName = rc->basePackageFilePath();
m_workingDirectory = QFileInfo(m_baseFileName).absolutePath(); m_workingDirectory = QFileInfo(m_baseFileName).absolutePath();
@@ -471,7 +506,8 @@ void S60DeviceRunControl::stop()
{ {
m_makesis->kill(); m_makesis->kill();
m_signsis->kill(); m_signsis->kill();
//m_adapter->terminate(); if (m_adapter)
m_adapter->terminate();
} }
bool S60DeviceRunControl::isRunning() const bool S60DeviceRunControl::isRunning() const
@@ -533,22 +569,54 @@ void S60DeviceRunControl::signsisProcessFinished()
emit finished(); emit finished();
return; return;
} }
//TODO
m_adapter = new trk::Adapter; m_adapter = new trk::Adapter;
connect(m_adapter, SIGNAL(finished()), this, SLOT(runFinished())); connect(m_adapter, SIGNAL(finished()), this, SLOT(runFinished()));
//TODO com selection, sisx destination and file path user definable connect(m_adapter, SIGNAL(copyingStarted()), this, SLOT(printCopyingNotice()));
m_adapter->setTrkServerName("COM5"); connect(m_adapter, SIGNAL(installingStarted()), this, SLOT(printInstallingNotice()));
connect(m_adapter, SIGNAL(startingApplication()), this, SLOT(printStartingNotice()));
connect(m_adapter, SIGNAL(applicationRunning(uint)), this, SLOT(printRunNotice(uint)));
//TODO sisx destination and file path user definable
m_adapter->setTrkServerName(m_serialPortName);
const QString copySrc(m_baseFileName + ".sisx"); const QString copySrc(m_baseFileName + ".sisx");
const QString copyDst = QString("C:\\Data\\%1.sisx").arg(QFileInfo(m_baseFileName).fileName()); const QString copyDst = QString("C:\\Data\\%1.sisx").arg(QFileInfo(m_baseFileName).fileName());
const QString runFileName = QString("C:\\sys\\bin\\%1.exe").arg(m_targetName); const QString runFileName = QString("C:\\sys\\bin\\%1.exe").arg(m_targetName);
m_adapter->setCopyFileName(copySrc, copyDst); m_adapter->setCopyFileName(copySrc, copyDst);
m_adapter->setInstallFileName(copyDst); m_adapter->setInstallFileName(copyDst);
m_adapter->setFileName(runFileName); m_adapter->setFileName(runFileName);
m_adapter->startServer(); if (!m_adapter->startServer()) {
delete m_adapter;
m_adapter = 0;
error(this, tr("Could not connect to phone on port %1. "
"Check if the phone is connected and if it runs the TRK application.").arg(m_serialPortName));
emit finished();
}
}
void S60DeviceRunControl::printCopyingNotice()
{
emit addToOutputWindow(this, tr("Copying install file to device..."));
}
void S60DeviceRunControl::printInstallingNotice()
{
emit addToOutputWindow(this, tr("Installing application..."));
}
void S60DeviceRunControl::printStartingNotice()
{
emit addToOutputWindow(this, tr("Starting..."));
}
void S60DeviceRunControl::printRunNotice(uint pid)
{
emit addToOutputWindow(this, tr("Application started with pid %1.").arg(pid));
} }
void S60DeviceRunControl::runFinished() void S60DeviceRunControl::runFinished()
{ {
m_adapter->deleteLater();
m_adapter = 0;
emit addToOutputWindow(this, tr("Finished.")); emit addToOutputWindow(this, tr("Finished."));
emit finished(); emit finished();
} }
@@ -567,4 +635,5 @@ void S60DeviceRunControl::processFailed(const QString &program, QProcess::Proces
errorString = tr("Some error has occurred while running %1."); errorString = tr("Some error has occurred while running %1.");
} }
error(this, errorString.arg(program)); error(this, errorString.arg(program));
emit finished();
} }

View File

@@ -38,6 +38,7 @@
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QtGui/QLabel> #include <QtGui/QLabel>
#include <QtGui/QLineEdit> #include <QtGui/QLineEdit>
#include <QtGui/QComboBox>
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
namespace Internal { namespace Internal {
@@ -60,6 +61,8 @@ public:
void save(ProjectExplorer::PersistentSettingsWriter &writer) const; void save(ProjectExplorer::PersistentSettingsWriter &writer) const;
void restore(const ProjectExplorer::PersistentSettingsReader &reader); void restore(const ProjectExplorer::PersistentSettingsReader &reader);
QString serialPortName() const;
void setSerialPortName(const QString &name);
QString targetName() const; QString targetName() const;
QString basePackageFilePath() const; QString basePackageFilePath() const;
SigningMode signingMode() const; SigningMode signingMode() const;
@@ -82,6 +85,7 @@ private:
QString m_targetName; QString m_targetName;
QString m_baseFileName; QString m_baseFileName;
bool m_cachedTargetInformationValid; bool m_cachedTargetInformationValid;
QString m_serialPortName;
SigningMode m_signingMode; SigningMode m_signingMode;
QString m_customSignaturePath; QString m_customSignaturePath;
QString m_customKeyPath; QString m_customKeyPath;
@@ -97,6 +101,7 @@ public:
private slots: private slots:
void nameEdited(const QString &text); void nameEdited(const QString &text);
void updateTargetInformation(); void updateTargetInformation();
void setSerialPort(int index);
void selfSignToggled(bool toggle); void selfSignToggled(bool toggle);
void customSignatureToggled(bool toggle); void customSignatureToggled(bool toggle);
void signaturePathChanged(const QString &path); void signaturePathChanged(const QString &path);
@@ -104,6 +109,7 @@ private slots:
private: private:
S60DeviceRunConfiguration *m_runConfiguration; S60DeviceRunConfiguration *m_runConfiguration;
QComboBox *m_serialPorts;
QLineEdit *m_nameLineEdit; QLineEdit *m_nameLineEdit;
QLabel *m_sisxFileLabel; QLabel *m_sisxFileLabel;
}; };
@@ -149,11 +155,16 @@ private slots:
void makesisProcessFinished(); void makesisProcessFinished();
void signsisProcessFailed(); void signsisProcessFailed();
void signsisProcessFinished(); void signsisProcessFinished();
void printCopyingNotice();
void printInstallingNotice();
void printStartingNotice();
void printRunNotice(uint pid);
void runFinished(); void runFinished();
private: private:
void processFailed(const QString &program, QProcess::ProcessError errorCode); void processFailed(const QString &program, QProcess::ProcessError errorCode);
QString m_serialPortName;
QString m_targetName; QString m_targetName;
QString m_baseFileName; QString m_baseFileName;
QString m_workingDirectory; QString m_workingDirectory;

View File

@@ -0,0 +1,63 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#include "serialdevicelister.h"
#include <QtCore/QSettings>
#include <QtCore/QStringList>
#include <QtDebug>
using namespace Qt4ProjectManager::Internal;
namespace {
const char * const REGKEY_CURRENT_CONTROL_SET = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet";
const char * const USBSER = "Services/usbser/Enum";
}
SerialDeviceLister::SerialDeviceLister()
{
}
QList<SerialDeviceLister::SerialDevice> SerialDeviceLister::serialDevices() const
{
QList<SerialDeviceLister::SerialDevice> devices;
QSettings registry(REGKEY_CURRENT_CONTROL_SET, QSettings::NativeFormat);
int count = registry.value(QString::fromLatin1("%1/Count").arg(USBSER)).toInt();
for (int i = 0; i < count; ++i) {
QString driver = registry.value(QString::fromLatin1("%1/%2").arg(USBSER).arg(i)).toString();
if (driver.contains("JAVACOMM")) {
driver.replace('\\', '/');
SerialDeviceLister::SerialDevice device;
device.friendlyName = registry.value(QString::fromLatin1("Enum/%1/FriendlyName").arg(driver)).toString();
device.portName = registry.value(QString::fromLatin1("Enum/%1/Device Parameters/PortName").arg(driver)).toString();
devices.append(device);
}
}
return devices;
}

View File

@@ -0,0 +1,57 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#ifndef SERIALDEVICELISTER_H
#define SERIALDEVICELISTER_H
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QList>
namespace Qt4ProjectManager {
namespace Internal {
class SerialDeviceLister : public QObject
{
Q_OBJECT
public:
struct SerialDevice {
QString portName;
QString friendlyName;
};
SerialDeviceLister();
QList<SerialDevice> serialDevices() const;
};
} // Internal
} // Qt4ProjectManager
#endif // SERIALDEVICELISTER_H

View File

@@ -44,6 +44,10 @@ BOOL WINAPI TryReadFile(HANDLE hFile,
qDebug() << "ClearCommError() failed"; qDebug() << "ClearCommError() failed";
return FALSE; return FALSE;
} }
if (comStat.cbInQue == 0) {
*lpNumberOfBytesRead = 0;
return FALSE;
}
return ReadFile(hFile, return ReadFile(hFile,
lpBuffer, lpBuffer,
qMin(comStat.cbInQue, nNumberOfBytesToRead), qMin(comStat.cbInQue, nNumberOfBytesToRead),
@@ -66,7 +70,6 @@ Adapter::Adapter()
#endif #endif
m_trkWriteToken = 0; m_trkWriteToken = 0;
m_trkWriteBusy = false; m_trkWriteBusy = false;
startTimer(100);
} }
Adapter::~Adapter() Adapter::~Adapter()
@@ -85,10 +88,10 @@ Adapter::~Adapter()
bool Adapter::startServer() bool Adapter::startServer()
{ {
if (!openTrkPort(m_trkServerName)) { if (!openTrkPort(m_trkServerName)) {
qDebug("Unable to connect to TRK server"); logMessage("Unable to connect to TRK server");
return false; return false;
} }
qDebug("Connecting"); m_timerId = startTimer(100);
sendTrkInitialPing(); sendTrkInitialPing();
sendTrkMessage(TrkConnect); // Connect sendTrkMessage(TrkConnect); // Connect
sendTrkMessage(TrkSupported, CB(handleSupportMask)); sendTrkMessage(TrkSupported, CB(handleSupportMask));
@@ -105,7 +108,6 @@ void Adapter::installAndRun()
{ {
if (!m_installFileName.isEmpty()) { if (!m_installFileName.isEmpty()) {
installRemotePackageSilently(m_installFileName); installRemotePackageSilently(m_installFileName);
startInferiorIfNeeded();
} else { } else {
startInferiorIfNeeded(); startInferiorIfNeeded();
} }
@@ -197,6 +199,14 @@ void Adapter::waitForTrkFinished(const TrkResult &result)
sendTrkMessage(TrkPing, CB(handleWaitForFinished)); sendTrkMessage(TrkPing, CB(handleWaitForFinished));
} }
void Adapter::terminate()
{
QByteArray ba;
appendShort(&ba, 0x0000, TargetByteOrder);
appendInt(&ba, m_session.pid, TargetByteOrder);
sendTrkMessage(TrkDeleteItem, CB(waitForTrkFinished), ba);
}
void Adapter::sendTrkAck(byte token) void Adapter::sendTrkAck(byte token)
{ {
logMessage(QString("SENDING ACKNOWLEDGEMENT FOR TOKEN %1").arg(int(token))); logMessage(QString("SENDING ACKNOWLEDGEMENT FOR TOKEN %1").arg(int(token)));
@@ -262,6 +272,9 @@ void Adapter::tryTrkRead()
if (isValidTrkResult(m_trkReadQueue)) if (isValidTrkResult(m_trkReadQueue))
break; break;
} }
if (charsRead == 0 && m_trkReadQueue.isEmpty()) {
return;
}
#else // USE_NATIVE #else // USE_NATIVE
if (m_trkDevice->bytesAvailable() == 0 && m_trkReadQueue.isEmpty()) { if (m_trkDevice->bytesAvailable() == 0 && m_trkReadQueue.isEmpty()) {
return; return;
@@ -462,10 +475,11 @@ void Adapter::handleCreateProcess(const TrkResult &result)
m_session.tid = extractInt(data + 5); m_session.tid = extractInt(data + 5);
m_session.codeseg = extractInt(data + 9); m_session.codeseg = extractInt(data + 9);
m_session.dataseg = extractInt(data + 13); m_session.dataseg = extractInt(data + 13);
qDebug() << " READ PID: " << m_session.pid; logMessage(QString(" READ PID: %1").arg(m_session.pid));
qDebug() << " READ TID: " << m_session.tid; logMessage(QString(" READ TID: %1").arg(m_session.tid));
qDebug() << " READ CODE: " << m_session.codeseg; logMessage(QString(" READ CODE: %1").arg(m_session.codeseg));
qDebug() << " READ DATA: " << m_session.dataseg; logMessage(QString(" READ DATA: %1").arg(m_session.dataseg));
emit applicationRunning(m_session.pid);
QByteArray ba; QByteArray ba;
appendInt(&ba, m_session.pid); appendInt(&ba, m_session.pid);
appendInt(&ba, m_session.tid); appendInt(&ba, m_session.tid);
@@ -475,6 +489,7 @@ void Adapter::handleCreateProcess(const TrkResult &result)
void Adapter::handleWaitForFinished(const TrkResult &result) void Adapter::handleWaitForFinished(const TrkResult &result)
{ {
logMessage(" FINISHED: " + stringFromArray(result.data)); logMessage(" FINISHED: " + stringFromArray(result.data));
killTimer(m_timerId);
emit finished(); emit finished();
} }
@@ -548,7 +563,7 @@ void Adapter::cleanUp()
void Adapter::copyFileToRemote() void Adapter::copyFileToRemote()
{ {
qDebug("Copying file"); emit copyingStarted();
QByteArray ba; QByteArray ba;
appendByte(&ba, 0x10); appendByte(&ba, 0x10);
appendString(&ba, m_copyDstFileName.toLocal8Bit(), TargetByteOrder, false); appendString(&ba, m_copyDstFileName.toLocal8Bit(), TargetByteOrder, false);
@@ -557,18 +572,23 @@ void Adapter::copyFileToRemote()
void Adapter::installRemotePackageSilently(const QString &fileName) void Adapter::installRemotePackageSilently(const QString &fileName)
{ {
qDebug("Installing file"); emit installingStarted();
QByteArray ba; QByteArray ba;
appendByte(&ba, 'C'); appendByte(&ba, 'C');
appendString(&ba, fileName.toLocal8Bit(), TargetByteOrder, false); appendString(&ba, fileName.toLocal8Bit(), TargetByteOrder, false);
sendTrkMessage(TrkInstallFile, 0, ba); sendTrkMessage(TrkInstallFile, CB(handleInstallPackageFinished), ba);
}
void Adapter::handleInstallPackageFinished(const TrkResult &)
{
startInferiorIfNeeded();
} }
void Adapter::startInferiorIfNeeded() void Adapter::startInferiorIfNeeded()
{ {
qDebug("Starting"); emit startingApplication();
if (m_session.pid != 0) { if (m_session.pid != 0) {
qDebug() << "Process already 'started'"; logMessage("Process already 'started'");
return; return;
} }
// It's not started yet // It's not started yet

View File

@@ -62,8 +62,15 @@ public:
bool startServer(); bool startServer();
signals: signals:
void copyingStarted();
void installingStarted();
void startingApplication();
void applicationRunning(uint pid);
void finished(); void finished();
public slots:
void terminate();
private: private:
// //
// TRK // TRK
@@ -103,6 +110,7 @@ private:
void handleFileCreation(const TrkResult &result); void handleFileCreation(const TrkResult &result);
void handleFileCreated(const TrkResult &result); void handleFileCreated(const TrkResult &result);
void handleInstallPackageFinished(const TrkResult &result);
void handleCpuType(const TrkResult &result); void handleCpuType(const TrkResult &result);
void handleCreateProcess(const TrkResult &result); void handleCreateProcess(const TrkResult &result);
void handleWaitForFinished(const TrkResult &result); void handleWaitForFinished(const TrkResult &result);
@@ -137,6 +145,7 @@ private:
// Debuggee state // Debuggee state
Session m_session; // global-ish data (process id, target information) Session m_session; // global-ish data (process id, target information)
int m_timerId;
QString m_fileName; QString m_fileName;
QString m_copySrcFileName; QString m_copySrcFileName;
QString m_copyDstFileName; QString m_copyDstFileName;