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

This commit is contained in:
Erik Verbruggen
2009-09-11 14:43:39 +02:00
96 changed files with 3160 additions and 2606 deletions

View File

@@ -5,7 +5,7 @@
\title Qt Creator Manual \title Qt Creator Manual
\section1 Version 1.2.80 \section1 Version 1.2.91
The goal of Qt Creator is to provide a cross-platform, complete Integrated The goal of Qt Creator is to provide a cross-platform, complete Integrated
Development Environment (IDE) to develop Qt projects. It is available for Development Environment (IDE) to develop Qt projects. It is available for
@@ -1786,7 +1786,7 @@
There are some known issues with Qt Creator. There are some known issues with Qt Creator.
The development team is aware of those, there is no need to report them as bug. The development team is aware of those, there is no need to report them as bug.
\section1 Known Issues of Version 1.2.80 \section1 Known Issues of Version 1.2.91
\list \list
\o Gdb on Windows may not work if the 'Embassy \reg Security Center' software \o Gdb on Windows may not work if the 'Embassy \reg Security Center' software

View File

@@ -19,16 +19,16 @@ sources.fileextensions = "qtcreator.qdoc addressbook-sdk.qdoc"
qhp.projects = QtCreator qhp.projects = QtCreator
qhp.QtCreator.file = qtcreator.qhp qhp.QtCreator.file = qtcreator.qhp
qhp.QtCreator.namespace = com.nokia.qtcreator.1280 qhp.QtCreator.namespace = com.nokia.qtcreator.1291
qhp.QtCreator.virtualFolder = doc qhp.QtCreator.virtualFolder = doc
qhp.QtCreator.indexTitle = Qt Creator qhp.QtCreator.indexTitle = Qt Creator
qhp.QtCreator.indexRoot = qhp.QtCreator.indexRoot =
qhp.QtCreator.extraFiles = classic.css \ qhp.QtCreator.extraFiles = classic.css \
images/qt-logo.png \ images/qt-logo.png \
images/qtcreator-screenshots.png images/qtcreator-screenshots.png
qhp.QtCreator.filterAttributes = qtcreator 1.2.80 qhp.QtCreator.filterAttributes = qtcreator 1.2.91
qhp.QtCreator.customFilters.QtCreator.name = Qt Creator 1.2.80 qhp.QtCreator.customFilters.QtCreator.name = Qt Creator 1.2.91
qhp.QtCreator.customFilters.QtCreator.filterAttributes = qtcreator 1.2.80 qhp.QtCreator.customFilters.QtCreator.filterAttributes = qtcreator 1.2.91
# macros.qdocconf # macros.qdocconf
@@ -211,5 +211,5 @@ HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \ "<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
"<td width=\"40%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \ "<td width=\"40%\" align=\"left\">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
"<td width=\"20%\" align=\"center\"><a href=\"trademarks.html\">Trademarks</a></td>\n" \ "<td width=\"20%\" align=\"center\"><a href=\"trademarks.html\">Trademarks</a></td>\n" \
"<td width=\"40%\" align=\"right\"><div align=\"right\">Qt Creator 1.2.80</div></td>\n" \ "<td width=\"40%\" align=\"right\"><div align=\"right\">Qt Creator 1.2.91</div></td>\n" \
"</tr></table></div></address>" "</tr></table></div></address>"

File diff suppressed because it is too large Load Diff

View File

@@ -184,8 +184,8 @@
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>com.nokia.qtcreator</string> <string>com.nokia.qtcreator</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.2.80</string> <string>1.2.91</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.2.80</string> <string>1.2.91</string>
</dict> </dict>
</plist> </plist>

View File

@@ -17,7 +17,7 @@ win32 {
} else:macx { } else:macx {
CONFIG(debug, debug|release):LIBS *= -lExtensionSystem_debug -lAggregation_debug CONFIG(debug, debug|release):LIBS *= -lExtensionSystem_debug -lAggregation_debug
else:LIBS *= -lExtensionSystem -lAggregation else:LIBS *= -lExtensionSystem -lAggregation
LIBS += -framework CoreFoundation
ICON = qtcreator.icns ICON = qtcreator.icns
QMAKE_INFO_PLIST = Info.plist QMAKE_INFO_PLIST = Info.plist
FILETYPES.files = profile.icns prifile.icns FILETYPES.files = profile.icns prifile.icns

View File

@@ -48,6 +48,20 @@
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
# include <sys/resource.h> # include <sys/resource.h>
# include <CoreFoundation/CoreFoundation.h>
// Helper function CoreFoundation -> Qt
static QString stringFromCFString(CFStringRef value) {
QString retVal;
CFIndex maxLength = 2 * CFStringGetLength(value) + 1/*zero term*/; // max UTF8
char *cstring = new char[maxLength];
if (CFStringGetCString(CFStringRef(value), cstring, maxLength, kCFStringEncodingUTF8)) {
retVal = QString::fromUtf8(cstring);
}
delete cstring;
return retVal;
}
#endif #endif
enum { OptionIndent = 4, DescriptionIndent = 24 }; enum { OptionIndent = 4, DescriptionIndent = 24 };
@@ -216,7 +230,29 @@ int main(int argc, char **argv)
QTranslator translator; QTranslator translator;
QTranslator qtTranslator; QTranslator qtTranslator;
const QString &locale = QLocale::system().name(); QString locale = QLocale::system().name();
#ifdef Q_OS_MAC
// because QLocale's system locale is basically useless on the Mac.
// Try to get the real system setting via core foundation
CFLocaleRef maclocale = CFLocaleCopyCurrent();
CFTypeRef value = CFLocaleGetValue(maclocale, kCFLocaleLanguageCode);
QString preferredLanguage = stringFromCFString(CFStringRef(value));
if (!preferredLanguage.isEmpty())
locale = preferredLanguage;
CFRelease(maclocale);
CFArrayRef languages = (CFArrayRef)CFPreferencesCopyValue(
CFSTR("AppleLanguages"),
kCFPreferencesAnyApplication,
kCFPreferencesCurrentUser,
kCFPreferencesAnyHost);
// CFShow(languages);
if (CFArrayGetCount(languages) > 0) {
QString preferredLanguage = stringFromCFString(CFStringRef(CFArrayGetValueAtIndex(languages, 0)));
if (!preferredLanguage.isEmpty())
locale = preferredLanguage;
}
CFRelease(languages);
#endif
const QString &creatorTrPath = QCoreApplication::applicationDirPath() const QString &creatorTrPath = QCoreApplication::applicationDirPath()
+ QLatin1String(SHARE_PATH "/translations"); + QLatin1String(SHARE_PATH "/translations");
if (translator.load(QLatin1String("qtcreator_") + locale, creatorTrPath)) { if (translator.load(QLatin1String("qtcreator_") + locale, creatorTrPath)) {

View File

@@ -1,4 +1,4 @@
<plugin name="BinEditor" version="1.2.80" compatVersion="1.2.80"> <plugin name="BinEditor" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,7 +19,7 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Binary editor component.</description> <description>Binary editor component.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -33,6 +33,9 @@
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <QtCore/QByteArrayMatcher> #include <QtCore/QByteArrayMatcher>
#include <QtCore/QFile>
#include <QtCore/QTemporaryFile>
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtGui/QClipboard> #include <QtGui/QClipboard>
#include <QtGui/QFontMetrics> #include <QtGui/QFontMetrics>
@@ -77,6 +80,7 @@ BinEditor::BinEditor(QWidget *parent)
{ {
m_ieditor = 0; m_ieditor = 0;
m_inLazyMode = false; m_inLazyMode = false;
m_baseAddr = 0;
m_blockSize = 4096; m_blockSize = 4096;
init(); init();
m_unmodifiedState = 0; m_unmodifiedState = 0;
@@ -88,7 +92,7 @@ BinEditor::BinEditor(QWidget *parent)
m_cursorVisible = false; m_cursorVisible = false;
m_caseSensitiveSearch = false; m_caseSensitiveSearch = false;
setFocusPolicy(Qt::WheelFocus); setFocusPolicy(Qt::WheelFocus);
m_addressString = QString(9, QLatin1Char(':')); m_addressString = QString(16 + 3, QLatin1Char(':'));
} }
BinEditor::~BinEditor() BinEditor::~BinEditor()
@@ -108,7 +112,7 @@ void BinEditor::init()
m_numVisibleLines = viewport()->height() / m_lineHeight; m_numVisibleLines = viewport()->height() / m_lineHeight;
m_textWidth = 16 * m_charWidth + m_charWidth; m_textWidth = 16 * m_charWidth + m_charWidth;
int m_numberWidth = fm.width(QChar(QLatin1Char('9'))); int m_numberWidth = fm.width(QChar(QLatin1Char('9')));
m_labelWidth = 8 * m_numberWidth + 2 * m_charWidth; m_labelWidth = 16 * m_numberWidth + 4 * m_charWidth;
int expectedCharWidth = m_columnWidth / 3; int expectedCharWidth = m_columnWidth / 3;
const char *hex = "0123456789abcdef"; const char *hex = "0123456789abcdef";
@@ -129,14 +133,20 @@ void BinEditor::init()
} }
void BinEditor::addLazyData(int block, const QByteArray &data) void BinEditor::addLazyData(quint64 block, const QByteArray &data)
{ {
Q_ASSERT(m_inLazyMode); Q_ASSERT(m_inLazyMode);
Q_ASSERT(data.size() == m_blockSize); Q_ASSERT(data.size() == m_blockSize);
m_lazyData.insert(block, data); const quint64 addr = block * m_blockSize;
m_lazyRequests.remove(block); if (addr >= m_baseAddr && addr <= m_baseAddr + m_size - 1) {
if (m_lazyData.size() * m_blockSize >= 64 * 1024 * 1024)
m_lazyData.clear();
const int translatedBlock = (addr - m_baseAddr) / m_blockSize;
m_lazyData.insert(translatedBlock, data);
m_lazyRequests.remove(translatedBlock);
viewport()->update(); viewport()->update();
} }
}
bool BinEditor::requestDataAt(int pos, bool synchronous) const bool BinEditor::requestDataAt(int pos, bool synchronous) const
{ {
@@ -144,11 +154,15 @@ bool BinEditor::requestDataAt(int pos, bool synchronous) const
return true; return true;
int block = pos / m_blockSize; int block = pos / m_blockSize;
QMap<int, QByteArray>::const_iterator it = m_lazyData.find(block); QMap<int, QByteArray>::const_iterator it = m_modifiedData.find(block);
if (it != m_modifiedData.constEnd())
return true;
it = m_lazyData.find(block);
if (it == m_lazyData.end()) { if (it == m_lazyData.end()) {
if (!m_lazyRequests.contains(block)) { if (!m_lazyRequests.contains(block)) {
m_lazyRequests.insert(block); m_lazyRequests.insert(block);
emit const_cast<BinEditor*>(this)->lazyDataRequested(block, synchronous); emit const_cast<BinEditor*>(this)->
lazyDataRequested(m_baseAddr / m_blockSize + block, synchronous);
if (!m_lazyRequests.contains(block)) if (!m_lazyRequests.contains(block))
return true; // synchronous data source return true; // synchronous data source
} }
@@ -162,10 +176,8 @@ char BinEditor::dataAt(int pos) const
{ {
if (!m_inLazyMode) if (!m_inLazyMode)
return m_data.at(pos); return m_data.at(pos);
int block = pos / m_blockSize; int block = pos / m_blockSize;
return m_lazyData.value(block, m_emptyBlock).at(pos - (block*m_blockSize)); return blockData(block).at(pos - (block*m_blockSize));
} }
void BinEditor::changeDataAt(int pos, char c) void BinEditor::changeDataAt(int pos, char c)
@@ -175,8 +187,17 @@ void BinEditor::changeDataAt(int pos, char c)
return; return;
} }
int block = pos / m_blockSize; int block = pos / m_blockSize;
if (m_lazyData.contains(block)) QMap<int, QByteArray>::iterator it = m_modifiedData.find(block);
m_lazyData[block][pos - (block*m_blockSize)] = c; if (it != m_modifiedData.end()) {
it.value()[pos - (block*m_blockSize)] = c;
} else {
it = m_lazyData.find(block);
if (it != m_lazyData.end()) {
QByteArray data = it.value();
data[pos - (block*m_blockSize)] = c;
m_modifiedData.insert(block, data);
}
}
} }
QByteArray BinEditor::dataMid(int from, int length) const QByteArray BinEditor::dataMid(int from, int length) const
@@ -189,7 +210,7 @@ QByteArray BinEditor::dataMid(int from, int length) const
QByteArray data; QByteArray data;
do { do {
data += m_lazyData.value(block++, m_emptyBlock); data += blockData(block++);
} while (block * m_blockSize < end); } while (block * m_blockSize < end);
return data.mid(from - ((from / m_blockSize) * m_blockSize), length); return data.mid(from - ((from / m_blockSize) * m_blockSize), length);
@@ -203,7 +224,9 @@ QByteArray BinEditor::blockData(int block) const
data.resize(m_blockSize); data.resize(m_blockSize);
return data; return data;
} }
return m_lazyData.value(block, m_emptyBlock); QMap<int, QByteArray>::const_iterator it = m_modifiedData.find(block);
return it != m_modifiedData.constEnd()
? it.value() : m_lazyData.value(block, m_emptyBlock);
} }
@@ -294,7 +317,9 @@ bool BinEditor::isReadOnly() const
void BinEditor::setData(const QByteArray &data) void BinEditor::setData(const QByteArray &data)
{ {
m_inLazyMode = false; m_inLazyMode = false;
m_baseAddr = 0;
m_lazyData.clear(); m_lazyData.clear();
m_modifiedData.clear();
m_lazyRequests.clear(); m_lazyRequests.clear();
m_data = data; m_data = data;
m_size = data.size(); m_size = data.size();
@@ -316,21 +341,49 @@ QByteArray BinEditor::data() const
return m_data; return m_data;
} }
bool BinEditor::applyModifications(QByteArray &data) const bool BinEditor::save(const QString &oldFileName, const QString &newFileName)
{ {
if (!m_inLazyMode) { if (m_inLazyMode) {
data = m_data; if (oldFileName != newFileName) {
return true; QString tmpName;
} {
if (data.size() != m_size) QTemporaryFile tmp;
if (!tmp.open())
return false; return false;
for (QMap<int,QByteArray>::const_iterator it = m_lazyData.begin(); it != m_lazyData.end(); ++it) { tmpName = tmp.fileName();
::memcpy(data.data() + it.key() * m_blockSize, it->constData(), m_blockSize);
} }
if (!QFile::copy(oldFileName, tmpName))
return false;
if (QFile::exists(newFileName) && !QFile::remove(newFileName))
return false;
if (!QFile::rename(tmpName, newFileName))
return false;
}
QFile output(newFileName);
if (!output.open(QIODevice::ReadWrite)) // QtBug: WriteOnly truncates.
return false;
const qint64 size = output.size();
for (QMap<int, QByteArray>::const_iterator it = m_modifiedData.constBegin();
it != m_modifiedData.constEnd(); ++it) {
if (!output.seek(it.key() * m_blockSize))
return false;
if (output.write(it.value()) < m_blockSize)
return false;
}
if (size % m_blockSize != 0 && !output.resize(size))
return false;
} else {
QFile output(newFileName);
if (!output.open(QIODevice::WriteOnly | QIODevice::Truncate))
return false;
if (output.write(m_data) < m_size)
return false;
}
setModified(false);
return true; return true;
} }
void BinEditor::setLazyData(int cursorPosition, int size, int blockSize) void BinEditor::setLazyData(quint64 startAddr, int range, int blockSize)
{ {
m_inLazyMode = true; m_inLazyMode = true;
m_blockSize = blockSize; m_blockSize = blockSize;
@@ -338,8 +391,16 @@ void BinEditor::setLazyData(int cursorPosition, int size, int blockSize)
m_emptyBlock = QByteArray(blockSize, '\0'); m_emptyBlock = QByteArray(blockSize, '\0');
m_data.clear(); m_data.clear();
m_lazyData.clear(); m_lazyData.clear();
m_modifiedData.clear();
m_lazyRequests.clear(); m_lazyRequests.clear();
m_size = size;
// In lazy mode, users can edit data in the range
// [startAddr - range/2, startAddr + range/2].
m_baseAddr = static_cast<quint64>(range/2) > startAddr
? 0 : startAddr - range/2;
m_baseAddr = (m_baseAddr / blockSize) * blockSize;
m_size = m_baseAddr != 0 && static_cast<quint64>(range) >= -m_baseAddr
? -m_baseAddr : range;
m_unmodifiedState = 0; m_unmodifiedState = 0;
m_undoStack.clear(); m_undoStack.clear();
@@ -347,7 +408,7 @@ void BinEditor::setLazyData(int cursorPosition, int size, int blockSize)
init(); init();
m_cursorPosition = cursorPosition; m_cursorPosition = startAddr - m_baseAddr;
verticalScrollBar()->setValue(m_cursorPosition / 16); verticalScrollBar()->setValue(m_cursorPosition / 16);
emit cursorPositionChanged(m_cursorPosition); emit cursorPositionChanged(m_cursorPosition);
@@ -471,8 +532,9 @@ int BinEditor::dataIndexOf(const QByteArray &pattern, int from, bool caseSensiti
QByteArrayMatcher matcher(pattern); QByteArrayMatcher matcher(pattern);
int block = from / m_blockSize; int block = from / m_blockSize;
const int end =
while (from < m_size) { qMin<qint64>(static_cast<qint64>(from) + SearchStride, m_size);
while (from < end) {
if (!requestDataAt(block * m_blockSize, true)) if (!requestDataAt(block * m_blockSize, true))
return -1; return -1;
QByteArray data = blockData(block); QByteArray data = blockData(block);
@@ -488,7 +550,7 @@ int BinEditor::dataIndexOf(const QByteArray &pattern, int from, bool caseSensiti
++block; ++block;
from = block * m_blockSize - trailing; from = block * m_blockSize - trailing;
} }
return -1; return end == m_size ? -1 : -2;
} }
int BinEditor::dataLastIndexOf(const QByteArray &pattern, int from, bool caseSensitive) const int BinEditor::dataLastIndexOf(const QByteArray &pattern, int from, bool caseSensitive) const
@@ -505,8 +567,8 @@ int BinEditor::dataLastIndexOf(const QByteArray &pattern, int from, bool caseSen
char *b = buffer.data(); char *b = buffer.data();
int block = from / m_blockSize; int block = from / m_blockSize;
const int lowerBound = qMax(0, from - SearchStride);
while (from > 0) { while (from > lowerBound) {
if (!requestDataAt(block * m_blockSize, true)) if (!requestDataAt(block * m_blockSize, true))
return -1; return -1;
QByteArray data = blockData(block); QByteArray data = blockData(block);
@@ -522,11 +584,12 @@ int BinEditor::dataLastIndexOf(const QByteArray &pattern, int from, bool caseSen
--block; --block;
from = block * m_blockSize + (m_blockSize-1) + trailing; from = block * m_blockSize + (m_blockSize-1) + trailing;
} }
return -1; return lowerBound == 0 ? -1 : -2;
} }
int BinEditor::find(const QByteArray &pattern_arg, int from, QTextDocument::FindFlags findFlags) int BinEditor::find(const QByteArray &pattern_arg, int from,
QTextDocument::FindFlags findFlags)
{ {
if (pattern_arg.isEmpty()) if (pattern_arg.isEmpty())
return 0; return 0;
@@ -549,7 +612,8 @@ int BinEditor::find(const QByteArray &pattern_arg, int from, QTextDocument::Find
: dataIndexOf(hexPattern, from); : dataIndexOf(hexPattern, from);
} }
int pos = (found >= 0 && (foundHex < 0 || found < foundHex)) ? found : foundHex; int pos = foundHex == -1 || (found >= 0 && (foundHex == -2 || found < foundHex))
? found : foundHex;
if (pos >= m_size) if (pos >= m_size)
pos = -1; pos = -1;
@@ -593,20 +657,21 @@ void BinEditor::drawItems(QPainter *painter, int x, int y, const QString &itemSt
} }
} }
QString BinEditor::addressString(uint address) QString BinEditor::addressString(quint64 address)
{ {
QChar *addressStringData = m_addressString.data(); QChar *addressStringData = m_addressString.data();
const char *hex = "0123456789abcdef"; const char *hex = "0123456789abcdef";
for (int h = 0; h < 4; ++h) {
int shift = 4*(7-h); // Take colons into account.
addressStringData[h] = hex[(address & (0xf<<shift))>>shift]; const int indices[16] = {
} 0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18
for (int h = 4; h < 8; ++h) { };
int shift = 4*(7-h);
addressStringData[h+1] = hex[(address & (0xf<<shift))>>shift]; for (int b = 0; b < 8; ++b) {
addressStringData[indices[15 - b*2]] = hex[(address >> (8*b)) & 0xf];
addressStringData[indices[14 - b*2]] = hex[(address >> (8*b + 4)) & 0xf];
} }
return m_addressString; return m_addressString;
} }
void BinEditor::paintEvent(QPaintEvent *e) void BinEditor::paintEvent(QPaintEvent *e)
@@ -663,7 +728,8 @@ void BinEditor::paintEvent(QPaintEvent *e)
continue; continue;
painter.drawText(-xoffset, i * m_lineHeight + m_ascent, addressString(((uint) line) * 16)); painter.drawText(-xoffset, i * m_lineHeight + m_ascent,
addressString(m_baseAddr + ((uint) line) * 16));
int cursor = -1; int cursor = -1;
if (line * 16 <= m_cursorPosition && m_cursorPosition < line * 16 + 16) if (line * 16 <= m_cursorPosition && m_cursorPosition < line * 16 + 16)

View File

@@ -31,8 +31,10 @@
#define BINEDITOR_H #define BINEDITOR_H
#include <QtCore/QBasicTimer> #include <QtCore/QBasicTimer>
#include <QtCore/QMap>
#include <QtCore/QSet> #include <QtCore/QSet>
#include <QtCore/QStack> #include <QtCore/QStack>
#include <QtCore/QString>
#include <QtGui/QAbstractScrollArea> #include <QtGui/QAbstractScrollArea>
#include <QtGui/QTextDocument> #include <QtGui/QTextDocument>
@@ -64,10 +66,10 @@ public:
inline int dataSize() const { return m_size; } inline int dataSize() const { return m_size; }
inline bool inLazyMode() const { return m_inLazyMode; } inline bool inLazyMode() const { return m_inLazyMode; }
Q_INVOKABLE void setLazyData(int cursorPosition, int size, int blockSize = 4096); Q_INVOKABLE void setLazyData(quint64 startAddr, int range, int blockSize = 4096);
inline int lazyDataBlockSize() const { return m_blockSize; } inline int lazyDataBlockSize() const { return m_blockSize; }
Q_INVOKABLE void addLazyData(int block, const QByteArray &data); Q_INVOKABLE void addLazyData(quint64 block, const QByteArray &data);
bool applyModifications(QByteArray &data) const; bool save(const QString &oldFileName, const QString &newFileName);
void zoomIn(int range = 1); void zoomIn(int range = 1);
void zoomOut(int range = 1); void zoomOut(int range = 1);
@@ -86,7 +88,8 @@ public:
void setReadOnly(bool); void setReadOnly(bool);
bool isReadOnly() const; bool isReadOnly() const;
int find(const QByteArray &pattern, int from = 0, QTextDocument::FindFlags findFlags = 0); int find(const QByteArray &pattern, int from = 0,
QTextDocument::FindFlags findFlags = 0);
void selectAll(); void selectAll();
void clear(); void clear();
@@ -106,8 +109,9 @@ public:
bool isUndoAvailable() const { return m_undoStack.size(); } bool isUndoAvailable() const { return m_undoStack.size(); }
bool isRedoAvailable() const { return m_redoStack.size(); } bool isRedoAvailable() const { return m_redoStack.size(); }
QString addressString(uint address); QString addressString(quint64 address);
static const int SearchStride = 1024 * 1024;
public Q_SLOTS: public Q_SLOTS:
void setFontSettings(const TextEditor::FontSettings &fs); void setFontSettings(const TextEditor::FontSettings &fs);
@@ -121,7 +125,7 @@ Q_SIGNALS:
void copyAvailable(bool); void copyAvailable(bool);
void cursorPositionChanged(int position); void cursorPositionChanged(int position);
void lazyDataRequested(int block, bool syncronous); void lazyDataRequested(quint64 block, bool synchronous);
protected: protected:
void scrollContentsBy(int dx, int dy); void scrollContentsBy(int dx, int dy);
@@ -142,6 +146,7 @@ private:
QByteArray m_data; QByteArray m_data;
QMap <int, QByteArray> m_lazyData; QMap <int, QByteArray> m_lazyData;
int m_blockSize; int m_blockSize;
QMap <int, QByteArray> m_modifiedData;
mutable QSet<int> m_lazyRequests; mutable QSet<int> m_lazyRequests;
QByteArray m_emptyBlock; QByteArray m_emptyBlock;
QByteArray m_lowerBlock; QByteArray m_lowerBlock;
@@ -169,6 +174,7 @@ private:
int m_numLines; int m_numLines;
int m_numVisibleLines; int m_numVisibleLines;
quint64 m_baseAddr;
bool m_cursorVisible; bool m_cursorVisible;
int m_cursorPosition; int m_cursorPosition;

View File

@@ -61,7 +61,11 @@ class BinEditorFind : public Find::IFindSupport
{ {
Q_OBJECT Q_OBJECT
public: public:
BinEditorFind(BinEditor *editor) { m_editor = editor; m_incrementalStartPos = -1; } BinEditorFind(BinEditor *editor)
{
m_editor = editor;
m_incrementalStartPos = m_contPos = -1;
}
~BinEditorFind() {} ~BinEditorFind() {}
bool supportsReplace() const { return false; } bool supportsReplace() const { return false; }
@@ -70,7 +74,11 @@ public:
return IFindSupport::FindBackward | IFindSupport::FindCaseSensitively; return IFindSupport::FindBackward | IFindSupport::FindCaseSensitively;
} }
void resetIncrementalSearch() { m_incrementalStartPos = -1; } void resetIncrementalSearch()
{
m_incrementalStartPos = m_contPos = -1;
}
void clearResults() { m_editor->highlightSearchResults(QByteArray()); } void clearResults() { m_editor->highlightSearchResults(QByteArray()); }
QString currentFindString() const { return QString(); } QString currentFindString() const { return QString(); }
QString completedFindString() const { return QString(); } QString completedFindString() const { return QString(); }
@@ -82,41 +90,68 @@ public:
return pos; return pos;
} }
int found = m_editor->find(pattern, pos, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags)); return m_editor->find(pattern, pos, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags));
if (found < 0)
found = m_editor->find(pattern,
(findFlags & Find::IFindSupport::FindBackward)?m_editor->dataSize()-1:0,
Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags));
return found;
} }
bool findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags) { Result findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags) {
QByteArray pattern = txt.toLatin1(); QByteArray pattern = txt.toLatin1();
if (pattern != m_lastPattern)
resetIncrementalSearch(); // Because we don't search for nibbles.
m_lastPattern = pattern;
if (m_incrementalStartPos < 0) if (m_incrementalStartPos < 0)
m_incrementalStartPos = m_editor->selectionStart(); m_incrementalStartPos = m_editor->selectionStart();
int pos = m_incrementalStartPos; if (m_contPos == -1)
m_contPos = m_incrementalStartPos;
findFlags &= ~Find::IFindSupport::FindBackward; findFlags &= ~Find::IFindSupport::FindBackward;
int found = find(pattern, pos, findFlags); int found = find(pattern, m_contPos, findFlags);
if (found >= 0) Result result;
if (found >= 0) {
result = Found;
m_editor->highlightSearchResults(pattern, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags)); m_editor->highlightSearchResults(pattern, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags));
else m_contPos = -1;
} else {
if (found == -2) {
result = NotYetFound;
m_contPos +=
findFlags & Find::IFindSupport::FindBackward
? -BinEditor::SearchStride : BinEditor::SearchStride;
} else {
result = NotFound;
m_contPos = -1;
m_editor->highlightSearchResults(QByteArray(), 0); m_editor->highlightSearchResults(QByteArray(), 0);
return found >= 0; }
}
return result;
} }
bool findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags) { Result findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags) {
QByteArray pattern = txt.toLatin1(); QByteArray pattern = txt.toLatin1();
bool wasReset = (m_incrementalStartPos < 0); bool wasReset = (m_incrementalStartPos < 0);
int pos = m_editor->cursorPosition(); if (m_contPos == -1) {
m_contPos = m_editor->cursorPosition();
if (findFlags & Find::IFindSupport::FindBackward) if (findFlags & Find::IFindSupport::FindBackward)
pos = m_editor->selectionStart()-1; m_contPos = m_editor->selectionStart()-1;
int found = find(pattern, pos, findFlags);
if (found)
m_incrementalStartPos = found;
if (wasReset && found >= 0)
m_editor->highlightSearchResults(pattern, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags));
return found >= 0;
} }
int found = find(pattern, m_contPos, findFlags);
Result result;
if (found >= 0) {
result = Found;
m_incrementalStartPos = found;
m_contPos = -1;
if (wasReset)
m_editor->highlightSearchResults(pattern, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags));
} else if (found == -2) {
result = NotYetFound;
m_contPos += findFlags & Find::IFindSupport::FindBackward
? -BinEditor::SearchStride : BinEditor::SearchStride;
} else {
result = NotFound;
m_contPos = -1;
}
return result;
}
bool replaceStep(const QString &, const QString &, bool replaceStep(const QString &, const QString &,
Find::IFindSupport::FindFlags) { return false;} Find::IFindSupport::FindFlags) { return false;}
int replaceAll(const QString &, const QString &, int replaceAll(const QString &, const QString &,
@@ -125,6 +160,8 @@ public:
private: private:
BinEditor *m_editor; BinEditor *m_editor;
int m_incrementalStartPos; int m_incrementalStartPos;
int m_contPos; // Only valid if last result was NotYetFound.
QByteArray m_lastPattern;
}; };
@@ -137,48 +174,35 @@ public:
m_mimeType(QLatin1String(BINEditor::Constants::C_BINEDITOR_MIMETYPE)) m_mimeType(QLatin1String(BINEditor::Constants::C_BINEDITOR_MIMETYPE))
{ {
m_editor = parent; m_editor = parent;
connect(m_editor, SIGNAL(lazyDataRequested(int, bool)), this, SLOT(provideData(int))); connect(m_editor, SIGNAL(lazyDataRequested(quint64, bool)), this, SLOT(provideData(quint64)));
} }
~BinEditorFile() {} ~BinEditorFile() {}
virtual QString mimeType() const { return m_mimeType; } virtual QString mimeType() const { return m_mimeType; }
bool save(const QString &fileName = QString()) { bool save(const QString &fileName = QString()) {
QFile file(fileName); if (m_editor->save(m_fileName, fileName)) {
QByteArray data;
if (m_editor->inLazyMode()) {
QFile read(m_fileName);
if (!read.open(QIODevice::ReadOnly))
return false;
data = read.readAll();
read.close();
if (!m_editor->applyModifications(data))
return false;
} else {
data = m_editor->data();
}
if (file.open(QIODevice::WriteOnly)) {
file.write(data);
file.close();
m_editor->setModified(false);
m_editor->editorInterface()->setDisplayName(QFileInfo(fileName).fileName());
m_fileName = fileName; m_fileName = fileName;
m_editor->editorInterface()->
setDisplayName(QFileInfo(fileName).fileName());
emit changed(); emit changed();
return true; return true;
} } else {
return false; return false;
} }
}
bool open(const QString &fileName) { bool open(const QString &fileName) {
QFile file(fileName); QFile file(fileName);
if (file.open(QIODevice::ReadOnly)) { if (file.open(QIODevice::ReadOnly)) {
m_fileName = fileName; m_fileName = fileName;
if (file.isSequential()) { if (file.isSequential() && file.size() <= 64 * 1024 * 1024) {
m_editor->setData(file.readAll()); m_editor->setData(file.readAll());
} else { } else {
m_editor->setLazyData(0, file.size()); m_editor->setLazyData(0, qMin(file.size(),
m_editor->editorInterface()->setDisplayName(QFileInfo(fileName).fileName()); static_cast<qint64>(INT_MAX-16)));
m_editor->editorInterface()->
setDisplayName(QFileInfo(fileName).fileName());
} }
file.close(); file.close();
return true; return true;
@@ -187,7 +211,7 @@ public:
} }
private slots: private slots:
void provideData(int block) { void provideData(quint64 block) {
QFile file(m_fileName); QFile file(m_fileName);
if (file.open(QIODevice::ReadOnly)) { if (file.open(QIODevice::ReadOnly)) {
int blockSize = m_editor->lazyDataBlockSize(); int blockSize = m_editor->lazyDataBlockSize();

View File

@@ -1,4 +1,4 @@
<plugin name="Bookmarks" version="1.2.80" compatVersion="1.2.80"> <plugin name="Bookmarks" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,8 +19,8 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Bookmarks in text editors.</description> <description>Bookmarks in text editors.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="CMakeProjectManager" version="1.2.80" compatVersion="1.2.80"> <plugin name="CMakeProjectManager" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,9 +19,9 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>CMake support</description> <description>CMake support</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="CppTools" version="1.2.80"/> <dependency name="CppTools" version="1.2.91"/>
<dependency name="CppEditor" version="1.2.80"/> <dependency name="CppEditor" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="Core" version="1.2.80" compatVersion="1.2.80"> <plugin name="Core" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>

View File

@@ -35,7 +35,7 @@ namespace Constants {
#define IDE_VERSION_MAJOR 1 #define IDE_VERSION_MAJOR 1
#define IDE_VERSION_MINOR 2 #define IDE_VERSION_MINOR 2
#define IDE_VERSION_RELEASE 80 #define IDE_VERSION_RELEASE 91
#define STRINGIFY_INTERNAL(x) #x #define STRINGIFY_INTERNAL(x) #x
#define STRINGIFY(x) STRINGIFY_INTERNAL(x) #define STRINGIFY(x) STRINGIFY_INTERNAL(x)

View File

@@ -40,6 +40,7 @@ class CORE_EXPORT IEditor : public IContext
{ {
Q_OBJECT Q_OBJECT
public: public:
IEditor(QObject *parent = 0) : IContext(parent) {} IEditor(QObject *parent = 0) : IContext(parent) {}
virtual ~IEditor() {} virtual ~IEditor() {}

View File

@@ -678,6 +678,7 @@ void MainWindow::registerDefaultActions()
cmd = am->registerAction(m_optionsAction, Constants::OPTIONS, m_globalContext); cmd = am->registerAction(m_optionsAction, Constants::OPTIONS, m_globalContext);
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
cmd->setDefaultKeySequence(QKeySequence("Ctrl+,")); cmd->setDefaultKeySequence(QKeySequence("Ctrl+,"));
cmd->action()->setMenuRole(QAction::PreferencesRole);
#endif #endif
mtools->addAction(cmd, Constants::G_DEFAULT_THREE); mtools->addAction(cmd, Constants::G_DEFAULT_THREE);
connect(m_optionsAction, SIGNAL(triggered()), this, SLOT(showOptionsDialog())); connect(m_optionsAction, SIGNAL(triggered()), this, SLOT(showOptionsDialog()));
@@ -735,7 +736,11 @@ void MainWindow::registerDefaultActions()
cmd = am->registerAction(tmpaction, Constants::ABOUT_QTCREATOR, m_globalContext); cmd = am->registerAction(tmpaction, Constants::ABOUT_QTCREATOR, m_globalContext);
mhelp->addAction(cmd, Constants::G_HELP_ABOUT); mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
tmpaction->setEnabled(true); tmpaction->setEnabled(true);
#ifdef Q_WS_MAC
cmd->action()->setMenuRole(QAction::ApplicationSpecificRole);
#endif
connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutQtCreator())); connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutQtCreator()));
//About Plugins Action //About Plugins Action
tmpaction = new QAction(tr("About &Plugins..."), this); tmpaction = new QAction(tr("About &Plugins..."), this);
cmd = am->registerAction(tmpaction, Constants::ABOUT_PLUGINS, m_globalContext); cmd = am->registerAction(tmpaction, Constants::ABOUT_PLUGINS, m_globalContext);

View File

@@ -1,4 +1,4 @@
<plugin name="CodePaster" version="1.2.80" compatVersion="1.2.80"> <plugin name="CodePaster" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,8 +19,8 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Codepaster plugin for pushing/fetching diff from server</description> <description>Codepaster plugin for pushing/fetching diff from server</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="CppEditor" version="1.2.80" compatVersion="1.2.80"> <plugin name="CppEditor" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,8 +19,8 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>C/C++ editor component.</description> <description>C/C++ editor component.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="CppTools" version="1.2.80"/> <dependency name="CppTools" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -73,6 +73,8 @@ void CppHighlighter::highlightBlock(const QString &text)
userData->setCollapseMode(TextBlockUserData::NoCollapse); userData->setCollapseMode(TextBlockUserData::NoCollapse);
} }
TextEditDocumentLayout::clearParentheses(currentBlock()); TextEditDocumentLayout::clearParentheses(currentBlock());
if (text.length()) // the empty line can still contain whitespace
setFormat(0, text.length(), visualSpaceFormat);
return; return;
} }
@@ -171,7 +173,7 @@ void CppHighlighter::highlightBlock(const QString &text)
} }
// mark the trailing white spaces // mark the trailing white spaces
if (! tokens.isEmpty()) { {
const SimpleToken tk = tokens.last(); const SimpleToken tk = tokens.last();
const int lastTokenEnd = tk.position() + tk.length(); const int lastTokenEnd = tk.position() + tk.length();
if (text.length() > lastTokenEnd) if (text.length() > lastTokenEnd)

View File

@@ -1,4 +1,4 @@
<plugin name="CppTools" version="1.2.80" compatVersion="1.2.80"> <plugin name="CppTools" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,8 +19,8 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Tools for analyzing C/C++ code.</description> <description>Tools for analyzing C/C++ code.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="QuickOpen" version="1.2.80"/> <dependency name="QuickOpen" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="CVS" version="1.2.80" compatVersion="1.2.80"> <plugin name="CVS" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,9 +19,9 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>CVS integration.</description> <description>CVS integration.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="VCSBase" version="1.2.80"/> <dependency name="VCSBase" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="Debugger" version="1.2.80" compatVersion="1.2.80"> <plugin name="Debugger" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,10 +19,10 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Debugger integration.</description> <description>Debugger integration.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="CppEditor" version="1.2.80"/><!-- Debugger plugin adds items to the editor's context menu --> <dependency name="CppEditor" version="1.2.91"/><!-- Debugger plugin adds items to the editor's context menu -->
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="Find" version="1.2.80"/> <dependency name="Find" version="1.2.91"/>
</dependencyList> </dependencyList>
<argumentList> <argumentList>
<argument name="-disable-cdb">Disable Cdb debugger engine</argument> <argument name="-disable-cdb">Disable Cdb debugger engine</argument>

View File

@@ -563,11 +563,11 @@ void CdbDebugEnginePrivate::clearDisplay()
m_debuggerManagerAccess->registerHandler()->removeAll(); m_debuggerManagerAccess->registerHandler()->removeAll();
} }
bool CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) void CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
{ {
if (m_d->m_hDebuggeeProcess) { if (m_d->m_hDebuggeeProcess) {
warning(QLatin1String("Internal error: Attempt to start debugger while another process is being debugged.")); warning(QLatin1String("Internal error: Attempt to start debugger while another process is being debugged."));
return false; emit startFailed();
} }
m_d->clearDisplay(); m_d->clearDisplay();
@@ -627,7 +627,11 @@ bool CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters>
} else { } else {
warning(errorMessage); warning(errorMessage);
} }
return rc;
if (rc)
emit startSuccessful();
else
emit startFailed();
} }
bool CdbDebugEngine::startAttachDebugger(qint64 pid, DebuggerStartMode sm, QString *errorMessage) bool CdbDebugEngine::startAttachDebugger(qint64 pid, DebuggerStartMode sm, QString *errorMessage)

View File

@@ -62,7 +62,7 @@ public:
virtual void shutdown(); virtual void shutdown();
virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
virtual bool startDebugger(const QSharedPointer<DebuggerStartParameters> &startParameters); virtual void startDebugger(const QSharedPointer<DebuggerStartParameters> &startParameters);
virtual void exitDebugger(); virtual void exitDebugger();
virtual void detachDebugger(); virtual void detachDebugger();
virtual void updateWatchData(const WatchData &data); virtual void updateWatchData(const WatchData &data);

View File

@@ -87,5 +87,7 @@ include(cdb/cdb.pri)
include(gdb/gdb.pri) include(gdb/gdb.pri)
include(script/script.pri) include(script/script.pri)
include(tcf/tcf.pri) include(tcf/tcf.pri)
include(symbian/symbian.pri)
include(shared/shared.pri) include(shared/shared.pri)
OTHER_FILES += Debugger.pluginspec OTHER_FILES += Debugger.pluginspec

View File

@@ -91,14 +91,14 @@ void MemoryViewAgent::init(quint64 addr)
m_editor = editorManager->openEditorWithContents( m_editor = editorManager->openEditorWithContents(
Core::Constants::K_DEFAULT_BINARY_EDITOR, Core::Constants::K_DEFAULT_BINARY_EDITOR,
&titlePattern); &titlePattern);
connect(m_editor->widget(), SIGNAL(lazyDataRequested(int,bool)), connect(m_editor->widget(), SIGNAL(lazyDataRequested(quint64,bool)),
this, SLOT(fetchLazyData(int,bool))); this, SLOT(fetchLazyData(quint64,bool)));
editorManager->activateEditor(m_editor); editorManager->activateEditor(m_editor);
QMetaObject::invokeMethod(m_editor->widget(), "setLazyData", QMetaObject::invokeMethod(m_editor->widget(), "setLazyData",
Q_ARG(int, addr), Q_ARG(int, INT_MAX), Q_ARG(int, BinBlockSize)); Q_ARG(quint64, addr), Q_ARG(int, 1024 * 1024), Q_ARG(int, BinBlockSize));
} }
void MemoryViewAgent::fetchLazyData(int block, bool sync) void MemoryViewAgent::fetchLazyData(quint64 block, bool sync)
{ {
Q_UNUSED(sync); // FIXME: needed support for incremental searching Q_UNUSED(sync); // FIXME: needed support for incremental searching
m_engine->fetchMemory(this, BinBlockSize * block, BinBlockSize); m_engine->fetchMemory(this, BinBlockSize * block, BinBlockSize);
@@ -107,7 +107,7 @@ void MemoryViewAgent::fetchLazyData(int block, bool sync)
void MemoryViewAgent::addLazyData(quint64 addr, const QByteArray &ba) void MemoryViewAgent::addLazyData(quint64 addr, const QByteArray &ba)
{ {
QMetaObject::invokeMethod(m_editor->widget(), "addLazyData", QMetaObject::invokeMethod(m_editor->widget(), "addLazyData",
Q_ARG(int, addr / BinBlockSize), Q_ARG(QByteArray, ba)); Q_ARG(quint64, addr / BinBlockSize), Q_ARG(QByteArray, ba));
} }

View File

@@ -63,7 +63,7 @@ public slots:
// Called from Engine // Called from Engine
void addLazyData(quint64 addr, const QByteArray &data); void addLazyData(quint64 addr, const QByteArray &data);
// Called from Editor // Called from Editor
void fetchLazyData(int block, bool sync); void fetchLazyData(quint64 block, bool sync);
private: private:
void init(quint64 startaddr); void init(quint64 startaddr);

View File

@@ -103,6 +103,8 @@ namespace Internal {
IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *); IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
IDebuggerEngine *createSymbianEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *);
QDebug operator<<(QDebug str, const DebuggerStartParameters &p) QDebug operator<<(QDebug str, const DebuggerStartParameters &p)
{ {
QDebug nospace = str.nospace(); QDebug nospace = str.nospace();
@@ -180,9 +182,10 @@ void DebuggerStartParameters::clear()
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
static IDebuggerEngine *gdbEngine = 0; static IDebuggerEngine *gdbEngine = 0;
static IDebuggerEngine *winEngine = 0;
static IDebuggerEngine *scriptEngine = 0; static IDebuggerEngine *scriptEngine = 0;
static IDebuggerEngine *symbianEngine = 0;
static IDebuggerEngine *tcfEngine = 0; static IDebuggerEngine *tcfEngine = 0;
static IDebuggerEngine *winEngine = 0;
DebuggerManager::DebuggerManager() DebuggerManager::DebuggerManager()
: m_startParameters(new DebuggerStartParameters), : m_startParameters(new DebuggerStartParameters),
@@ -195,9 +198,10 @@ DebuggerManager::~DebuggerManager()
{ {
#define doDelete(ptr) delete ptr; ptr = 0 #define doDelete(ptr) delete ptr; ptr = 0
doDelete(gdbEngine); doDelete(gdbEngine);
doDelete(winEngine);
doDelete(scriptEngine); doDelete(scriptEngine);
doDelete(symbianEngine);
doDelete(tcfEngine); doDelete(tcfEngine);
doDelete(winEngine);
#undef doDelete #undef doDelete
} }
@@ -444,6 +448,8 @@ QList<Core::IOptionsPage*> DebuggerManager::initializeEngines(unsigned enabledTy
QList<Core::IOptionsPage*> rc; QList<Core::IOptionsPage*> rc;
if (enabledTypeFlags & GdbEngineType) if (enabledTypeFlags & GdbEngineType)
gdbEngine = createGdbEngine(this, &rc); gdbEngine = createGdbEngine(this, &rc);
if (enabledTypeFlags & SymbianEngineType)
symbianEngine = createSymbianEngine(this, &rc);
winEngine = createWinEngine(this, (enabledTypeFlags & CdbEngineType), &rc); winEngine = createWinEngine(this, (enabledTypeFlags & CdbEngineType), &rc);
if (enabledTypeFlags & ScriptEngineType) if (enabledTypeFlags & ScriptEngineType)
scriptEngine = createScriptEngine(this, &rc); scriptEngine = createScriptEngine(this, &rc);
@@ -693,9 +699,10 @@ void DebuggerManager::updateWatchData(const WatchData &data)
m_engine->updateWatchData(data); m_engine->updateWatchData(data);
} }
static inline QString msgEngineNotAvailable(const char *engine) static QString msgEngineNotAvailable(const char *engine)
{ {
return DebuggerManager::tr("The application requires the debugger engine '%1', which is disabled.").arg(QLatin1String(engine)); return DebuggerManager::tr("The application requires the debugger engine '%1', "
"which is disabled.").arg(QLatin1String(engine));
} }
static IDebuggerEngine *debuggerEngineForToolChain(ProjectExplorer::ToolChain::ToolChainType tc) static IDebuggerEngine *debuggerEngineForToolChain(ProjectExplorer::ToolChain::ToolChainType tc)
@@ -737,7 +744,16 @@ static IDebuggerEngine *determineDebuggerEngine(const QString &executable,
return scriptEngine; return scriptEngine;
} }
if (IDebuggerEngine *tce = debuggerEngineForToolChain(static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType))) if (executable.endsWith(_(".sym"))) {
if (!symbianEngine) {
*errorMessage = msgEngineNotAvailable("Symbian Engine");
return 0;
}
return symbianEngine;
}
if (IDebuggerEngine *tce = debuggerEngineForToolChain(
static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType)))
return tce; return tce;
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
@@ -772,7 +788,8 @@ static IDebuggerEngine *determineDebuggerEngine(int /* pid */,
int toolChainType, int toolChainType,
QString *errorMessage) QString *errorMessage)
{ {
if (IDebuggerEngine *tce = debuggerEngineForToolChain(static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType))) if (IDebuggerEngine *tce = debuggerEngineForToolChain(
static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType)))
return tce; return tce;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// Preferably Windows debugger // Preferably Windows debugger
@@ -844,11 +861,15 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl,
setBusyCursor(false); setBusyCursor(false);
setStatus(DebuggerProcessStartingUp); setStatus(DebuggerProcessStartingUp);
if (!m_engine->startDebugger(m_startParameters)) { connect(m_engine, SIGNAL(startFailed()), this, SLOT(startFailed()));
m_engine->startDebugger(m_startParameters);
}
void DebuggerManager::startFailed()
{
disconnect(m_engine, SIGNAL(startFailed()), this, SLOT(startFailed()));
setStatus(DebuggerProcessNotReady); setStatus(DebuggerProcessNotReady);
debuggingFinished(); debuggingFinished();
return;
}
} }
void DebuggerManager::cleanupViews() void DebuggerManager::cleanupViews()
@@ -1334,14 +1355,18 @@ void DebuggerManager::modulesDockToggled(bool on)
void DebuggerManager::showDebuggerOutput(int channel, const QString &msg) void DebuggerManager::showDebuggerOutput(int channel, const QString &msg)
{ {
QTC_ASSERT(m_outputWindow, return); if (m_outputWindow)
m_outputWindow->showOutput(channel, msg); m_outputWindow->showOutput(channel, msg);
else
qDebug() << "OUTPUT: " << channel << msg;
} }
void DebuggerManager::showDebuggerInput(int channel, const QString &msg) void DebuggerManager::showDebuggerInput(int channel, const QString &msg)
{ {
QTC_ASSERT(m_outputWindow, return); if (m_outputWindow)
m_outputWindow->showInput(channel, msg); m_outputWindow->showInput(channel, msg);
else
qDebug() << "INPUT: " << channel << msg;
} }

View File

@@ -172,12 +172,18 @@ class CdbDebugEngine;
struct CdbDebugEnginePrivate; struct CdbDebugEnginePrivate;
// Flags for initialization // Flags for initialization
enum DebuggerEngineTypeFlags { enum DebuggerEngineTypeFlags
GdbEngineType = 0x1, {
ScriptEngineType = 0x2, GdbEngineType = 0x01,
CdbEngineType = 0x4, ScriptEngineType = 0x02,
TcfEngineType = 0x8, CdbEngineType = 0x04,
AllEngineTypes = (GdbEngineType|ScriptEngineType|CdbEngineType|TcfEngineType) TcfEngineType = 0x08,
SymbianEngineType = 0x10,
AllEngineTypes = GdbEngineType
| ScriptEngineType
| CdbEngineType
| TcfEngineType
| SymbianEngineType
}; };
// The construct below is not nice but enforces a bit of order. The // The construct below is not nice but enforces a bit of order. The
@@ -324,6 +330,8 @@ public slots:
void showStatusMessage(const QString &msg, int timeout = -1); // -1 forever void showStatusMessage(const QString &msg, int timeout = -1); // -1 forever
private slots: private slots:
void showDebuggerOutput(const QString &msg)
{ showDebuggerOutput(LogDebug, msg); }
void showDebuggerOutput(int channel, const QString &msg); void showDebuggerOutput(int channel, const QString &msg);
void showDebuggerInput(int channel, const QString &msg); void showDebuggerInput(int channel, const QString &msg);
void showApplicationOutput(const QString &data); void showApplicationOutput(const QString &data);
@@ -343,6 +351,7 @@ private slots:
void attemptBreakpointSynchronization(); void attemptBreakpointSynchronization();
void reloadFullStack(); void reloadFullStack();
void stepByInstructionTriggered(); void stepByInstructionTriggered();
void startFailed();
private: private:
// //
@@ -421,6 +430,7 @@ private:
BreakpointData *findBreakpoint(const QString &fileName, int lineNumber); BreakpointData *findBreakpoint(const QString &fileName, int lineNumber);
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
// FIXME: Remove engine-specific state
QSharedPointer<DebuggerStartParameters> m_startParameters; QSharedPointer<DebuggerStartParameters> m_startParameters;
DebuggerRunControl *m_runControl; DebuggerRunControl *m_runControl;
QString m_dumperLib; QString m_dumperLib;

View File

@@ -43,7 +43,8 @@
#include <QtGui/QTextDocument> #include <QtGui/QTextDocument>
using namespace Debugger::Internal; namespace Debugger {
namespace Internal {
using ProjectExplorer::RunConfiguration; using ProjectExplorer::RunConfiguration;
using ProjectExplorer::RunControl; using ProjectExplorer::RunControl;
@@ -122,8 +123,8 @@ QWidget *DebuggerRunner::configurationWidget(RunConfigurationPtr runConfiguratio
DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager, DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
DebuggerStartMode mode, DebuggerStartMode mode,
const QSharedPointer<DebuggerStartParameters> &startParameters, const QSharedPointer<DebuggerStartParameters> &startParameters,
QSharedPointer<ApplicationRunConfiguration> runConfiguration) : QSharedPointer<ApplicationRunConfiguration> runConfiguration)
RunControl(runConfiguration), : RunControl(runConfiguration),
m_mode(mode), m_mode(mode),
m_startParameters(startParameters), m_startParameters(startParameters),
m_manager(manager), m_manager(manager),
@@ -140,44 +141,44 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
Qt::QueuedConnection); Qt::QueuedConnection);
connect(this, SIGNAL(stopRequested()), connect(this, SIGNAL(stopRequested()),
m_manager, SLOT(exitDebugger())); m_manager, SLOT(exitDebugger()));
if (!runConfiguration)
return;
// Enhance parameters by info from the project, but do not clobber
// arguments given in the dialogs
if (m_startParameters->executable.isEmpty())
m_startParameters->executable = runConfiguration->executable();
if (m_startParameters->environment.empty())
m_startParameters->environment = runConfiguration->environment().toStringList();
if (m_startParameters->workingDir.isEmpty())
m_startParameters->workingDir = runConfiguration->workingDirectory();
if (m_mode != StartExternal)
m_startParameters->processArgs = runConfiguration->commandLineArguments();
switch (m_startParameters->toolChainType) {
case ProjectExplorer::ToolChain::UNKNOWN:
case ProjectExplorer::ToolChain::INVALID:
m_startParameters->toolChainType = runConfiguration->toolChainType();
break;
default:
break;
}
if (const ProjectExplorer::Project *project = runConfiguration->project()) {
m_startParameters->buildDir =
project->buildDirectory(project->activeBuildConfiguration());
}
m_startParameters->useTerminal =
runConfiguration->runMode() == ApplicationRunConfiguration::Console;
m_dumperLibrary = runConfiguration->dumperLibrary();
m_dumperLibraryLocations = runConfiguration->dumperLibraryLocations();
} }
void DebuggerRunControl::start() void DebuggerRunControl::start()
{ {
m_running = true; m_running = true;
ApplicationRunConfigurationPtr rc = m_manager->setQtDumperLibraryName(m_dumperLibrary);
runConfiguration().objectCast<ApplicationRunConfiguration>(); m_manager->setQtDumperLibraryLocations(m_dumperLibraryLocations);
if (rc) {
// Enhance parameters by info from the project, but do not clobber
// arguments given in the dialogs
if (m_startParameters->executable.isEmpty())
m_startParameters->executable = rc->executable();
if (m_startParameters->environment.empty())
m_startParameters->environment = rc->environment().toStringList();
if (m_startParameters->workingDir.isEmpty())
m_startParameters->workingDir = rc->workingDirectory();
if (m_mode != StartExternal)
m_startParameters->processArgs = rc->commandLineArguments();
switch (m_startParameters->toolChainType) {
case ProjectExplorer::ToolChain::UNKNOWN:
case ProjectExplorer::ToolChain::INVALID:
m_startParameters->toolChainType = rc->toolChainType();
break;
default:
break;
}
m_manager->setQtDumperLibraryName(rc->dumperLibrary());
m_manager->setQtDumperLibraryLocations(rc->dumperLibraryLocations());
if (const ProjectExplorer::Project *project = rc->project()) {
m_startParameters->buildDir = project->buildDirectory(project->activeBuildConfiguration());
}
m_startParameters->useTerminal = rc->runMode() == ApplicationRunConfiguration::Console;
}
//emit addToOutputWindow(this, tr("Debugging %1").arg(m_executable));
m_manager->startNewDebugger(this, m_startParameters); m_manager->startNewDebugger(this, m_startParameters);
emit started();
//debuggingFinished();
} }
void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data) void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data)
@@ -187,7 +188,6 @@ void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data)
void DebuggerRunControl::stop() void DebuggerRunControl::stop()
{ {
//qDebug() << "DebuggerRunControl::stop";
m_running = false; m_running = false;
emit stopRequested(); emit stopRequested();
} }
@@ -195,13 +195,13 @@ void DebuggerRunControl::stop()
void DebuggerRunControl::debuggingFinished() void DebuggerRunControl::debuggingFinished()
{ {
m_running = false; m_running = false;
//qDebug() << "DebuggerRunControl::finished";
//emit addToOutputWindow(this, tr("Debugging %1 finished").arg(m_executable));
emit finished(); emit finished();
} }
bool DebuggerRunControl::isRunning() const bool DebuggerRunControl::isRunning() const
{ {
//qDebug() << "DebuggerRunControl::isRunning" << m_running;
return m_running; return m_running;
} }
} // namespace Internal
} // namespace Debugger

View File

@@ -51,7 +51,8 @@ typedef QSharedPointer<ProjectExplorer::RunConfiguration>
typedef QSharedPointer<ProjectExplorer::ApplicationRunConfiguration> typedef QSharedPointer<ProjectExplorer::ApplicationRunConfiguration>
ApplicationRunConfigurationPtr; ApplicationRunConfigurationPtr;
class DebuggerRunner : public ProjectExplorer::IRunConfigurationRunner class DebuggerRunner
: public ProjectExplorer::IRunConfigurationRunner
{ {
Q_OBJECT Q_OBJECT
@@ -59,7 +60,7 @@ public:
explicit DebuggerRunner(DebuggerManager *manager); explicit DebuggerRunner(DebuggerManager *manager);
// ProjectExplorer::IRunConfigurationRunner // ProjectExplorer::IRunConfigurationRunner
virtual bool canRun(RunConfigurationPtr runConfiguration, const QString &mode); bool canRun(RunConfigurationPtr runConfiguration, const QString &mode);
virtual ProjectExplorer::RunControl *run(RunConfigurationPtr runConfiguration, const QString &mode); virtual ProjectExplorer::RunControl *run(RunConfigurationPtr runConfiguration, const QString &mode);
virtual QString displayName() const; virtual QString displayName() const;
@@ -79,12 +80,13 @@ private:
}; };
// This is a job description // This is a job description
class DebuggerRunControl : public ProjectExplorer::RunControl class DebuggerRunControl
: public ProjectExplorer::RunControl
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DebuggerRunControl(DebuggerManager *manager, DebuggerRunControl(DebuggerManager *manager,
DebuggerStartMode mode, DebuggerStartMode mode,
const QSharedPointer<DebuggerStartParameters> &sp, const QSharedPointer<DebuggerStartParameters> &sp,
ApplicationRunConfigurationPtr runConfiguration); ApplicationRunConfigurationPtr runConfiguration);
@@ -109,11 +111,14 @@ private:
const QSharedPointer<DebuggerStartParameters> m_startParameters; const QSharedPointer<DebuggerStartParameters> m_startParameters;
DebuggerManager *m_manager; DebuggerManager *m_manager;
bool m_running; bool m_running;
QString m_dumperLibrary;
QStringList m_dumperLibraryLocations;
}; };
// A default run configuration for external executables or attaching to // A default run configuration for external executables or attaching to
// running processes by id. // running processes by id.
class DefaultApplicationRunConfiguration : public ProjectExplorer::ApplicationRunConfiguration class DefaultApplicationRunConfiguration
: public ProjectExplorer::ApplicationRunConfiguration
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@@ -1,4 +1,5 @@
HEADERS += \ HEADERS += \
$$PWD/gdbprocessbase.h \
$$PWD/gdbmi.h \ $$PWD/gdbmi.h \
$$PWD/gdbengine.h \ $$PWD/gdbengine.h \
$$PWD/gdboptionspage.h \ $$PWD/gdboptionspage.h \

View File

@@ -138,13 +138,27 @@ static QByteArray parsePlainConsoleStream(const GdbResultRecord &record)
return out.mid(pos + 3); return out.mid(pos + 3);
} }
///////////////////////////////////////////////////////////////////////
//
// GdbProcess
//
///////////////////////////////////////////////////////////////////////
void GdbProcess::attach(GdbEngine *engine) const
{
QFileInfo fi(engine->startParameters().executable);
QString fileName = fi.absoluteFilePath();
engine->postCommand(_("-file-exec-and-symbols ") + fileName,
&GdbEngine::handleFileExecAndSymbols, "handleFileExecAndSymbols");
}
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
// GdbEngine // GdbEngine
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
GdbEngine::GdbEngine(DebuggerManager *parent) : GdbEngine::GdbEngine(DebuggerManager *parent, GdbProcessBase *gdbProc) :
#ifdef Q_OS_WIN // Do injection loading with MinGW (call loading does not work with 64bit) #ifdef Q_OS_WIN // Do injection loading with MinGW (call loading does not work with 64bit)
m_dumperInjectionLoad(true), m_dumperInjectionLoad(true),
#else #else
@@ -153,6 +167,7 @@ GdbEngine::GdbEngine(DebuggerManager *parent) :
q(parent), q(parent),
qq(parent->engineInterface()) qq(parent->engineInterface())
{ {
m_gdbProc = gdbProc;
m_stubProc.setMode(Core::Utils::ConsoleProcess::Debug); m_stubProc.setMode(Core::Utils::ConsoleProcess::Debug);
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
m_stubProc.setSettings(Core::ICore::instance()->settings()); m_stubProc.setSettings(Core::ICore::instance()->settings());
@@ -164,20 +179,23 @@ GdbEngine::GdbEngine(DebuggerManager *parent) :
GdbEngine::~GdbEngine() GdbEngine::~GdbEngine()
{ {
// prevent sending error messages afterwards // prevent sending error messages afterwards
m_gdbProc.disconnect(this); m_gdbProc->disconnect(this);
delete m_gdbProc;
} }
void GdbEngine::initializeConnections() void GdbEngine::initializeConnections()
{ {
// Gdb Process interaction // Gdb Process interaction
connect(&m_gdbProc, SIGNAL(error(QProcess::ProcessError)), connect(m_gdbProc, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(gdbProcError(QProcess::ProcessError))); this, SLOT(gdbProcError(QProcess::ProcessError)));
connect(&m_gdbProc, SIGNAL(readyReadStandardOutput()), connect(m_gdbProc, SIGNAL(readyReadStandardOutput()),
this, SLOT(readGdbStandardOutput())); this, SLOT(readGdbStandardOutput()));
connect(&m_gdbProc, SIGNAL(readyReadStandardError()), connect(m_gdbProc, SIGNAL(readyReadStandardError()),
this, SLOT(readGdbStandardError())); this, SLOT(readGdbStandardError()));
connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), connect(m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)),
q, SLOT(exitDebugger())); q, SLOT(exitDebugger()));
connect(m_gdbProc, SIGNAL(started()),
this, SLOT(startDebugger2()));
connect(&m_stubProc, SIGNAL(processError(QString)), connect(&m_stubProc, SIGNAL(processError(QString)),
this, SLOT(stubError(QString))); this, SLOT(stubError(QString)));
@@ -265,6 +283,7 @@ void GdbEngine::gdbProcError(QProcess::ProcessError error)
"invoked program '%1' is missing, or you may have insufficient " "invoked program '%1' is missing, or you may have insufficient "
"permissions to invoke the program.") "permissions to invoke the program.")
.arg(theDebuggerStringSetting(GdbLocation)); .arg(theDebuggerStringSetting(GdbLocation));
emitStartFailed();
break; break;
case QProcess::Crashed: case QProcess::Crashed:
kill = false; kill = false;
@@ -614,7 +633,7 @@ void GdbEngine::stubError(const QString &msg)
void GdbEngine::readGdbStandardError() void GdbEngine::readGdbStandardError()
{ {
qWarning() << "Unexpected gdb stderr:" << m_gdbProc.readAllStandardError(); qWarning() << "Unexpected gdb stderr:" << m_gdbProc->readAllStandardError();
} }
void GdbEngine::readGdbStandardOutput() void GdbEngine::readGdbStandardOutput()
@@ -622,7 +641,7 @@ void GdbEngine::readGdbStandardOutput()
int newstart = 0; int newstart = 0;
int scan = m_inbuffer.size(); int scan = m_inbuffer.size();
m_inbuffer.append(m_gdbProc.readAllStandardOutput()); m_inbuffer.append(m_gdbProc->readAllStandardOutput());
while (newstart < m_inbuffer.size()) { while (newstart < m_inbuffer.size()) {
int start = newstart; int start = newstart;
@@ -651,7 +670,7 @@ void GdbEngine::interruptInferior()
{ {
qq->notifyInferiorStopRequested(); qq->notifyInferiorStopRequested();
if (m_gdbProc.state() == QProcess::NotRunning) { if (m_gdbProc->state() == QProcess::NotRunning) {
debugMessage(_("TRYING TO INTERRUPT INFERIOR WITHOUT RUNNING GDB")); debugMessage(_("TRYING TO INTERRUPT INFERIOR WITHOUT RUNNING GDB"));
qq->notifyInferiorExited(); qq->notifyInferiorExited();
return; return;
@@ -698,7 +717,7 @@ void GdbEngine::postCommand(const QString &command, GdbCommandFlags flags,
GdbCommandCallback callback, const char *callbackName, GdbCommandCallback callback, const char *callbackName,
const QVariant &cookie) const QVariant &cookie)
{ {
if (m_gdbProc.state() == QProcess::NotRunning) { if (m_gdbProc->state() == QProcess::NotRunning) {
debugMessage(_("NO GDB PROCESS RUNNING, CMD IGNORED: ") + command); debugMessage(_("NO GDB PROCESS RUNNING, CMD IGNORED: ") + command);
return; return;
} }
@@ -742,10 +761,8 @@ void GdbEngine::flushCommand(GdbCommand &cmd)
if (cmd.flags & EmbedToken) if (cmd.flags & EmbedToken)
cmd.command = cmd.command.arg(currentToken()); cmd.command = cmd.command.arg(currentToken());
m_gdbProc.write(cmd.command.toLatin1() + "\r\n");
//emit gdbInputAvailable(QString(), " " + currentTime());
//emit gdbInputAvailable(QString(), "[" + currentTime() + "] " + cmd.command);
emit gdbInputAvailable(LogInput, cmd.command); emit gdbInputAvailable(LogInput, cmd.command);
executeDebuggerCommand(cmd.command);
} }
void GdbEngine::handleResultRecord(const GdbResultRecord &record) void GdbEngine::handleResultRecord(const GdbResultRecord &record)
@@ -829,12 +846,12 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
void GdbEngine::executeDebuggerCommand(const QString &command) void GdbEngine::executeDebuggerCommand(const QString &command)
{ {
if (m_gdbProc.state() == QProcess::NotRunning) { if (m_gdbProc->state() != QProcess::Running) {
debugMessage(_("NO GDB PROCESS RUNNING, PLAIN CMD IGNORED: ") + command); debugMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + command);
return; return;
} }
m_gdbProc.write(command.toLocal8Bit() + "\r\n"); m_gdbProc->write(command.toLatin1() + "\r\n");
} }
void GdbEngine::handleTargetCore(const GdbResultRecord &, const QVariant &) void GdbEngine::handleTargetCore(const GdbResultRecord &, const QVariant &)
@@ -1061,7 +1078,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
return; return;
} }
//MAC: bool isFirstStop = data.findChild("bkptno").data() == "1"; //MAC: bool isFirstStop = data.findChild("bkptno").data() == "1";
//!MAC: startSymbolName == data.findChild("frame").findChild("func") //!MAC: startSymbolName == data.findChild("frame").findChild("func")
if (m_waitingForFirstBreakpointToBeHit) { if (m_waitingForFirstBreakpointToBeHit) {
@@ -1275,6 +1291,15 @@ void GdbEngine::handleAsyncOutput2(const GdbMi &data)
} }
} }
// FIXME: Hack, remove as soon as we get real stack traces.
if (m_gdbProc->isAdapter()) {
StackFrame f;
f.file = QString::fromLocal8Bit(fullName.data());
f.line = frame.findChild("line").data().toInt();
f.address = _(frame.findChild("addr").data());
q->gotoLocation(f, true);
}
// //
// Stack // Stack
// //
@@ -1434,15 +1459,16 @@ void GdbEngine::detachDebugger()
void GdbEngine::exitDebugger() void GdbEngine::exitDebugger()
{ {
debugMessage(_("GDBENGINE EXITDEBUGGER: %1").arg(m_gdbProc.state())); debugMessage(_("GDBENGINE EXITDEBUGGER: %1").arg(m_gdbProc->state()));
if (m_gdbProc.state() == QProcess::Starting) { if (m_gdbProc->state() == QProcess::Starting) {
debugMessage(_("WAITING FOR GDB STARTUP TO SHUTDOWN: %1") debugMessage(_("WAITING FOR GDB STARTUP TO SHUTDOWN: %1")
.arg(m_gdbProc.state())); .arg(m_gdbProc->state()));
m_gdbProc.waitForStarted(); // FIXME: handle this!
//m_gdbProc->waitForStarted();
} }
if (m_gdbProc.state() == QProcess::Running) { if (m_gdbProc->state() == QProcess::Running) {
debugMessage(_("WAITING FOR RUNNING GDB TO SHUTDOWN: %1") debugMessage(_("WAITING FOR RUNNING GDB TO SHUTDOWN: %1")
.arg(m_gdbProc.state())); .arg(m_gdbProc->state()));
if (q->status() != DebuggerInferiorStopped if (q->status() != DebuggerInferiorStopped
&& q->status() != DebuggerProcessStartingUp) { && q->status() != DebuggerProcessStartingUp) {
QTC_ASSERT(q->status() == DebuggerInferiorRunning, QTC_ASSERT(q->status() == DebuggerInferiorRunning,
@@ -1455,17 +1481,17 @@ void GdbEngine::exitDebugger()
postCommand(_("kill")); postCommand(_("kill"));
postCommand(_("-gdb-exit"), CB(handleExit)); postCommand(_("-gdb-exit"), CB(handleExit));
// 20s can easily happen when loading webkit debug information // 20s can easily happen when loading webkit debug information
if (!m_gdbProc.waitForFinished(20000)) { if (!m_gdbProc->waitForFinished(20000)) {
debugMessage(_("FORCING TERMINATION: %1") debugMessage(_("FORCING TERMINATION: %1")
.arg(m_gdbProc.state())); .arg(m_gdbProc->state()));
m_gdbProc.terminate(); m_gdbProc->terminate();
m_gdbProc.waitForFinished(20000); m_gdbProc->waitForFinished(20000);
} }
} }
if (m_gdbProc.state() != QProcess::NotRunning) { if (m_gdbProc->state() != QProcess::NotRunning) {
debugMessage(_("PROBLEM STOPPING DEBUGGER: STATE %1") debugMessage(_("PROBLEM STOPPING DEBUGGER: STATE %1")
.arg(m_gdbProc.state())); .arg(m_gdbProc->state()));
m_gdbProc.kill(); m_gdbProc->kill();
} }
m_outputCollector.shutdown(); m_outputCollector.shutdown();
@@ -1479,18 +1505,20 @@ int GdbEngine::currentFrame() const
return qq->stackHandler()->currentIndex(); return qq->stackHandler()->currentIndex();
} }
bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) void GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
{ {
m_startParameters = *sp;
// This should be set by the constructor or in exitDebugger(). // This should be set by the constructor or in exitDebugger().
QTC_ASSERT(m_debuggingHelperState == DebuggingHelperUninitialized, QTC_ASSERT(m_debuggingHelperState == DebuggingHelperUninitialized,
initializeVariables()); initializeVariables());
QStringList gdbArgs; QStringList gdbArgs;
if (m_gdbProc.state() != QProcess::NotRunning) { if (m_gdbProc->state() != QProcess::NotRunning) {
debugMessage(_("GDB IS ALREADY RUNNING, STATE: %1").arg(m_gdbProc.state())); debugMessage(_("GDB IS ALREADY RUNNING, STATE: %1").arg(m_gdbProc->state()));
m_gdbProc.kill(); m_gdbProc->kill();
return false; emitStartFailed();
return;
} }
//gdbArgs.prepend(_("--quiet")); //gdbArgs.prepend(_("--quiet"));
@@ -1501,62 +1529,73 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
// nothing to do // nothing to do
} else if (q->startMode() == StartRemote) { } else if (q->startMode() == StartRemote) {
// Start the remote server // Start the remote server
if (sp->serverStartScript.isEmpty()) { if (m_startParameters.serverStartScript.isEmpty()) {
q->showStatusMessage(_("No server start script given. " q->showStatusMessage(_("No server start script given. "
"Assuming server runs already.")); "Assuming server runs already."));
} else { } else {
if (!sp->workingDir.isEmpty()) if (!m_startParameters.workingDir.isEmpty())
m_uploadProc.setWorkingDirectory(sp->workingDir); m_uploadProc.setWorkingDirectory(m_startParameters.workingDir);
if (!sp->environment.isEmpty()) if (!m_startParameters.environment.isEmpty())
m_uploadProc.setEnvironment(sp->environment); m_uploadProc.setEnvironment(m_startParameters.environment);
m_uploadProc.start(_("/bin/sh ") + sp->serverStartScript); m_uploadProc.start(_("/bin/sh ") + m_startParameters.serverStartScript);
m_uploadProc.waitForStarted(); m_uploadProc.waitForStarted();
} }
} else if (sp->useTerminal) { } else if (m_startParameters.useTerminal) {
m_stubProc.stop(); // We leave the console open, so recycle it now. m_stubProc.stop(); // We leave the console open, so recycle it now.
m_stubProc.setWorkingDirectory(sp->workingDir); m_stubProc.setWorkingDirectory(m_startParameters.workingDir);
m_stubProc.setEnvironment(sp->environment); m_stubProc.setEnvironment(m_startParameters.environment);
if (!m_stubProc.start(sp->executable, sp->processArgs)) if (!m_stubProc.start(m_startParameters.executable,
return false; // Error message for user is delivered via a signal. m_startParameters.processArgs)) {
// Error message for user is delivered via a signal.
emitStartFailed();
return;
}
} else { } else {
if (!m_outputCollector.listen()) { if (!m_outputCollector.listen()) {
QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"), QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"),
tr("Cannot set up communication with child process: %1") tr("Cannot set up communication with child process: %1")
.arg(m_outputCollector.errorString())); .arg(m_outputCollector.errorString()));
return false; emitStartFailed();
return;
} }
gdbArgs.prepend(_("--tty=") + m_outputCollector.serverName()); gdbArgs.prepend(_("--tty=") + m_outputCollector.serverName());
if (!sp->workingDir.isEmpty()) if (!m_startParameters.workingDir.isEmpty())
m_gdbProc.setWorkingDirectory(sp->workingDir); m_gdbProc->setWorkingDirectory(m_startParameters.workingDir);
if (!sp->environment.isEmpty()) if (!m_startParameters.environment.isEmpty())
m_gdbProc.setEnvironment(sp->environment); m_gdbProc->setEnvironment(m_startParameters.environment);
} }
#if 0 #if 0
qDebug() << "Command:" << q->settings()->m_gdbCmd; qDebug() << "Command:" << q->settings()->m_gdbCmd;
qDebug() << "WorkingDirectory:" << m_gdbProc.workingDirectory(); qDebug() << "WorkingDirectory:" << m_gdbProc->workingDirectory();
qDebug() << "ScriptFile:" << q->settings()->m_scriptFile; qDebug() << "ScriptFile:" << q->settings()->m_scriptFile;
qDebug() << "Environment:" << m_gdbProc.environment(); qDebug() << "Environment:" << m_gdbProc->environment();
qDebug() << "Arguments:" << gdbArgs; qDebug() << "Arguments:" << gdbArgs;
qDebug() << "BuildDir:" << sp->buildDir; qDebug() << "BuildDir:" << m_startParameters.buildDir;
qDebug() << "ExeFile:" << sp->executable; qDebug() << "ExeFile:" << m_startParameters.executable;
#endif #endif
QString loc = theDebuggerStringSetting(GdbLocation); QString loc = theDebuggerStringSetting(GdbLocation);
q->showStatusMessage(tr("Starting Debugger: ") + loc + _c(' ') + gdbArgs.join(_(" "))); q->showStatusMessage(tr("Starting Debugger: ") + loc + _c(' ') + gdbArgs.join(_(" ")));
m_gdbProc.start(loc, gdbArgs); m_gdbProc->start(loc, gdbArgs);
if (!m_gdbProc.waitForStarted()) { }
QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"),
tr("Cannot start debugger: %1").arg(m_gdbProc.errorString())); void GdbEngine::emitStartFailed()
{
// QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"),
// tr("Cannot start debugger: %1").arg(m_gdbProc->errorString()));
m_outputCollector.shutdown(); m_outputCollector.shutdown();
m_stubProc.blockSignals(true); m_stubProc.blockSignals(true);
m_stubProc.stop(); m_stubProc.stop();
m_stubProc.blockSignals(false); m_stubProc.blockSignals(false);
return false; emit startFailed();
} }
void GdbEngine::startDebugger2()
{
debugMessage(_("STARTUP, PHASE 2"));
q->showStatusMessage(tr("Gdb Running...")); q->showStatusMessage(tr("Gdb Running..."));
postCommand(_("show version"), CB(handleShowVersion)); postCommand(_("show version"), CB(handleShowVersion));
@@ -1637,54 +1676,56 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
} }
if (q->startMode() == AttachExternal || q->startMode() == AttachCrashedExternal) { if (q->startMode() == AttachExternal || q->startMode() == AttachCrashedExternal) {
postCommand(_("attach %1").arg(sp->attachPID), CB(handleAttach)); postCommand(_("attach %1").arg(m_startParameters.attachPID), CB(handleAttach));
// Task 254674 does not want to remove them // Task 254674 does not want to remove them
//qq->breakHandler()->removeAllBreakpoints(); //qq->breakHandler()->removeAllBreakpoints();
} else if (q->startMode() == AttachCore) { } else if (q->startMode() == AttachCore) {
QFileInfo fi(sp->executable); QFileInfo fi(m_startParameters.executable);
QString fileName = _c('"') + fi.absoluteFilePath() + _c('"'); QString fileName = _c('"') + fi.absoluteFilePath() + _c('"');
QFileInfo fi2(sp->coreFile); QFileInfo fi2(m_startParameters.coreFile);
// quoting core name below fails in gdb 6.8-debian // quoting core name below fails in gdb 6.8-debian
QString coreName = fi2.absoluteFilePath(); QString coreName = fi2.absoluteFilePath();
postCommand(_("-file-exec-and-symbols ") + fileName, CB(handleFileExecAndSymbols)); postCommand(_("-file-exec-and-symbols ") + fileName, CB(handleFileExecAndSymbols));
postCommand(_("target core ") + coreName, CB(handleTargetCore)); postCommand(_("target core ") + coreName, CB(handleTargetCore));
qq->breakHandler()->removeAllBreakpoints(); qq->breakHandler()->removeAllBreakpoints();
} else if (q->startMode() == StartRemote) { } else if (q->startMode() == StartRemote) {
postCommand(_("set architecture %1").arg(sp->remoteArchitecture)); postCommand(_("set architecture %1").arg(m_startParameters.remoteArchitecture));
qq->breakHandler()->setAllPending(); qq->breakHandler()->setAllPending();
//QFileInfo fi(sp->executable); //QFileInfo fi(m_startParameters.executable);
//QString fileName = fi.absoluteFileName(); //QString fileName = fi.absoluteFileName();
QString fileName = sp->executable; QString fileName = m_startParameters.executable;
postCommand(_("-file-exec-and-symbols \"%1\"").arg(fileName), CB(handleFileExecAndSymbols)); postCommand(_("-file-exec-and-symbols \"%1\"").arg(fileName), CB(handleFileExecAndSymbols));
// works only for > 6.8 // works only for > 6.8
postCommand(_("set target-async on"), CB(handleSetTargetAsync)); postCommand(_("set target-async on"), CB(handleSetTargetAsync));
} else if (sp->useTerminal) { } else if (m_startParameters.useTerminal) {
qq->breakHandler()->setAllPending(); qq->breakHandler()->setAllPending();
} else if (q->startMode() == StartInternal || q->startMode() == StartExternal) { } else if (q->startMode() == StartInternal || q->startMode() == StartExternal) {
QFileInfo fi(sp->executable); m_gdbProc->attach(this);
QString fileName = _c('"') + fi.absoluteFilePath() + _c('"'); if (m_gdbProc->isAdapter()) {
postCommand(_("-file-exec-and-symbols ") + fileName, CB(handleFileExecAndSymbols)); qq->notifyInferiorRunningRequested();
//postCommand(_("file ") + fileName, handleFileExecAndSymbols); postCommand(_("-exec-continue"), CB(handleExecContinue));
} else {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
postCommand(_("sharedlibrary apply-load-rules all")); postCommand(_("sharedlibrary apply-load-rules all"));
#endif #endif
if (!sp->processArgs.isEmpty()) if (!m_startParameters.processArgs.isEmpty())
postCommand(_("-exec-arguments ") + sp->processArgs.join(_(" "))); postCommand(_("-exec-arguments ") + m_startParameters.processArgs.join(_(" ")));
#ifndef Q_OS_MAC #ifdef Q_OS_MAC
if (!m_dumperInjectionLoad)
postCommand(_("set auto-solib-add off"));
postCommand(_("info target"), CB(handleStart));
#else
// On MacOS, breaking in at the entry point wreaks havoc. // On MacOS, breaking in at the entry point wreaks havoc.
postCommand(_("tbreak main")); postCommand(_("tbreak main"));
m_waitingForFirstBreakpointToBeHit = true; m_waitingForFirstBreakpointToBeHit = true;
qq->notifyInferiorRunningRequested(); qq->notifyInferiorRunningRequested();
postCommand(_("-exec-run"), CB(handleExecRun)); postCommand(_("-exec-run"), CB(handleExecRun));
#else
if (!m_dumperInjectionLoad)
postCommand(_("set auto-solib-add off"));
postCommand(_("info target"), CB(handleStart));
#endif #endif
}
qq->breakHandler()->setAllPending(); qq->breakHandler()->setAllPending();
} }
return true; emit startSuccessful();
} }
void GdbEngine::continueInferior() void GdbEngine::continueInferior()
@@ -1749,7 +1790,6 @@ void GdbEngine::handleAttach(const GdbResultRecord &, const QVariant &)
void GdbEngine::handleSetTargetAsync(const GdbResultRecord &record, const QVariant &) void GdbEngine::handleSetTargetAsync(const GdbResultRecord &record, const QVariant &)
{ {
if (record.resultClass == GdbResultDone) { if (record.resultClass == GdbResultDone) {
//postCommand(_("info target"), handleStart);
qq->notifyInferiorRunningRequested(); qq->notifyInferiorRunningRequested();
postCommand(_("target remote %1").arg(q->startParameters()->remoteChannel), postCommand(_("target remote %1").arg(q->startParameters()->remoteChannel),
CB(handleTargetRemote)); CB(handleTargetRemote));
@@ -2001,7 +2041,8 @@ void GdbEngine::sendInsertBreakpoint(int index)
} }
// The argument is simply a C-quoted version of the argument to the // The argument is simply a C-quoted version of the argument to the
// non-MI "break" command, including the "original" quoting it wants. // non-MI "break" command, including the "original" quoting it wants.
where = _("\"\\\"") + GdbMi::escapeCString(where) + _("\\\":") + data->lineNumber + _c('"'); where = _("\"\\\"%1\\\":%2\"")
.arg(GdbMi::escapeCString(where)).arg(data->lineNumber);
} else { } else {
where = data->funcName; where = data->funcName;
} }
@@ -2018,6 +2059,8 @@ void GdbEngine::sendInsertBreakpoint(int index)
// cmd += "-c " + data->condition + " "; // cmd += "-c " + data->condition + " ";
#else #else
QString cmd = _("-break-insert -f "); QString cmd = _("-break-insert -f ");
if (m_gdbProc->isAdapter())
cmd = _("-break-insert ");
//if (!data->condition.isEmpty()) //if (!data->condition.isEmpty())
// cmd += _("-c ") + data->condition + ' '; // cmd += _("-c ") + data->condition + ' ';
#endif #endif
@@ -4198,7 +4241,7 @@ void GdbEngine::handleFetchDisassemblerByAddress0(const GdbResultRecord &record,
IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *opts) IDebuggerEngine *createGdbEngine(DebuggerManager *parent, QList<Core::IOptionsPage*> *opts)
{ {
opts->push_back(new GdbOptionsPage); opts->push_back(new GdbOptionsPage);
return new GdbEngine(parent); return new GdbEngine(parent, new GdbProcess);
} }
} // namespace Internal } // namespace Internal

View File

@@ -31,7 +31,9 @@
#define DEBUGGER_GDBENGINE_H #define DEBUGGER_GDBENGINE_H
#include "idebuggerengine.h" #include "idebuggerengine.h"
#include "debuggermanager.h" // only for StartParameters
#include "gdbmi.h" #include "gdbmi.h"
#include "gdbprocessbase.h"
#include "outputcollector.h" #include "outputcollector.h"
#include "watchutils.h" #include "watchutils.h"
@@ -56,6 +58,7 @@ QT_END_NAMESPACE
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
class DebuggerManager; class DebuggerManager;
class IDebuggerManagerAccessForEngines; class IDebuggerManagerAccessForEngines;
class GdbResultRecord; class GdbResultRecord;
@@ -72,13 +75,50 @@ enum DebuggingHelperState
DebuggingHelperUnavailable, DebuggingHelperUnavailable,
}; };
class GdbProcess : public GdbProcessBase
{
public:
GdbProcess(QObject *parent = 0)
: GdbProcessBase(parent)
{
connect(&m_proc, SIGNAL(error(QProcess::ProcessError)),
this, SIGNAL(error(QProcess::ProcessError)));
connect(&m_proc, SIGNAL(readyReadStandardOutput()),
this, SIGNAL(readyReadStandardOutput()));
connect(&m_proc, SIGNAL(readyReadStandardError()),
this, SIGNAL(readyReadStandardError()));
connect(&m_proc, SIGNAL(started()),
this, SIGNAL(started()));
connect(&m_proc, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SIGNAL(finished(int, QProcess::ExitStatus)));
}
void start(const QString &program, const QStringList &args,
QIODevice::OpenMode mode) { m_proc.start(program, args, mode); }
void kill() { m_proc.kill(); }
void terminate() { m_proc.terminate(); }
bool waitForStarted(int msecs) { return m_proc.waitForStarted(msecs); }
bool waitForFinished(int msecs) { return m_proc.waitForFinished(msecs); }
QProcess::ProcessState state() const { return m_proc.state(); }
QString errorString() const { return m_proc.errorString(); }
QByteArray readAllStandardError() { return m_proc.readAllStandardError(); }
QByteArray readAllStandardOutput() { return m_proc.readAllStandardOutput(); }
qint64 write(const char *data) { return m_proc.write(data); }
void setWorkingDirectory(const QString &dir) { m_proc.setWorkingDirectory(dir); }
void setEnvironment(const QStringList &env) { m_proc.setEnvironment(env); }
bool isAdapter() const { return false; }
void attach(GdbEngine *engine) const;
private:
QProcess m_proc;
};
class GdbEngine : public IDebuggerEngine class GdbEngine : public IDebuggerEngine
{ {
Q_OBJECT Q_OBJECT
public: public:
GdbEngine(DebuggerManager *parent); GdbEngine(DebuggerManager *parent, GdbProcessBase *gdbProc);
~GdbEngine(); ~GdbEngine();
signals: signals:
@@ -87,6 +127,11 @@ signals:
void applicationOutputAvailable(const QString &output); void applicationOutputAvailable(const QString &output);
private: private:
friend class GdbProcess;
friend class SymbianAdapter;
const DebuggerStartParameters &startParameters() const
{ return m_startParameters; }
// //
// IDebuggerEngine implementation // IDebuggerEngine implementation
// //
@@ -98,7 +143,8 @@ private:
void shutdown(); void shutdown();
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
bool startDebugger(const QSharedPointer<DebuggerStartParameters> &sp); void startDebugger(const QSharedPointer<DebuggerStartParameters> &sp);
Q_SLOT void startDebugger2();
void exitDebugger(); void exitDebugger();
void detachDebugger(); void detachDebugger();
@@ -166,6 +212,7 @@ public: // otherwise the Qt flag macros are unhappy
}; };
Q_DECLARE_FLAGS(GdbCommandFlags, GdbCommandFlag) Q_DECLARE_FLAGS(GdbCommandFlags, GdbCommandFlag)
private: private:
typedef void (GdbEngine::*GdbCommandCallback)(const GdbResultRecord &record, const QVariant &cookie); typedef void (GdbEngine::*GdbCommandCallback)(const GdbResultRecord &record, const QVariant &cookie);
@@ -210,6 +257,7 @@ private slots:
void stubStarted(); void stubStarted();
void stubError(const QString &msg); void stubError(const QString &msg);
void uploadProcError(QProcess::ProcessError error); void uploadProcError(QProcess::ProcessError error);
void emitStartFailed();
private: private:
int terminationIndex(const QByteArray &buffer, int &length); int terminationIndex(const QByteArray &buffer, int &length);
@@ -251,7 +299,7 @@ private:
QByteArray m_inbuffer; QByteArray m_inbuffer;
QProcess m_gdbProc; GdbProcessBase *m_gdbProc;
QProcess m_uploadProc; QProcess m_uploadProc;
Core::Utils::ConsoleProcess m_stubProc; Core::Utils::ConsoleProcess m_stubProc;
@@ -395,6 +443,7 @@ private:
DebuggerManager * const q; DebuggerManager * const q;
IDebuggerManagerAccessForEngines * const qq; IDebuggerManagerAccessForEngines * const qq;
DebuggerStartParameters m_startParameters;
// make sure to re-initialize new members in initializeVariables(); // make sure to re-initialize new members in initializeVariables();
}; };

View File

@@ -0,0 +1,80 @@
/**************************************************************************
**
** 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://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef DEBUGGER_PROCESSBASE_H
#define DEBUGGER_PROCESSBASE_H
#include <QtCore/QObject>
#include <QtCore/QProcess>
namespace Debugger {
namespace Internal {
class GdbEngine;
// GdbProcessBase is inherited by GdbProcess and the gdb/trk Adapter.
// In the GdbProcess case it's just a wrapper around a QProcess running
// gdb, in the Adapter case it's the interface to the gdb process in
// the whole rfomm/gdb/gdbserver combo.
class GdbProcessBase : public QObject
{
Q_OBJECT
public:
GdbProcessBase(QObject *parent = 0) : QObject(parent) {}
virtual void start(const QString &program, const QStringList &args,
QIODevice::OpenMode mode = QIODevice::ReadWrite) = 0;
virtual void kill() = 0;
virtual void terminate() = 0;
//virtual bool waitForStarted(int msecs = 30000) = 0;
virtual bool waitForFinished(int msecs = 30000) = 0;
virtual QProcess::ProcessState state() const = 0;
virtual QString errorString() const = 0;
virtual QByteArray readAllStandardError() = 0;
virtual QByteArray readAllStandardOutput() = 0;
virtual qint64 write(const char *data) = 0;
virtual void setWorkingDirectory(const QString &dir) = 0;
virtual void setEnvironment(const QStringList &env) = 0;
virtual bool isAdapter() const = 0;
virtual void attach(GdbEngine *engine) const = 0;
signals:
void error(QProcess::ProcessError);
void started();
void readyReadStandardOutput();
void readyReadStandardError();
void finished(int, QProcess::ExitStatus);
};
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_PROCESSBASE_H

View File

@@ -55,12 +55,14 @@ class WatchData;
class IDebuggerEngine : public QObject class IDebuggerEngine : public QObject
{ {
Q_OBJECT
public: public:
IDebuggerEngine(QObject *parent = 0) : QObject(parent) {} IDebuggerEngine(QObject *parent = 0) : QObject(parent) {}
virtual void shutdown() = 0; virtual void shutdown() = 0;
virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos) = 0; virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos) = 0;
virtual bool startDebugger(const QSharedPointer<DebuggerStartParameters> &startParameters) = 0; virtual void startDebugger(const QSharedPointer<DebuggerStartParameters> &startParameters) = 0;
virtual void exitDebugger() = 0; virtual void exitDebugger() = 0;
virtual void detachDebugger() {} virtual void detachDebugger() {}
virtual void updateWatchData(const WatchData &data) = 0; virtual void updateWatchData(const WatchData &data) = 0;
@@ -101,6 +103,10 @@ public:
virtual void fetchDisassembler(DisassemblerViewAgent *, const StackFrame &) {} virtual void fetchDisassembler(DisassemblerViewAgent *, const StackFrame &) {}
virtual void setRegisterValue(int regnr, const QString &value) virtual void setRegisterValue(int regnr, const QString &value)
{ Q_UNUSED(regnr); Q_UNUSED(value); } { Q_UNUSED(regnr); Q_UNUSED(value); }
signals:
void startSuccessful();
void startFailed();
}; };
} // namespace Internal } // namespace Internal

View File

@@ -217,7 +217,7 @@ void ScriptEngine::exitDebugger()
qq->notifyInferiorExited(); qq->notifyInferiorExited();
} }
bool ScriptEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) void ScriptEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
{ {
if (!m_scriptEngine) if (!m_scriptEngine)
m_scriptEngine = new QScriptEngine(this); m_scriptEngine = new QScriptEngine(this);
@@ -233,15 +233,17 @@ bool ScriptEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &
QFileInfo fi(sp->executable); QFileInfo fi(sp->executable);
m_scriptFileName = fi.absoluteFilePath(); m_scriptFileName = fi.absoluteFilePath();
QFile scriptFile(m_scriptFileName); QFile scriptFile(m_scriptFileName);
if (!scriptFile.open(QIODevice::ReadOnly)) if (!scriptFile.open(QIODevice::ReadOnly)) {
return false; emit startFailed();
return;
}
QTextStream stream(&scriptFile); QTextStream stream(&scriptFile);
m_scriptContents = stream.readAll(); m_scriptContents = stream.readAll();
scriptFile.close(); scriptFile.close();
attemptBreakpointSynchronization(); attemptBreakpointSynchronization();
qq->notifyInferiorRunningRequested(); qq->notifyInferiorRunningRequested();
QTimer::singleShot(0, this, SLOT(runInferior())); QTimer::singleShot(0, this, SLOT(runInferior()));
return true; emit startSuccessful();
} }
void ScriptEngine::continueInferior() void ScriptEngine::continueInferior()

View File

@@ -75,7 +75,7 @@ private:
void shutdown(); void shutdown();
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
bool startDebugger(const QSharedPointer<DebuggerStartParameters> &sp); void startDebugger(const QSharedPointer<DebuggerStartParameters> &sp);
void exitDebugger(); void exitDebugger();

View File

@@ -0,0 +1,16 @@
HEADERS += \
$$PWD/trkutils.h \
$$PWD/trkclient.h \
$$PWD/symbianadapter.h \
#$$PWD/gdboptionspage.h \
SOURCES += \
$$PWD/trkutils.cpp \
$$PWD/trkclient.cpp \
$$PWD/symbianadapter.cpp \
$$PWD/symbianengine.cpp \
#$$PWD/gdboptionspage.cpp \
#FORMS += $$PWD/gdboptionspage.ui
#RESOURCES += $$PWD/gdb.qrc

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,245 @@
/**************************************************************************
**
** 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://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef DEBUGGER_SYMBIANADAPTER_H
#define DEBUGGER_SYMBIANADAPTER_H
#include "trkutils.h"
#include "trkclient.h"
#include "../gdb/gdbprocessbase.h"
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QHash>
#include <QtCore/QPointer>
#include <QtCore/QProcess>
#include <QtCore/QQueue>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QTextStream>
#include <QtCore/QTimer>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QMainWindow>
#include <QtGui/QKeyEvent>
#include <QtGui/QTextBlock>
#include <QtGui/QTextEdit>
#include <QtGui/QToolBar>
#include <QtNetwork/QTcpServer>
#include <QtNetwork/QTcpSocket>
#include <QtNetwork/QLocalServer>
#include <QtNetwork/QLocalSocket>
namespace Debugger {
namespace Internal {
struct GdbResult
{
QByteArray data;
};
///////////////////////////////////////////////////////////////////////
//
// SymbianAdapter
//
///////////////////////////////////////////////////////////////////////
class SymbianAdapter : public GdbProcessBase
{
Q_OBJECT
public:
typedef trk::TrkResult TrkResult;
typedef trk::TrkFunctor1<const TrkResult &> TrkCallback;
typedef trk::TrkFunctor1<const GdbResult &> GdbCallback;
SymbianAdapter();
~SymbianAdapter();
void setGdbServerName(const QString &name);
QString gdbServerName() const { return m_gdbServerName; }
QString gdbServerIP() const;
uint gdbServerPort() const;
void setVerbose(int verbose) { m_verbose = verbose; }
void setSerialFrame(bool b) { m_serialFrame = b; }
void setBufferedMemoryRead(bool b) { m_bufferedMemoryRead = b; }
trk::Session &session() { return m_session; }
public slots:
void startInferior();
void run();
signals:
void output(const QString &msg);
void startSuccessful();
void startFailed();
private slots:
void startGdb();
private:
friend class RunnerGui;
QString m_rfcommDevice; // /dev/rfcomm0
QString m_gdbServerName; // 127.0.0.1:(2222+uid)
QProcess m_gdbProc;
QProcess m_rfcommProc;
bool m_running;
public:
//
// Implementation of GdbProcessBase
//
void start(const QString &program, const QStringList &args,
QIODevice::OpenMode mode = QIODevice::ReadWrite);
void kill();
void terminate();
bool waitForFinished(int msecs = 30000);
QProcess::ProcessState state() const;
QString errorString() const;
QByteArray readAllStandardError();
QByteArray readAllStandardOutput();
qint64 write(const char *data);
void setWorkingDirectory(const QString &dir);
void setEnvironment(const QStringList &env);
bool isAdapter() const { return true; }
void attach(GdbEngine *engine) const;
//
// TRK
//
void sendTrkMessage(byte code,
TrkCallback callback = TrkCallback(),
const QByteArray &data = QByteArray(),
const QVariant &cookie = QVariant());
Q_SLOT void handleTrkResult(const trk::TrkResult &data);
Q_SLOT void handleTrkError(const QString &msg);
// convenience messages
void sendTrkAck(byte token);
void handleCpuType(const TrkResult &result);
void handleCreateProcess(const TrkResult &result);
void handleClearBreakpoint(const TrkResult &result);
void handleSignalContinue(const TrkResult &result);
void handleStop(const TrkResult &result);
void handleSupportMask(const TrkResult &result);
void handleTrkVersions(const TrkResult &result);
void handleDisconnect(const TrkResult &result);
void handleAndReportCreateProcess(const TrkResult &result);
void handleAndReportReadRegisters(const TrkResult &result);
QByteArray memoryReadLogMessage(uint addr, uint len, const QByteArray &ba) const;
QByteArray trkContinueMessage();
QByteArray trkReadRegisterMessage();
QByteArray trkReadMemoryMessage(uint addr, uint len);
QByteArray trkBreakpointMessage(uint addr, uint len, bool armMode = true);
void handleAndReportSetBreakpoint(const TrkResult &result);
void handleReadMemoryBuffered(const TrkResult &result);
void handleReadMemoryUnbuffered(const TrkResult &result);
void handleStepRange(const TrkResult &result);
void handleReadRegisters(const TrkResult &result);
void reportReadMemoryBuffered(const TrkResult &result);
void reportToGdb(const TrkResult &result);
void readMemory(uint addr, uint len);
void interruptInferior();
trk::TrkDevice m_trkDevice;
//
// Gdb
//
struct GdbCommand
{
GdbCommand() : flags(0), callback(GdbCallback()), callbackName(0) {}
int flags;
GdbCallback callback;
const char *callbackName;
QString command;
QVariant cookie;
//QTime postTime;
};
void sendGdbMessage(const QString &msg,
GdbCallback callback = GdbCallback(),
const QVariant &cookie = QVariant());
Q_SLOT void handleGdbConnection();
Q_SLOT void readGdbServerCommand();
void readGdbResponse();
void handleGdbServerCommand(const QByteArray &cmd);
void sendGdbServerMessage(const QByteArray &msg,
const QByteArray &logNote = QByteArray());
void sendGdbServerMessageAfterTrkResponse(const QByteArray &msg,
const QByteArray &logNote = QByteArray());
void sendGdbServerAck();
bool sendGdbServerPacket(const QByteArray &packet, bool doFlush);
Q_SLOT void handleGdbError(QProcess::ProcessError error);
Q_SLOT void handleGdbFinished(int exitCode, QProcess::ExitStatus exitStatus);
Q_SLOT void handleGdbStarted();
Q_SLOT void handleGdbStateChanged(QProcess::ProcessState newState);
void logMessage(const QString &msg); // triggers output() if m_verbose
Q_SLOT void trkLogMessage(const QString &msg);
QTcpServer m_gdbServer;
QPointer<QTcpSocket> m_gdbConnection;
QByteArray m_gdbReadBuffer;
bool m_gdbAckMode;
QHash<int, GdbCommand> m_gdbCookieForToken;
//
// Rfcomm
//
Q_SLOT void handleRfcommReadyReadStandardError();
Q_SLOT void handleRfcommReadyReadStandardOutput();
Q_SLOT void handleRfcommError(QProcess::ProcessError error);
Q_SLOT void handleRfcommFinished(int exitCode, QProcess::ExitStatus exitStatus);
Q_SLOT void handleRfcommStarted();
Q_SLOT void handleRfcommStateChanged(QProcess::ProcessState newState);
// Debuggee state
Q_SLOT void executeCommand(const QString &msg);
trk::Session m_session; // global-ish data (process id, target information)
trk::Snapshot m_snapshot; // local-ish data (memory and registers)
int m_verbose;
bool m_serialFrame;
bool m_bufferedMemoryRead;
};
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_SYMBIANADAPTER_H

View File

@@ -0,0 +1,64 @@
/**************************************************************************
**
** 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://qt.nokia.com/contact.
**
**************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "gdb/gdbengine.h"
#include "symbianadapter.h"
#include "debuggermanager.h"
//#include "debuggerdialogs.h"
#include <utils/qtcassert.h>
#include <texteditor/itexteditor.h>
#include <coreplugin/icore.h>
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtCore/QDebug>
namespace Debugger {
namespace Internal {
IDebuggerEngine *createSymbianEngine(DebuggerManager *parent,
QList<Core::IOptionsPage*> *opts)
{
Q_UNUSED(opts);
//opts->push_back(new GdbOptionsPage);
SymbianAdapter *adapter = new SymbianAdapter;
GdbEngine *engine = new GdbEngine(parent, adapter);
QObject::connect(adapter, SIGNAL(output(QString)),
parent, SLOT(showDebuggerOutput(QString)));
return engine;
}
} // namespace Internal
} // namespace Debugger

View File

@@ -27,7 +27,7 @@
** **
**************************************************************************/ **************************************************************************/
#include "trkdevicex.h" #include "trkclient.h"
#include "trkutils.h" #include "trkutils.h"
#include <QtCore/QString> #include <QtCore/QString>
@@ -35,7 +35,6 @@
#include <QtCore/QQueue> #include <QtCore/QQueue>
#include <QtCore/QHash> #include <QtCore/QHash>
#include <QtCore/QMap> #include <QtCore/QMap>
#include <QtCore/QSharedPointer>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# include <windows.h> # include <windows.h>
@@ -117,14 +116,12 @@ struct TrkMessage
QByteArray data; QByteArray data;
QVariant cookie; QVariant cookie;
Callback callback; Callback callback;
bool invokeOnNAK;
}; };
TrkMessage::TrkMessage(byte c, byte t, Callback cb) : TrkMessage::TrkMessage(byte c, byte t, Callback cb) :
code(c), code(c),
token(t), token(t),
callback(cb), callback(cb)
invokeOnNAK(false)
{ {
} }
@@ -144,8 +141,7 @@ public:
// Enqueue messages. // Enqueue messages.
void queueTrkMessage(byte code, Callback callback, void queueTrkMessage(byte code, Callback callback,
const QByteArray &data, const QVariant &cookie, const QByteArray &data, const QVariant &cookie);
bool invokeOnNAK);
void queueTrkInitialPing(); void queueTrkInitialPing();
// Call this from the device read notification with the results. // Call this from the device read notification with the results.
@@ -184,14 +180,13 @@ byte TrkWriteQueue::nextTrkWriteToken()
} }
void TrkWriteQueue::queueTrkMessage(byte code, Callback callback, void TrkWriteQueue::queueTrkMessage(byte code, Callback callback,
const QByteArray &data, const QVariant &cookie, bool invokeOnNAK) const QByteArray &data, const QVariant &cookie)
{ {
const byte token = code == TRK_WRITE_QUEUE_NOOP_CODE ? const byte token = code == TRK_WRITE_QUEUE_NOOP_CODE ?
byte(0) : nextTrkWriteToken(); byte(0) : nextTrkWriteToken();
TrkMessage msg(code, token, callback); TrkMessage msg(code, token, callback);
msg.data = data; msg.data = data;
msg.cookie = cookie; msg.cookie = cookie;
msg.invokeOnNAK = invokeOnNAK;
trkWriteQueue.append(msg); trkWriteQueue.append(msg);
} }
@@ -233,16 +228,14 @@ void TrkWriteQueue::notifyWriteResult(bool ok)
void TrkWriteQueue::slotHandleResult(const TrkResult &result) void TrkWriteQueue::slotHandleResult(const TrkResult &result)
{ {
trkWriteBusy = false; trkWriteBusy = false;
if (result.code != TrkNotifyAck && result.code != TrkNotifyNak) //if (result.code != TrkNotifyAck && result.code != TrkNotifyNak)
return; // return;
// Find which request the message belongs to and invoke callback // Find which request the message belongs to and invoke callback
// if ACK or on NAK if desired. // if ACK or on NAK if desired.
const TokenMessageMap::iterator it = writtenTrkMessages.find(result.token); const TokenMessageMap::iterator it = writtenTrkMessages.find(result.token);
if (it == writtenTrkMessages.end()) if (it == writtenTrkMessages.end())
return; return;
const bool invokeCB = it.value().callback const bool invokeCB = it.value().callback;
&& (result.code == TrkNotifyAck || it.value().invokeOnNAK);
if (invokeCB) { if (invokeCB) {
TrkResult result1 = result; TrkResult result1 = result;
result1.cookie = it.value().cookie; result1.cookie = it.value().cookie;
@@ -257,8 +250,18 @@ void TrkWriteQueue::queueTrkInitialPing()
trkWriteQueue.append(TrkMessage(0, 0)); trkWriteQueue.append(TrkMessage(0, 0));
} }
struct TrkDevicePrivate {
///////////////////////////////////////////////////////////////////////
//
// TrkDevicePrivate
//
///////////////////////////////////////////////////////////////////////
struct TrkDevicePrivate
{
TrkDevicePrivate(); TrkDevicePrivate();
TrkWriteQueue queue;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
HANDLE hdevice; HANDLE hdevice;
#else #else
@@ -298,11 +301,13 @@ TrkDevicePrivate::TrkDevicePrivate() :
TrkDevice::TrkDevice(QObject *parent) : TrkDevice::TrkDevice(QObject *parent) :
QObject(parent), QObject(parent),
d(new TrkDevicePrivate), d(new TrkDevicePrivate)
qd(new TrkWriteQueue) {}
TrkDevice::~TrkDevice()
{ {
connect(this, SIGNAL(messageReceived(trk::TrkResult)), close();
this, SLOT(slotHandleResult(trk::TrkResult))); delete d;
} }
bool TrkDevice::open(const QString &port, QString *errorMessage) bool TrkDevice::open(const QString &port, QString *errorMessage)
@@ -355,14 +360,6 @@ bool TrkDevice::open(const QString &port, QString *errorMessage)
#endif #endif
} }
TrkDevice::~TrkDevice()
{
close();
delete d;
delete qd;
}
void TrkDevice::close() void TrkDevice::close()
{ {
if (!isOpen()) if (!isOpen())
@@ -492,7 +489,7 @@ void TrkDevice::tryTrkRead()
while (extractResult(&d->trkReadBuffer, d->serialFrame, &r, &rawData)) { while (extractResult(&d->trkReadBuffer, d->serialFrame, &r, &rawData)) {
//if (verbose()) //if (verbose())
// logMessage("Read TrkResult " + r.data.toHex()); // logMessage("Read TrkResult " + r.data.toHex());
qDebug() << "RECEIVE DATA: " << r.data.toHex(); d->queue.slotHandleResult(r);
emit messageReceived(r); emit messageReceived(r);
if (!rawData.isEmpty()) if (!rawData.isEmpty())
emit rawDataReceived(rawData); emit rawDataReceived(rawData);
@@ -513,14 +510,14 @@ void TrkDevice::emitError(const QString &s)
} }
void TrkDevice::sendTrkMessage(byte code, Callback callback, void TrkDevice::sendTrkMessage(byte code, Callback callback,
const QByteArray &data, const QVariant &cookie, bool invokeOnNAK) const QByteArray &data, const QVariant &cookie)
{ {
qd->queueTrkMessage(code, callback, data, cookie, invokeOnNAK); d->queue.queueTrkMessage(code, callback, data, cookie);
} }
void TrkDevice::sendTrkInitialPing() void TrkDevice::sendTrkInitialPing()
{ {
qd->queueTrkInitialPing(); d->queue.queueTrkInitialPing();
} }
bool TrkDevice::sendTrkAck(byte token) bool TrkDevice::sendTrkAck(byte token)
@@ -536,10 +533,10 @@ bool TrkDevice::sendTrkAck(byte token)
void TrkDevice::tryTrkWrite() void TrkDevice::tryTrkWrite()
{ {
TrkMessage message; TrkMessage message;
if (!qd->pendingMessage(&message)) if (!d->queue.pendingMessage(&message))
return; return;
const bool success = trkWriteRawMessage(message); const bool success = trkWriteRawMessage(message);
qd->notifyWriteResult(success); d->queue.notifyWriteResult(success);
} }
bool TrkDevice::trkWriteRawMessage(const TrkMessage &msg) bool TrkDevice::trkWriteRawMessage(const TrkMessage &msg)
@@ -554,10 +551,5 @@ bool TrkDevice::trkWriteRawMessage(const TrkMessage &msg)
return rc; return rc;
} }
void TrkDevice::slotHandleResult(const TrkResult &result)
{
qd->slotHandleResult(result);
}
} // namespace trk } // namespace trk

View File

@@ -46,8 +46,6 @@ namespace trk {
struct TrkResult; struct TrkResult;
struct TrkMessage; struct TrkMessage;
struct TrkDevicePrivate; struct TrkDevicePrivate;
class TrkWriteQueue;
struct TrkWriteQueueIODevicePrivate;
/* TrkDevice: Implements a Windows COM or Linux device for /* TrkDevice: Implements a Windows COM or Linux device for
* Trk communications. Provides synchronous write and asynchronous * Trk communications. Provides synchronous write and asynchronous
@@ -106,9 +104,7 @@ public:
void sendTrkMessage(unsigned char code, void sendTrkMessage(unsigned char code,
Callback callBack = Callback(), Callback callBack = Callback(),
const QByteArray &data = QByteArray(), const QByteArray &data = QByteArray(),
const QVariant &cookie = QVariant(), const QVariant &cookie = QVariant());
// Invoke callback on receiving NAK, too.
bool invokeOnNAK = false);
// Enqeue an initial ping // Enqeue an initial ping
void sendTrkInitialPing(); void sendTrkInitialPing();
@@ -116,15 +112,11 @@ public:
// Send an Ack synchronously, bypassing the queue // Send an Ack synchronously, bypassing the queue
bool sendTrkAck(unsigned char token); bool sendTrkAck(unsigned char token);
private slots:
void slotHandleResult(const trk::TrkResult &);
private: private:
void tryTrkWrite(); void tryTrkWrite();
bool trkWriteRawMessage(const TrkMessage &msg); bool trkWriteRawMessage(const TrkMessage &msg);
TrkDevicePrivate *d; TrkDevicePrivate *d;
TrkWriteQueue *qd;
}; };
} // namespace trk } // namespace trk

View File

@@ -27,8 +27,8 @@
** **
**************************************************************************/ **************************************************************************/
#ifndef _TRK_FUNCTOR_H_ #ifndef DEBUGGER_TRK_FUNCTOR_H
#define _TRK_FUNCTOR_H_ #define DEBUGGER_TRK_FUNCTOR_H
#include <QtGlobal> #include <QtGlobal>

View File

@@ -43,6 +43,11 @@ QByteArray hexNumber(uint n, int digits)
return QByteArray(digits - ba.size(), '0') + ba; return QByteArray(digits - ba.size(), '0') + ba;
} }
QByteArray hexxNumber(uint n, int digits)
{
return "0x" + hexNumber(n, digits);
}
TrkResult::TrkResult() : TrkResult::TrkResult() :
code(0), code(0),
token(0), token(0),
@@ -345,5 +350,16 @@ int TrkResult::errorCode() const
return errorCode; return errorCode;
return isNAK ? 0xff : 0; return isNAK ? 0xff : 0;
} }
QString TrkResult::errorString() const
{
// NAK means always error, else data sized 1 with a non-null element
if (code == 0xff)
return "NAK";
if (data.size() < 1)
return "Unknown error packet";
return errorMessage(data.at(0));
}
} // namespace trk } // namespace trk

View File

@@ -144,7 +144,7 @@ struct Session
uint tid; uint tid;
uint codeseg; uint codeseg;
uint dataseg; uint dataseg;
QHash<uint, uint> tokenToBreakpointIndex; QHash<uint, uint> addressToBP;
// Gdb request // Gdb request
uint currentThread; uint currentThread;
@@ -178,6 +178,7 @@ struct TrkResult
QString toString() const; QString toString() const;
// 0 for no error. // 0 for no error.
int errorCode() const; int errorCode() const;
QString errorString() const;
byte code; byte code;
byte token; byte token;
@@ -193,9 +194,9 @@ ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame);
bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *r, QByteArray *rawData = 0); bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *r, QByteArray *rawData = 0);
QByteArray errorMessage(byte code); QByteArray errorMessage(byte code);
QByteArray hexNumber(uint n, int digits = 0); QByteArray hexNumber(uint n, int digits = 0);
QByteArray hexxNumber(uint n, int digits = 0); // prepends '0x', too
uint swapEndian(uint in); uint swapEndian(uint in);
} // namespace trk } // namespace trk
#endif // DEBUGGER_TRK_UTILS #endif // DEBUGGER_TRK_UTILS

View File

@@ -220,7 +220,7 @@ void TcfEngine::exitDebugger()
qq->notifyInferiorExited(); qq->notifyInferiorExited();
} }
bool TcfEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) void TcfEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
{ {
qq->notifyInferiorRunningRequested(); qq->notifyInferiorRunningRequested();
const int pos = sp->remoteChannel.indexOf(QLatin1Char(':')); const int pos = sp->remoteChannel.indexOf(QLatin1Char(':'));
@@ -228,7 +228,7 @@ bool TcfEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
const quint16 port = sp->remoteChannel.mid(pos + 1).toInt(); const quint16 port = sp->remoteChannel.mid(pos + 1).toInt();
//QTimer::singleShot(0, this, SLOT(runInferior())); //QTimer::singleShot(0, this, SLOT(runInferior()));
m_socket->connectToHost(host, port); m_socket->connectToHost(host, port);
return true; emit startSuccessful();
} }
void TcfEngine::continueInferior() void TcfEngine::continueInferior()

View File

@@ -82,7 +82,7 @@ private:
void shutdown(); void shutdown();
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos); void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
bool startDebugger(const QSharedPointer<DebuggerStartParameters> &sp); void startDebugger(const QSharedPointer<DebuggerStartParameters> &sp);
void exitDebugger(); void exitDebugger();
void continueInferior(); void continueInferior();

View File

@@ -1,4 +1,4 @@
<plugin name="Designer" version="1.2.80" compatVersion="1.2.80"> <plugin name="Designer" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,8 +19,8 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Qt Designer integration.</description> <description>Qt Designer integration.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<!-- For compiling with CPP support enabled --> <!-- For compiling with CPP support enabled -->
<dependency name="CppEditor" version="1.2.80"/> <dependency name="CppEditor" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="DuiEditor" version="1.2.80" compatVersion="1.2.80"> <plugin name="DuiEditor" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,7 +19,7 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Editor for DUI.</description> <description>Editor for DUI.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="FakeVim" version="1.2.80" compatVersion="1.2.80"> <plugin name="FakeVim" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,9 +19,9 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>VI-style keyboard navigation.</description> <description>VI-style keyboard navigation.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="CppEditor" version="1.2.80"/><!-- Plugin adds items to the editor's context menu --> <dependency name="CppEditor" version="1.2.91"/><!-- Plugin adds items to the editor's context menu -->
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="Find" version="1.2.80" compatVersion="1.2.80"> <plugin name="Find" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,6 +19,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Provides the find widget and the hooks for find implementations.</description> <description>Provides the find widget and the hooks for find implementations.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -125,7 +125,7 @@ QString BaseTextFind::completedFindString() const
return cursor.selectedText(); return cursor.selectedText();
} }
bool BaseTextFind::findIncremental(const QString &txt, IFindSupport::FindFlags findFlags) IFindSupport::Result BaseTextFind::findIncremental(const QString &txt, IFindSupport::FindFlags findFlags)
{ {
QTextCursor cursor = textCursor(); QTextCursor cursor = textCursor();
if (m_incrementalStartPos < 0) if (m_incrementalStartPos < 0)
@@ -137,15 +137,15 @@ bool BaseTextFind::findIncremental(const QString &txt, IFindSupport::FindFlags f
emit highlightAll(txt, findFlags); emit highlightAll(txt, findFlags);
else else
emit highlightAll(QString(), 0); emit highlightAll(QString(), 0);
return found; return found ? Found : NotFound;
} }
bool BaseTextFind::findStep(const QString &txt, IFindSupport::FindFlags findFlags) IFindSupport::Result BaseTextFind::findStep(const QString &txt, IFindSupport::FindFlags findFlags)
{ {
bool found = find(txt, findFlags, textCursor()); bool found = find(txt, findFlags, textCursor());
if (found) if (found)
m_incrementalStartPos = textCursor().selectionStart(); m_incrementalStartPos = textCursor().selectionStart();
return found; return found ? Found : NotFound;
} }
namespace { namespace {

View File

@@ -53,8 +53,8 @@ public:
QString currentFindString() const; QString currentFindString() const;
QString completedFindString() const; QString completedFindString() const;
bool findIncremental(const QString &txt, IFindSupport::FindFlags findFlags); Result findIncremental(const QString &txt, IFindSupport::FindFlags findFlags);
bool findStep(const QString &txt, IFindSupport::FindFlags findFlags); Result findStep(const QString &txt, IFindSupport::FindFlags findFlags);
bool replaceStep(const QString &before, const QString &after, bool replaceStep(const QString &before, const QString &after,
IFindSupport::FindFlags findFlags); IFindSupport::FindFlags findFlags);
int replaceAll(const QString &before, const QString &after, int replaceAll(const QString &before, const QString &after,

View File

@@ -106,15 +106,15 @@ void CurrentDocumentFind::highlightAll(const QString &txt, IFindSupport::FindFla
m_currentFind->highlightAll(txt, findFlags); m_currentFind->highlightAll(txt, findFlags);
} }
bool CurrentDocumentFind::findIncremental(const QString &txt, IFindSupport::FindFlags findFlags) IFindSupport::Result CurrentDocumentFind::findIncremental(const QString &txt, IFindSupport::FindFlags findFlags)
{ {
QTC_ASSERT(m_currentFind, return false); QTC_ASSERT(m_currentFind, return IFindSupport::NotFound);
return m_currentFind->findIncremental(txt, findFlags); return m_currentFind->findIncremental(txt, findFlags);
} }
bool CurrentDocumentFind::findStep(const QString &txt, IFindSupport::FindFlags findFlags) IFindSupport::Result CurrentDocumentFind::findStep(const QString &txt, IFindSupport::FindFlags findFlags)
{ {
QTC_ASSERT(m_currentFind, return false); QTC_ASSERT(m_currentFind, return IFindSupport::NotFound);
return m_currentFind->findStep(txt, findFlags); return m_currentFind->findStep(txt, findFlags);
} }

View File

@@ -55,8 +55,8 @@ public:
bool isEnabled() const; bool isEnabled() const;
bool candidateIsEnabled() const; bool candidateIsEnabled() const;
void highlightAll(const QString &txt, IFindSupport::FindFlags findFlags); void highlightAll(const QString &txt, IFindSupport::FindFlags findFlags);
bool findIncremental(const QString &txt, IFindSupport::FindFlags findFlags); IFindSupport::Result findIncremental(const QString &txt, IFindSupport::FindFlags findFlags);
bool findStep(const QString &txt, IFindSupport::FindFlags findFlags); IFindSupport::Result findStep(const QString &txt, IFindSupport::FindFlags findFlags);
bool replaceStep(const QString &before, const QString &after, bool replaceStep(const QString &before, const QString &after,
IFindSupport::FindFlags findFlags); IFindSupport::FindFlags findFlags);
int replaceAll(const QString &before, const QString &after, int replaceAll(const QString &before, const QString &after,

View File

@@ -69,7 +69,8 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_replaceNextAction(0), m_replaceNextAction(0),
m_casesensitiveIcon(":/find/images/casesensitively.png"), m_casesensitiveIcon(":/find/images/casesensitively.png"),
m_regexpIcon(":/find/images/regexp.png"), m_regexpIcon(":/find/images/regexp.png"),
m_wholewordsIcon(":/find/images/wholewords.png") m_wholewordsIcon(":/find/images/wholewords.png"),
m_findIncrementalTimer(this), m_findStepTimer(this)
{ {
//setup ui //setup ui
m_ui.setupUi(this); m_ui.setupUi(this);
@@ -215,6 +216,12 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
connect(m_currentDocumentFind, SIGNAL(candidateChanged()), this, SLOT(adaptToCandidate())); connect(m_currentDocumentFind, SIGNAL(candidateChanged()), this, SLOT(adaptToCandidate()));
connect(m_currentDocumentFind, SIGNAL(changed()), this, SLOT(updateToolBar())); connect(m_currentDocumentFind, SIGNAL(changed()), this, SLOT(updateToolBar()));
updateToolBar(); updateToolBar();
m_findIncrementalTimer.setSingleShot(true);
m_findStepTimer.setSingleShot(true);
connect(&m_findIncrementalTimer, SIGNAL(timeout()),
this, SLOT(invokeFindIncremental()));
connect(&m_findStepTimer, SIGNAL(timeout()), this, SLOT(invokeFindStep()));
} }
FindToolBar::~FindToolBar() FindToolBar::~FindToolBar()
@@ -373,17 +380,27 @@ void FindToolBar::selectFindText()
void FindToolBar::invokeFindStep() void FindToolBar::invokeFindStep()
{ {
m_findStepTimer.stop();
m_findIncrementalTimer.stop();
if (m_currentDocumentFind->isEnabled()) { if (m_currentDocumentFind->isEnabled()) {
m_plugin->updateFindCompletion(getFindText()); m_plugin->updateFindCompletion(getFindText());
IFindSupport::Result result =
m_currentDocumentFind->findStep(getFindText(), effectiveFindFlags()); m_currentDocumentFind->findStep(getFindText(), effectiveFindFlags());
if (result == IFindSupport::NotYetFound)
m_findStepTimer.start(50);
} }
} }
void FindToolBar::invokeFindIncremental() void FindToolBar::invokeFindIncremental()
{ {
m_findIncrementalTimer.stop();
m_findStepTimer.stop();
if (m_currentDocumentFind->isEnabled()) { if (m_currentDocumentFind->isEnabled()) {
QString text = getFindText(); QString text = getFindText();
IFindSupport::Result result =
m_currentDocumentFind->findIncremental(text, effectiveFindFlags()); m_currentDocumentFind->findIncremental(text, effectiveFindFlags());
if (result == IFindSupport::NotYetFound)
m_findIncrementalTimer.start(50);
if (text.isEmpty()) if (text.isEmpty())
m_currentDocumentFind->clearResults(); m_currentDocumentFind->clearResults();
} }
@@ -421,6 +438,8 @@ void FindToolBar::invokeReplaceAll()
void FindToolBar::invokeResetIncrementalSearch() void FindToolBar::invokeResetIncrementalSearch()
{ {
m_findIncrementalTimer.stop();
m_findStepTimer.stop();
if (m_currentDocumentFind->isEnabled()) if (m_currentDocumentFind->isEnabled())
m_currentDocumentFind->resetIncrementalSearch(); m_currentDocumentFind->resetIncrementalSearch();
} }

View File

@@ -37,6 +37,8 @@
#include <coreplugin/findplaceholder.h> #include <coreplugin/findplaceholder.h>
#include <utils/styledbar.h> #include <utils/styledbar.h>
#include <QtCore/QTimer>
#include <QtGui/QStringListModel> #include <QtGui/QStringListModel>
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QtGui/QLabel> #include <QtGui/QLabel>
@@ -124,6 +126,9 @@ private:
QPixmap m_casesensitiveIcon; QPixmap m_casesensitiveIcon;
QPixmap m_regexpIcon; QPixmap m_regexpIcon;
QPixmap m_wholewordsIcon; QPixmap m_wholewordsIcon;
QTimer m_findIncrementalTimer;
QTimer m_findStepTimer;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -50,6 +50,8 @@ public:
}; };
Q_DECLARE_FLAGS(FindFlags, FindFlag) Q_DECLARE_FLAGS(FindFlags, FindFlag)
enum Result { Found, NotFound, NotYetFound };
IFindSupport() : QObject(0) {} IFindSupport() : QObject(0) {}
virtual ~IFindSupport() {} virtual ~IFindSupport() {}
@@ -61,8 +63,8 @@ public:
virtual QString completedFindString() const = 0; virtual QString completedFindString() const = 0;
virtual void highlightAll(const QString &txt, FindFlags findFlags); virtual void highlightAll(const QString &txt, FindFlags findFlags);
virtual bool findIncremental(const QString &txt, FindFlags findFlags) = 0; virtual Result findIncremental(const QString &txt, FindFlags findFlags) = 0;
virtual bool findStep(const QString &txt, FindFlags findFlags) = 0; virtual Result findStep(const QString &txt, FindFlags findFlags) = 0;
virtual bool replaceStep(const QString &before, const QString &after, virtual bool replaceStep(const QString &before, const QString &after,
FindFlags findFlags) = 0; FindFlags findFlags) = 0;
virtual int replaceAll(const QString &before, const QString &after, virtual int replaceAll(const QString &before, const QString &after,

View File

@@ -1,4 +1,4 @@
<plugin name="GenericProjectManager" version="1.2.80" compatVersion="1.2.80"> <plugin name="GenericProjectManager" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,9 +19,9 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Generic support</description> <description>Generic support</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="CppTools" version="1.2.80"/> <dependency name="CppTools" version="1.2.91"/>
<dependency name="CppEditor" version="1.2.80"/> <dependency name="CppEditor" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="ScmGit" version="1.2.80" compatVersion="1.2.80"> <plugin name="ScmGit" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,9 +19,9 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Git integration.</description> <description>Git integration.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="VCSBase" version="1.2.80"/> <dependency name="VCSBase" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="HelloWorld" version="1.2.80" compatVersion="1.2.80"> <plugin name="HelloWorld" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,6 +19,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Hello World sample plugin.</description> <description>Hello World sample plugin.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="Help" version="1.2.80" compatVersion="1.2.80"> <plugin name="Help" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,8 +19,8 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Help system.</description> <description>Help system.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="Find" version="1.2.80"/> <dependency name="Find" version="1.2.91"/>
<dependency name="QuickOpen" version="1.2.80"/> <dependency name="QuickOpen" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -72,17 +72,19 @@ QString HelpFindSupport::completedFindString() const
return QString(); return QString();
} }
bool HelpFindSupport::findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags) Find::IFindSupport::Result HelpFindSupport::findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags)
{ {
QTC_ASSERT(m_centralWidget, return false); QTC_ASSERT(m_centralWidget, return NotFound);
findFlags &= ~Find::IFindSupport::FindBackward; findFlags &= ~Find::IFindSupport::FindBackward;
return m_centralWidget->find(txt, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags), true); return m_centralWidget->find(txt, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags), true)
? Found : NotFound;
} }
bool HelpFindSupport::findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags) Find::IFindSupport::Result HelpFindSupport::findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags)
{ {
QTC_ASSERT(m_centralWidget, return false); QTC_ASSERT(m_centralWidget, return NotFound);
return m_centralWidget->find(txt, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags), false); return m_centralWidget->find(txt, Find::IFindSupport::textDocumentFlagsForFindFlags(findFlags), false)
? Found : NotFound;
} }
HelpViewerFindSupport::HelpViewerFindSupport(HelpViewer *viewer) HelpViewerFindSupport::HelpViewerFindSupport(HelpViewer *viewer)
@@ -106,17 +108,17 @@ QString HelpViewerFindSupport::currentFindString() const
#endif #endif
} }
bool HelpViewerFindSupport::findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags) Find::IFindSupport::Result HelpViewerFindSupport::findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags)
{ {
QTC_ASSERT(m_viewer, return false); QTC_ASSERT(m_viewer, return NotFound);
findFlags &= ~Find::IFindSupport::FindBackward; findFlags &= ~Find::IFindSupport::FindBackward;
return find(txt, findFlags, true); return find(txt, findFlags, true) ? Found : NotFound;
} }
bool HelpViewerFindSupport::findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags) Find::IFindSupport::Result HelpViewerFindSupport::findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags)
{ {
QTC_ASSERT(m_viewer, return false); QTC_ASSERT(m_viewer, return NotFound);
return find(txt, findFlags, false); return find(txt, findFlags, false) ? Found : NotFound;
} }
bool HelpViewerFindSupport::find(const QString &txt, Find::IFindSupport::FindFlags findFlags, bool incremental) bool HelpViewerFindSupport::find(const QString &txt, Find::IFindSupport::FindFlags findFlags, bool incremental)

View File

@@ -57,8 +57,8 @@ public:
QString currentFindString() const; QString currentFindString() const;
QString completedFindString() const; QString completedFindString() const;
bool findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags); Result findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags);
bool findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags); Result findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags);
bool replaceStep(const QString &, const QString &, bool replaceStep(const QString &, const QString &,
Find::IFindSupport::FindFlags ) { return false; } Find::IFindSupport::FindFlags ) { return false; }
int replaceAll(const QString &, const QString &, int replaceAll(const QString &, const QString &,
@@ -84,8 +84,8 @@ public:
QString currentFindString() const; QString currentFindString() const;
QString completedFindString() const { return QString(); } QString completedFindString() const { return QString(); }
bool findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags); Result findIncremental(const QString &txt, Find::IFindSupport::FindFlags findFlags);
bool findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags); Result findStep(const QString &txt, Find::IFindSupport::FindFlags findFlags);
bool replaceStep(const QString &, const QString &, bool replaceStep(const QString &, const QString &,
Find::IFindSupport::FindFlags ) { return false; } Find::IFindSupport::FindFlags ) { return false; }
int replaceAll(const QString &, const QString &, int replaceAll(const QString &, const QString &,

View File

@@ -1,4 +1,4 @@
<plugin name="Perforce" version="1.2.80" compatVersion="1.2.80"> <plugin name="Perforce" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,9 +19,9 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Perforce integration.</description> <description>Perforce integration.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="VCSBase" version="1.2.80"/> <dependency name="VCSBase" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="ProjectExplorer" version="1.2.80" compatVersion="1.2.80"> <plugin name="ProjectExplorer" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,9 +19,9 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>ProjectExplorer framework that can be extended with different kind of project types.</description> <description>ProjectExplorer framework that can be extended with different kind of project types.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="Find" version="1.2.80"/> <dependency name="Find" version="1.2.91"/>
<dependency name="QuickOpen" version="1.2.80"/> <dependency name="QuickOpen" version="1.2.91"/>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="QmlProjectManager" version="1.2.80" compatVersion="1.2.80"> <plugin name="QmlProjectManager" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,10 +19,10 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Qml support</description> <description>Qml support</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="CppTools" version="1.2.80"/> <dependency name="CppTools" version="1.2.91"/>
<dependency name="CppEditor" version="1.2.80"/> <dependency name="CppEditor" version="1.2.91"/>
<dependency name="Help" version="1.2.80"/> <dependency name="Help" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="Qt4ProjectManager" version="1.2.80" compatVersion="1.2.80"> <plugin name="Qt4ProjectManager" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,11 +19,11 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Provides project type for Qt 4 pro files and tools.</description> <description>Provides project type for Qt 4 pro files and tools.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="CppTools" version="1.2.80"/> <dependency name="CppTools" version="1.2.91"/>
<dependency name="CppEditor" version="1.2.80"/> <dependency name="CppEditor" version="1.2.91"/>
<dependency name="Help" version="1.2.80"/> <dependency name="Help" version="1.2.91"/>
<dependency name="Designer" version="1.2.80"/> <dependency name="Designer" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -537,36 +537,34 @@ S60DeviceRunControl::S60DeviceRunControl(QSharedPointer<RunConfiguration> runCon
this, SLOT(signsisProcessFailed())); this, SLOT(signsisProcessFailed()));
connect(m_signsis, SIGNAL(finished(int,QProcess::ExitStatus)), connect(m_signsis, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(signsisProcessFinished())); this, SLOT(signsisProcessFinished()));
Qt4Project *project = qobject_cast<Qt4Project *>(runConfiguration->project());
QTC_ASSERT(project, return);
m_serialPortName = runConfiguration->serialPortName();
m_serialPortFriendlyName = S60Manager::instance()->serialDeviceLister()->friendlyNameForPort(m_serialPortName);
m_targetName = runConfiguration->targetName();
m_baseFileName = runConfiguration->basePackageFilePath();
m_workingDirectory = QFileInfo(m_baseFileName).absolutePath();
m_qtDir = project->qtVersion(project->activeBuildConfiguration())->versionInfo().value("QT_INSTALL_DATA");
m_useCustomSignature = (runConfiguration->signingMode() == S60DeviceRunConfiguration::SignCustom);
m_customSignaturePath = runConfiguration->customSignaturePath();
m_customKeyPath = runConfiguration->customKeyPath();
m_toolsDirectory = S60Manager::instance()->deviceForQtVersion(
project->qtVersion(project->activeBuildConfiguration())).toolsRoot
+ "/epoc32/tools";
m_executableFileName = lsFile(runConfiguration->executableFileName());
const QString makesisTool = m_toolsDirectory + "/makesis.exe";
const QString packageFile = QFileInfo(runConfiguration->packageFileName()).fileName();
} }
void S60DeviceRunControl::start() void S60DeviceRunControl::start()
{ {
QSharedPointer<S60DeviceRunConfiguration> rc = runConfiguration().objectCast<S60DeviceRunConfiguration>();
QTC_ASSERT(!rc.isNull(), return);
Qt4Project *project = qobject_cast<Qt4Project *>(rc->project());
QTC_ASSERT(project, return);
m_serialPortName = rc->serialPortName();
m_serialPortFriendlyName = S60Manager::instance()->serialDeviceLister()->friendlyNameForPort(m_serialPortName);
m_targetName = rc->targetName();
m_baseFileName = rc->basePackageFilePath();
m_workingDirectory = QFileInfo(m_baseFileName).absolutePath();
m_qtDir = project->qtVersion(project->activeBuildConfiguration())->versionInfo().value("QT_INSTALL_DATA");
m_useCustomSignature = (rc->signingMode() == S60DeviceRunConfiguration::SignCustom);
m_customSignaturePath = rc->customSignaturePath();
m_customKeyPath = rc->customKeyPath();
emit started(); emit started();
emit addToOutputWindow(this, tr("Creating %1.sisx ...").arg(QDir::toNativeSeparators(m_baseFileName))); emit addToOutputWindow(this, tr("Creating %1.sisx ...").arg(QDir::toNativeSeparators(m_baseFileName)));
emit addToOutputWindow(this, tr("Executable file: %1").arg(lsFile(rc->executableFileName()))); emit addToOutputWindow(this, tr("Executable file: %1").arg(m_executableFileName));
m_toolsDirectory = S60Manager::instance()->deviceForQtVersion(
project->qtVersion(project->activeBuildConfiguration())).toolsRoot
+ "/epoc32/tools";
const QString makesisTool = m_toolsDirectory + "/makesis.exe";
const QString packageFile = QFileInfo(rc->packageFileName()).fileName();
m_makesis->setWorkingDirectory(m_workingDirectory); m_makesis->setWorkingDirectory(m_workingDirectory);
emit addToOutputWindow(this, tr("%1 %2").arg(QDir::toNativeSeparators(makesisTool), packageFile)); emit addToOutputWindow(this, tr("%1 %2").arg(QDir::toNativeSeparators(makesisTool), packageFile));

View File

@@ -176,6 +176,7 @@ private:
QString m_baseFileName; QString m_baseFileName;
QString m_workingDirectory; QString m_workingDirectory;
QString m_toolsDirectory; QString m_toolsDirectory;
QString m_executableFileName;
QString m_qtDir; QString m_qtDir;
bool m_useCustomSignature; bool m_useCustomSignature;
QString m_customSignaturePath; QString m_customSignaturePath;

View File

@@ -325,7 +325,7 @@ static inline QString msgHtmlHelperToolTip(const QFileInfo &fi)
return QtOptionsPageWidget::tr("<html><body><table><tr><td>File:</td><td><pre>%1</pre></td></tr>" return QtOptionsPageWidget::tr("<html><body><table><tr><td>File:</td><td><pre>%1</pre></td></tr>"
"<tr><td>Last&nbsp;modified:</td><td>%2</td></tr>" "<tr><td>Last&nbsp;modified:</td><td>%2</td></tr>"
"<tr><td>Size:</td><td>%3 Bytes</td></tr></table></body></html>"). "<tr><td>Size:</td><td>%3 Bytes</td></tr></table></body></html>").
arg(fi.absoluteFilePath()). arg(QDir::toNativeSeparators(fi.absoluteFilePath())).
arg(fi.lastModified().toString(Qt::SystemLocaleLongDate)). arg(fi.lastModified().toString(Qt::SystemLocaleLongDate)).
arg(fi.size()); arg(fi.size());
} }

View File

@@ -1244,7 +1244,7 @@ QStringList QtVersion::debuggingHelperLibraryLocations() const
{ {
QString qtInstallData = versionInfo().value("QT_INSTALL_DATA"); QString qtInstallData = versionInfo().value("QT_INSTALL_DATA");
if (qtInstallData.isEmpty()) if (qtInstallData.isEmpty())
QString::null; return QStringList();
return DebuggingHelperLibrary::debuggingHelperLibraryLocations(qtInstallData); return DebuggingHelperLibrary::debuggingHelperLibraryLocations(qtInstallData);
} }

View File

@@ -1,4 +1,4 @@
<plugin name="QtScriptEditor" version="1.2.80" compatVersion="1.2.80"> <plugin name="QtScriptEditor" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,7 +19,7 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Editor for QtScript.</description> <description>Editor for QtScript.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="QuickOpen" version="1.2.80" compatVersion="1.2.80"> <plugin name="QuickOpen" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,6 +19,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Provides the Locator widget and the hooks for QuickOpen filter implementations.</description> <description>Provides the Locator widget and the hooks for QuickOpen filter implementations.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="RegExp" version="1.2.80" compatVersion="1.2.80"> <plugin name="RegExp" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,6 +19,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Regular Expression test widget.</description> <description>Regular Expression test widget.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="ResourceEditor" version="1.2.80" compatVersion="1.2.80"> <plugin name="ResourceEditor" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,6 +19,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Editor for qrc files.</description> <description>Editor for qrc files.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="Snippets" version="1.2.80" compatVersion="1.2.80"> <plugin name="Snippets" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,8 +19,8 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Code snippet plugin.</description> <description>Code snippet plugin.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="Subversion" version="1.2.80" compatVersion="1.2.80"> <plugin name="Subversion" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,9 +19,9 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Subversion integration.</description> <description>Subversion integration.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="VCSBase" version="1.2.80"/> <dependency name="VCSBase" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="TextEditor" version="1.2.80" compatVersion="1.2.80"> <plugin name="TextEditor" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,8 +19,8 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Text editor framework and the implementation of the basic text editor.</description> <description>Text editor framework and the implementation of the basic text editor.</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="Find" version="1.2.80"/> <dependency name="Find" version="1.2.91"/>
<dependency name="QuickOpen" version="1.2.80"/> <dependency name="QuickOpen" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -93,7 +93,7 @@ bool BaseTextDocument::save(const QString &fileName)
cursor.beginEditBlock(); cursor.beginEditBlock();
if (m_storageSettings.m_cleanWhitespace) if (m_storageSettings.m_cleanWhitespace)
cleanWhitespace(cursor, m_storageSettings.m_inEntireDocument); cleanWhitespace(cursor, m_storageSettings.m_cleanIndentation, m_storageSettings.m_inEntireDocument);
if (m_storageSettings.m_addFinalNewLine) if (m_storageSettings.m_addFinalNewLine)
ensureFinalNewLine(cursor); ensureFinalNewLine(cursor);
cursor.endEditBlock(); cursor.endEditBlock();
@@ -301,23 +301,28 @@ void BaseTextDocument::setSyntaxHighlighter(QSyntaxHighlighter *highlighter)
void BaseTextDocument::cleanWhitespace() void BaseTextDocument::cleanWhitespace(const QTextCursor &cursor)
{ {
QTextCursor cursor(m_document); bool hasSelection = cursor.hasSelection();
cursor.beginEditBlock(); QTextCursor copyCursor = cursor;
cleanWhitespace(cursor, true); copyCursor.beginEditBlock();
if (m_storageSettings.m_addFinalNewLine) cleanWhitespace(copyCursor, true, true);
ensureFinalNewLine(cursor); if (!hasSelection)
cursor.endEditBlock(); ensureFinalNewLine(copyCursor);
copyCursor.endEditBlock();
} }
void BaseTextDocument::cleanWhitespace(QTextCursor& cursor, bool inEntireDocument) void BaseTextDocument::cleanWhitespace(QTextCursor& cursor, bool cleanIndentation, bool inEntireDocument)
{ {
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(m_document->documentLayout()); TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(m_document->documentLayout());
QTextBlock block = m_document->firstBlock(); QTextBlock block = m_document->findBlock(cursor.selectionStart());
while (block.isValid()) { QTextBlock end;
if (cursor.hasSelection())
end = m_document->findBlock(cursor.selectionEnd()-1).next();
while (block.isValid() && block != end) {
if (inEntireDocument || block.revision() > documentLayout->lastSaveRevision) { if (inEntireDocument || block.revision() > documentLayout->lastSaveRevision) {
@@ -327,7 +332,7 @@ void BaseTextDocument::cleanWhitespace(QTextCursor& cursor, bool inEntireDocumen
cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor, trailing); cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor, trailing);
cursor.removeSelectedText(); cursor.removeSelectedText();
} }
if (m_storageSettings.m_cleanIndentation && !m_tabSettings.isIndentationClean(blockText)) { if (cleanIndentation && !m_tabSettings.isIndentationClean(blockText)) {
cursor.setPosition(block.position()); cursor.setPosition(block.position());
int firstNonSpace = m_tabSettings.firstNonSpace(blockText); int firstNonSpace = m_tabSettings.firstNonSpace(blockText);
if (firstNonSpace == blockText.length()) { if (firstNonSpace == blockText.length()) {

View File

@@ -110,7 +110,7 @@ public:
void reload(QTextCodec *codec); void reload(QTextCodec *codec);
void cleanWhitespace(); void cleanWhitespace(const QTextCursor &cursor);
signals: signals:
void titleChanged(QString title); void titleChanged(QString title);
@@ -146,7 +146,7 @@ private:
bool m_hasDecodingError; bool m_hasDecodingError;
QByteArray m_decodingErrorSample; QByteArray m_decodingErrorSample;
void cleanWhitespace(QTextCursor& cursor, bool onlyInModifiedLines); void cleanWhitespace(QTextCursor& cursor, bool cleanIndentation, bool inEntireDocument);
void ensureFinalNewLine(QTextCursor& cursor); void ensureFinalNewLine(QTextCursor& cursor);
}; };

View File

@@ -833,7 +833,7 @@ void BaseTextEditor::moveLineUpDown(bool up)
void BaseTextEditor::cleanWhitespace() void BaseTextEditor::cleanWhitespace()
{ {
d->m_document->cleanWhitespace(); d->m_document->cleanWhitespace(textCursor());
} }
void BaseTextEditor::keyPressEvent(QKeyEvent *e) void BaseTextEditor::keyPressEvent(QKeyEvent *e)
@@ -887,13 +887,18 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
QTextCursor cursor = textCursor(); QTextCursor cursor = textCursor();
if (d->m_inBlockSelectionMode) if (d->m_inBlockSelectionMode)
cursor.clearSelection(); cursor.clearSelection();
if (d->m_document->tabSettings().m_autoIndent) { const TabSettings &ts = d->m_document->tabSettings();
if (ts.m_autoIndent) {
cursor.beginEditBlock(); cursor.beginEditBlock();
cursor.insertBlock(); cursor.insertBlock();
indent(document(), cursor, QChar::Null); indent(document(), cursor, QChar::Null);
cursor.endEditBlock(); cursor.endEditBlock();
} else { } else {
cursor.beginEditBlock();
QString previousBlockText = cursor.block().text();
cursor.insertBlock(); cursor.insertBlock();
cursor.insertText(ts.indentationString(previousBlockText));
cursor.endEditBlock();
} }
e->accept(); e->accept();
setTextCursor(cursor); setTextCursor(cursor);
@@ -3189,17 +3194,14 @@ void BaseTextEditor::handleBackspaceKey()
continue; continue;
previousIndent = tabSettings.columnAt(previousNonEmptyBlockText, previousIndent = tabSettings.columnAt(previousNonEmptyBlockText,
tabSettings.firstNonSpace(previousNonEmptyBlockText)); tabSettings.firstNonSpace(previousNonEmptyBlockText));
if (previousIndent < indent) if (previousIndent < indent) {
break;
}
if (previousIndent >= indent)
previousIndent = 0;
cursor.beginEditBlock(); cursor.beginEditBlock();
cursor.setPosition(currentBlock.position(), QTextCursor::KeepAnchor); cursor.setPosition(currentBlock.position(), QTextCursor::KeepAnchor);
cursor.insertText(tabSettings.indentationString(0, previousIndent)); cursor.insertText(tabSettings.indentationString(previousNonEmptyBlockText));
cursor.endEditBlock(); cursor.endEditBlock();
break;
}
}
} }
void BaseTextEditor::wheelEvent(QWheelEvent *e) void BaseTextEditor::wheelEvent(QWheelEvent *e)

View File

@@ -156,7 +156,17 @@ bool CompletionWidget::event(QEvent *e)
closeList(currentIndex()); closeList(currentIndex());
return true; return true;
case Qt::Key_Up: case Qt::Key_Up:
if (currentIndex().row() == 0) {
setCurrentIndex(model()->index(model()->rowCount()-1, 0));
return true;
}
forwardKeys = false;
break;
case Qt::Key_Down: case Qt::Key_Down:
if (currentIndex().row() == model()->rowCount()-1) {
setCurrentIndex(model()->index(0, 0));
return true;
}
case Qt::Key_Enter: case Qt::Key_Enter:
case Qt::Key_PageDown: case Qt::Key_PageDown:
case Qt::Key_PageUp: case Qt::Key_PageUp:

View File

@@ -110,6 +110,18 @@ int TabSettings::firstNonSpace(const QString &text) const
return i; return i;
} }
QString TabSettings::indentationString(const QString &text) const
{
return text.left(firstNonSpace(text));
}
int TabSettings::indentationColumn(const QString &text) const
{
return columnAt(text, firstNonSpace(text));
}
int TabSettings::trailingWhitespaces(const QString &text) const int TabSettings::trailingWhitespaces(const QString &text) const
{ {
int i = 0; int i = 0;
@@ -225,7 +237,7 @@ void TabSettings::indentLine(QTextBlock block, int newIndent) const
const int oldBlockLength = text.size(); const int oldBlockLength = text.size();
// Quickly check whether indenting is required. // Quickly check whether indenting is required.
if (oldBlockLength == 0 && newIndent == 0) if (indentationColumn(text) == newIndent)
return; return;
const QString indentString = indentationString(0, newIndent); const QString indentString = indentationString(0, newIndent);
@@ -234,12 +246,6 @@ void TabSettings::indentLine(QTextBlock block, int newIndent) const
if (oldBlockLength == indentString.length() && text == indentString) if (oldBlockLength == indentString.length() && text == indentString)
return; return;
if (oldBlockLength > indentString.length() &&
text.startsWith(indentString) &&
!text.at(indentString.length()).isSpace()) {
return;
}
QTextCursor cursor(block); QTextCursor cursor(block);
cursor.beginEditBlock(); cursor.beginEditBlock();
cursor.movePosition(QTextCursor::StartOfBlock); cursor.movePosition(QTextCursor::StartOfBlock);

View File

@@ -63,6 +63,8 @@ struct TEXTEDITOR_EXPORT TabSettings
int spacesLeftFromPosition(const QString &text, int position) const; int spacesLeftFromPosition(const QString &text, int position) const;
int indentedColumn(int column, bool doIndent = true) const; int indentedColumn(int column, bool doIndent = true) const;
QString indentationString(int startColumn, int targetColumn) const; QString indentationString(int startColumn, int targetColumn) const;
QString indentationString(const QString &text) const;
int indentationColumn(const QString &text) const;
void indentLine(QTextBlock block, int newIndent) const; void indentLine(QTextBlock block, int newIndent) const;

View File

@@ -1,4 +1,4 @@
<plugin name="VCSBase" version="1.2.80" compatVersion="1.2.80"> <plugin name="VCSBase" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,8 +19,8 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Version Control System Base Plugin</description> <description>Version Control System Base Plugin</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
<dependency name="TextEditor" version="1.2.80"/> <dependency name="TextEditor" version="1.2.91"/>
<dependency name="ProjectExplorer" version="1.2.80"/> <dependency name="ProjectExplorer" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1,4 +1,4 @@
<plugin name="Welcome" version="1.2.80" compatVersion="1.2.80"> <plugin name="Welcome" version="1.2.91" compatVersion="1.2.91">
<vendor>Nokia Corporation</vendor> <vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright> <copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license> <license>
@@ -19,6 +19,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Default Welcome Screen Plugin</description> <description>Default Welcome Screen Plugin</description>
<url>http://qt.nokia.com</url> <url>http://qt.nokia.com</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.2.80"/> <dependency name="Core" version="1.2.91"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -1139,10 +1139,11 @@ ProItem::ProItemReturn ProFileEvaluator::Private::visitBeginProFile(ProFile * pr
} }
if (!qmake_cache.isEmpty()) { if (!qmake_cache.isEmpty()) {
qmake_cache = QDir::cleanPath(qmake_cache); qmake_cache = QDir::cleanPath(qmake_cache);
if (evaluateFileInto(qmake_cache, &m_option->cache_valuemap, 0)) { QHash<QString, QStringList> cache_valuemap;
if (evaluateFileInto(qmake_cache, &cache_valuemap, 0)) {
m_option->cachefile = qmake_cache; m_option->cachefile = qmake_cache;
if (m_option->qmakespec.isEmpty()) { if (m_option->qmakespec.isEmpty()) {
const QStringList &vals = m_option->cache_valuemap.value(QLatin1String("QMAKESPEC")); const QStringList &vals = cache_valuemap.value(QLatin1String("QMAKESPEC"));
if (!vals.isEmpty()) if (!vals.isEmpty())
m_option->qmakespec = vals.first(); m_option->qmakespec = vals.first();
} }
@@ -1196,8 +1197,9 @@ ProItem::ProItemReturn ProFileEvaluator::Private::visitBeginProFile(ProFile * pr
if (!evaluateFileInto(spec, if (!evaluateFileInto(spec,
&m_option->base_valuemap, &m_option->base_functions)) { &m_option->base_valuemap, &m_option->base_functions)) {
errorMessage(format("Could not read qmake configuration file %1").arg(spec)); errorMessage(format("Could not read qmake configuration file %1").arg(spec));
} else { } else if (!m_option->cachefile.isEmpty()) {
evaluateFileInto(qmake_cache, &m_option->base_valuemap, 0); evaluateFileInto(m_option->cachefile,
&m_option->base_valuemap, &m_option->base_functions);
} }
} }

View File

@@ -88,8 +88,7 @@ public:
friend class ProFileEvaluator; friend class ProFileEvaluator;
friend class ProFileEvaluator::Private; friend class ProFileEvaluator::Private;
static QString field_sep; // Just a cache for quick construction static QString field_sep; // Just a cache for quick construction
QHash<QString, QStringList> cache_valuemap; // Cached results of .qmake.cache QHash<QString, QStringList> base_valuemap; // Cached results of qmake.conf, .qmake.cache & default_pre.prf
QHash<QString, QStringList> base_valuemap; // ~ and qmake.conf and default_pre.prf
FunctionDefs base_functions; FunctionDefs base_functions;
QStringList feature_roots; QStringList feature_roots;
}; };

View File

@@ -1,14 +1,20 @@
TEMPLATE = app TEMPLATE = app
DEBUGGERHOME = ../../../src/plugins/debugger/symbian
INCLUDEPATH *= $$DEBUGGERHOME
UTILSDIR = ../../../src/libs
QT = core network QT = core network
win32:CONFIG+=console win32:CONFIG+=console
HEADERS += trkutils.h \ HEADERS += \
trkfunctor.h \ $$DEBUGGERHOME/trkutils.h \
trkdevice.h \ $$DEBUGGERHOME/trkfunctor.h \
$$PWD/trkdevice.h \
SOURCES += \ SOURCES += \
adapter.cpp \ $$DEBUGGERHOME/trkutils.cpp \
trkutils.cpp \ $$PWD/trkdevice.cpp \
trkdevice.cpp $$PWD/adapter.cpp \

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,23 @@
TEMPLATE = app TEMPLATE = app
DEBUGGERHOME = ../../../src/plugins/debugger/symbian
INCLUDEPATH *= $$DEBUGGERHOME
DEFINES += STANDALONE_RUNNER
QT += network QT += network
win32:CONFIG+=console win32:CONFIG+=console
HEADERS += \ HEADERS += \
trkutils.h \ $$DEBUGGERHOME/../gdb/gdbprocessbase.h \
trkdevicex.h \ $$DEBUGGERHOME/trkutils.h \
$$DEBUGGERHOME/trkclient.h \
$$DEBUGGERHOME/symbianadapter.h \
SOURCES += \ SOURCES += \
runner.cpp \ $$DEBUGGERHOME/trkutils.cpp \
trkutils.cpp \ $$DEBUGGERHOME/trkclient.cpp \
trkdevicex.cpp \ $$DEBUGGERHOME/symbianadapter.cpp \
$$PWD/runner.cpp \

View File

@@ -1,9 +1,15 @@
DEFINES += DEBUG_TRK=0 DEFINES += DEBUG_TRK=0
INCLUDEPATH *= $$PWD DEBUGGERHOME = ../../../src/plugins/debugger/symbian
SOURCES += $$PWD/launcher.cpp \
$$PWD/trkutils.cpp \ INCLUDEPATH *= $$PWD $$DEBUGGERHOME
$$PWD/trkdevice.cpp
HEADERS += $$PWD/trkutils.h \ SOURCES += \
$$PWD/trkfunctor.h \ $$DEBUGGERHOME/trkutils.cpp \
$$PWD/trkdevice.cpp \
$$PWD/launcher.cpp \
HEADERS += \
$$DEBUGGERHOME/trkutils.h \
$$DEBUGGERHOME/trkfunctor.h \
$$PWD/trkdevice.h \ $$PWD/trkdevice.h \
$$PWD/launcher.h $$PWD/launcher.h

View File

@@ -1,12 +1,17 @@
TEMPLATE = app TEMPLATE = app
DEBUGGERHOME = ../../../src/plugins/debugger/symbian
QT = core network QT = core network
win32:CONFIG+=console win32:CONFIG+=console
INCLUDEPATH *= $$DEBUGGERHOME
HEADERS += \ HEADERS += \
trkutils.h $$DEBUGGERHOME/trkutils.h
SOURCES += \ SOURCES += \
trkutils.cpp \ $$DEBUGGERHOME/trkutils.cpp \
trkserver.cpp $$PWD/trkserver.cpp